summaryrefslogtreecommitdiff
path: root/chromium/components/signin/core/browser/about_signin_internals.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/signin/core/browser/about_signin_internals.cc')
-rw-r--r--chromium/components/signin/core/browser/about_signin_internals.cc52
1 files changed, 49 insertions, 3 deletions
diff --git a/chromium/components/signin/core/browser/about_signin_internals.cc b/chromium/components/signin/core/browser/about_signin_internals.cc
index bdb28ddc86d..b3e4d988d4c 100644
--- a/chromium/components/signin/core/browser/about_signin_internals.cc
+++ b/chromium/components/signin/core/browser/about_signin_internals.cc
@@ -33,6 +33,35 @@ namespace {
// |kMaxRefreshTokenListSize| events are kept in memory.
const size_t kMaxRefreshTokenListSize = 50;
+enum class GaiaCookiesState {
+ kAllowed,
+ kClearOnExit,
+ kBlocked,
+};
+
+GaiaCookiesState GetGaiaCookiesState(SigninClient* signin_client) {
+ bool signin_cookies_allowed = signin_client->AreSigninCookiesAllowed();
+ if (!signin_cookies_allowed)
+ return GaiaCookiesState::kBlocked;
+
+ bool clear_cookies_on_exit = signin_client->AreSigninCookiesDeletedOnExit();
+ if (clear_cookies_on_exit)
+ return GaiaCookiesState::kClearOnExit;
+
+ return GaiaCookiesState::kAllowed;
+}
+
+std::string GetGaiaCookiesStateAsString(const GaiaCookiesState state) {
+ switch (state) {
+ case GaiaCookiesState::kBlocked:
+ return "Not allowed";
+ case GaiaCookiesState::kClearOnExit:
+ return "Cleared on exit";
+ case GaiaCookiesState::kAllowed:
+ return "Allowed";
+ }
+}
+
std::string GetTimeStr(base::Time time) {
return base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(time));
}
@@ -290,17 +319,31 @@ void AboutSigninInternals::Initialize(SigninClient* client) {
RefreshSigninPrefs();
+ client_->AddContentSettingsObserver(this);
signin_error_controller_->AddObserver(this);
identity_manager_->AddObserver(this);
identity_manager_->AddDiagnosticsObserver(this);
}
void AboutSigninInternals::Shutdown() {
+ client_->RemoveContentSettingsObserver(this);
signin_error_controller_->RemoveObserver(this);
identity_manager_->RemoveObserver(this);
identity_manager_->RemoveDiagnosticsObserver(this);
}
+void AboutSigninInternals::OnContentSettingChanged(
+ const ContentSettingsPattern& primary_pattern,
+ const ContentSettingsPattern& secondary_pattern,
+ ContentSettingsType content_type,
+ const std::string& resource_identifier) {
+ // If this is not a change to cookie settings, just ignore.
+ if (content_type != CONTENT_SETTINGS_TYPE_COOKIES)
+ return;
+
+ NotifyObservers();
+}
+
void AboutSigninInternals::NotifyObservers() {
if (!signin_observers_.might_have_observers())
return;
@@ -578,6 +621,9 @@ AboutSigninInternals::SigninStatus::ToValue(
->GetDetailedStateOfLoadingOfRefreshTokens();
AddSectionEntry(basic_info, "TokenService Load Status",
TokenServiceLoadCredentialsStateToLabel(load_tokens_state));
+ AddSectionEntry(
+ basic_info, "Gaia cookies state",
+ GetGaiaCookiesStateAsString(GetGaiaCookiesState(signin_client)));
if (identity_manager->HasPrimaryAccount()) {
CoreAccountInfo account_info = identity_manager->GetPrimaryAccountInfo();
@@ -681,16 +727,16 @@ AboutSigninInternals::SigninStatus::ToValue(
// Account info section
auto account_info_section = std::make_unique<base::ListValue>();
- const std::vector<AccountInfo>& accounts_with_refresh_tokens =
+ const std::vector<CoreAccountInfo>& accounts_with_refresh_tokens =
identity_manager->GetAccountsWithRefreshTokens();
if (accounts_with_refresh_tokens.size() == 0) {
auto no_token_entry = std::make_unique<base::DictionaryValue>();
no_token_entry->SetString("accountId", "No token in Token Service.");
account_info_section->Append(std::move(no_token_entry));
} else {
- for (const AccountInfo account_info : accounts_with_refresh_tokens) {
+ for (const CoreAccountInfo& account_info : accounts_with_refresh_tokens) {
auto entry = std::make_unique<base::DictionaryValue>();
- entry->SetString("accountId", account_info.account_id);
+ entry->SetString("accountId", account_info.account_id.id);
// TODO(https://crbug.com/919793): Remove this field once the token
// service is internally consistent on all platforms.
entry->SetBoolean("hasRefreshToken",