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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/signin/chrome_signin_client.h" 5 #include "chrome/browser/signin/chrome_signin_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 using content::ChildProcessHost; 43 using content::ChildProcessHost;
44 using content::RenderProcessHost; 44 using content::RenderProcessHost;
45 45
46 namespace { 46 namespace {
47 47
48 const char kGoogleAccountsUrl[] = "https://accounts.google.com"; 48 const char kGoogleAccountsUrl[] = "https://accounts.google.com";
49 49
50 } // namespace 50 } // namespace
51 51
52 ChromeSigninClient::ChromeSigninClient(Profile* profile) 52 ChromeSigninClient::ChromeSigninClient(
53 : profile_(profile), signin_host_id_(ChildProcessHost::kInvalidUniqueID) { 53 Profile* profile, SigninErrorController* signin_error_controller)
54 : profile_(profile),
55 signin_error_controller_(signin_error_controller),
56 signin_host_id_(ChildProcessHost::kInvalidUniqueID) {
57 signin_error_controller_->AddObserver(this);
54 } 58 }
55 59
56 ChromeSigninClient::~ChromeSigninClient() { 60 ChromeSigninClient::~ChromeSigninClient() {
61 signin_error_controller_->RemoveObserver(this);
57 std::set<RenderProcessHost*>::iterator i; 62 std::set<RenderProcessHost*>::iterator i;
58 for (i = signin_hosts_observed_.begin(); i != signin_hosts_observed_.end(); 63 for (i = signin_hosts_observed_.begin(); i != signin_hosts_observed_.end();
59 ++i) { 64 ++i) {
60 (*i)->RemoveObserver(this); 65 (*i)->RemoveObserver(this);
61 } 66 }
62 } 67 }
63 68
64 // static 69 // static
65 bool ChromeSigninClient::ProfileAllowsSigninCookies(Profile* profile) { 70 bool ChromeSigninClient::ProfileAllowsSigninCookies(Profile* profile) {
66 CookieSettings* cookie_settings = 71 CookieSettings* cookie_settings =
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 230
226 void ChromeSigninClient::PostSignedIn(const std::string& account_id, 231 void ChromeSigninClient::PostSignedIn(const std::string& account_id,
227 const std::string& username, 232 const std::string& username,
228 const std::string& password) { 233 const std::string& password) {
229 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) 234 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
230 // Don't store password hash except when lock is available for the user. 235 // Don't store password hash except when lock is available for the user.
231 if (!password.empty() && profiles::IsLockAvailable(profile_)) 236 if (!password.empty() && profiles::IsLockAvailable(profile_))
232 chrome::SetLocalAuthCredentials(profile_, password); 237 chrome::SetLocalAuthCredentials(profile_, password);
233 #endif 238 #endif
234 } 239 }
240
241 void ChromeSigninClient::OnErrorChanged() {
242 // Some tests don't have a ProfileManager.
243 if (g_browser_process->profile_manager() == nullptr)
244 return;
245
246 ProfileInfoCache& cache = g_browser_process->profile_manager()->
247 GetProfileInfoCache();
248 size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath());
249 if (index == std::string::npos)
250 return;
251
252 cache.SetProfileIsAuthErrorAtIndex(index,
253 signin_error_controller_->HasError());
254 }
OLDNEW
« 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