Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: chrome/browser/signin/chrome_signin_client.cc

Issue 813133003: New Profile metric for Auth Errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ChromeSigninClient handles no ProfileManager for tests Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.h ('k') | chrome/browser/signin/chrome_signin_client_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/chrome_signin_client.cc
diff --git a/chrome/browser/signin/chrome_signin_client.cc b/chrome/browser/signin/chrome_signin_client.cc
index bae9a04a6af04edbc34bd22ea18a235f89be6a8f..a4aaf79d51c85a58a8827d63c2ba8aec95a6538c 100644
--- a/chrome/browser/signin/chrome_signin_client.cc
+++ b/chrome/browser/signin/chrome_signin_client.cc
@@ -49,11 +49,16 @@ const char kGoogleAccountsUrl[] = "https://accounts.google.com";
} // namespace
-ChromeSigninClient::ChromeSigninClient(Profile* profile)
- : profile_(profile), signin_host_id_(ChildProcessHost::kInvalidUniqueID) {
+ChromeSigninClient::ChromeSigninClient(
+ Profile* profile, SigninErrorController* signin_error_controller)
+ : profile_(profile),
+ signin_error_controller_(signin_error_controller),
+ signin_host_id_(ChildProcessHost::kInvalidUniqueID) {
+ signin_error_controller_->AddObserver(this);
}
ChromeSigninClient::~ChromeSigninClient() {
+ signin_error_controller_->RemoveObserver(this);
std::set<RenderProcessHost*>::iterator i;
for (i = signin_hosts_observed_.begin(); i != signin_hosts_observed_.end();
++i) {
@@ -232,3 +237,18 @@ void ChromeSigninClient::PostSignedIn(const std::string& account_id,
chrome::SetLocalAuthCredentials(profile_, password);
#endif
}
+
+void ChromeSigninClient::OnErrorChanged() {
+ // Some tests don't have a ProfileManager.
+ if (g_browser_process->profile_manager() == nullptr)
+ return;
+
+ ProfileInfoCache& cache = g_browser_process->profile_manager()->
+ GetProfileInfoCache();
+ size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
+ if (index == std::string::npos)
+ return;
+
+ cache.SetProfileIsAuthErrorAtIndex(index,
+ signin_error_controller_->HasError());
+}
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.h ('k') | chrome/browser/signin/chrome_signin_client_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698