| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 ProfileInfoCache& cache = g_browser_process->profile_manager()-> |
| 243 GetProfileInfoCache(); |
| 244 size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); |
| 245 if (index == std::string::npos) |
| 246 return; |
| 247 |
| 248 cache.SetProfileIsAuthErrorAtIndex(index, |
| 249 signin_error_controller_->HasError()); |
| 250 } |
| OLD | NEW |