| 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 21 matching lines...) Expand all Loading... |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
| 35 #include "components/user_manager/user_manager.h" | 35 #include "components/user_manager/user_manager.h" |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 #if !defined(OS_ANDROID) | 38 #if !defined(OS_ANDROID) |
| 39 #include "chrome/browser/first_run/first_run.h" | 39 #include "chrome/browser/first_run/first_run.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 namespace { |
| 43 |
| 44 const char kGoogleUrl[] = ".google.com"; |
| 45 |
| 46 } // namespace |
| 47 |
| 42 ChromeSigninClient::ChromeSigninClient( | 48 ChromeSigninClient::ChromeSigninClient( |
| 43 Profile* profile, SigninErrorController* signin_error_controller) | 49 Profile* profile, SigninErrorController* signin_error_controller) |
| 44 : profile_(profile), | 50 : profile_(profile), |
| 45 signin_error_controller_(signin_error_controller) { | 51 signin_error_controller_(signin_error_controller) { |
| 46 signin_error_controller_->AddObserver(this); | 52 signin_error_controller_->AddObserver(this); |
| 47 } | 53 } |
| 48 | 54 |
| 49 ChromeSigninClient::~ChromeSigninClient() { | 55 ChromeSigninClient::~ChromeSigninClient() { |
| 50 signin_error_controller_->RemoveObserver(this); | 56 signin_error_controller_->RemoveObserver(this); |
| 51 } | 57 } |
| 52 | 58 |
| 53 // static | 59 // static |
| 54 bool ChromeSigninClient::ProfileAllowsSigninCookies(Profile* profile) { | 60 bool ChromeSigninClient::ProfileAllowsSigninCookies(Profile* profile) { |
| 55 CookieSettings* cookie_settings = | 61 CookieSettings* cookie_settings = |
| 56 CookieSettings::Factory::GetForProfile(profile).get(); | 62 CookieSettings::Factory::GetForProfile(profile).get(); |
| 57 return SettingsAllowSigninCookies(cookie_settings); | 63 return SettingsAllowSigninCookies(cookie_settings); |
| 58 } | 64 } |
| 59 | 65 |
| 60 // static | 66 // static |
| 61 bool ChromeSigninClient::SettingsAllowSigninCookies( | 67 bool ChromeSigninClient::SettingsAllowSigninCookies( |
| 62 CookieSettings* cookie_settings) { | 68 CookieSettings* cookie_settings) { |
| 63 GURL gaia_url = GaiaUrls::GetInstance()->gaia_url(); | 69 GURL gaia_url = GaiaUrls::GetInstance()->gaia_url(); |
| 64 return cookie_settings && | 70 return cookie_settings && |
| 65 cookie_settings->IsSettingCookieAllowed(gaia_url, gaia_url); | 71 cookie_settings->IsSettingCookieAllowed(gaia_url, gaia_url) && |
| 72 cookie_settings->IsSettingCookieAllowed(GURL(kGoogleUrl), |
| 73 GURL(kGoogleUrl)); |
| 66 } | 74 } |
| 67 | 75 |
| 68 PrefService* ChromeSigninClient::GetPrefs() { return profile_->GetPrefs(); } | 76 PrefService* ChromeSigninClient::GetPrefs() { return profile_->GetPrefs(); } |
| 69 | 77 |
| 70 scoped_refptr<TokenWebData> ChromeSigninClient::GetDatabase() { | 78 scoped_refptr<TokenWebData> ChromeSigninClient::GetDatabase() { |
| 71 return WebDataServiceFactory::GetTokenWebDataForProfile( | 79 return WebDataServiceFactory::GetTokenWebDataForProfile( |
| 72 profile_, ServiceAccessType::EXPLICIT_ACCESS); | 80 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
| 73 } | 81 } |
| 74 | 82 |
| 75 bool ChromeSigninClient::CanRevokeCredentials() { | 83 bool ChromeSigninClient::CanRevokeCredentials() { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 219 |
| 212 ProfileInfoCache& cache = g_browser_process->profile_manager()-> | 220 ProfileInfoCache& cache = g_browser_process->profile_manager()-> |
| 213 GetProfileInfoCache(); | 221 GetProfileInfoCache(); |
| 214 size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); | 222 size_t index = cache.GetIndexOfProfileWithPath(profile_->GetPath()); |
| 215 if (index == std::string::npos) | 223 if (index == std::string::npos) |
| 216 return; | 224 return; |
| 217 | 225 |
| 218 cache.SetProfileIsAuthErrorAtIndex(index, | 226 cache.SetProfileIsAuthErrorAtIndex(index, |
| 219 signin_error_controller_->HasError()); | 227 signin_error_controller_->HasError()); |
| 220 } | 228 } |
| OLD | NEW |