| 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 "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/content_settings/cookie_settings.h" | 12 #include "chrome/browser/content_settings/cookie_settings.h" |
| 13 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 13 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 14 #include "chrome/browser/signin/local_auth.h" | 14 #include "chrome/browser/signin/local_auth.h" |
| 15 #include "chrome/browser/webdata/web_data_service_factory.h" | 15 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 16 #include "chrome/common/chrome_version_info.h" | 16 #include "chrome/common/chrome_version_info.h" |
| 17 #include "chrome/common/pref_names.h" |
| 17 #include "components/metrics/metrics_service.h" | 18 #include "components/metrics/metrics_service.h" |
| 18 #include "components/signin/core/common/profile_management_switches.h" | 19 #include "components/signin/core/common/profile_management_switches.h" |
| 19 #include "components/signin/core/common/signin_pref_names.h" | 20 #include "components/signin/core/common/signin_pref_names.h" |
| 20 #include "components/signin/core/common/signin_switches.h" | 21 #include "components/signin/core/common/signin_switches.h" |
| 21 #include "content/public/browser/notification_details.h" | 22 #include "content/public/browser/notification_details.h" |
| 22 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
| 23 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
| 24 #include "content/public/common/child_process_host.h" | 25 #include "content/public/common/child_process_host.h" |
| 25 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 26 | 27 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 if (signin_scoped_device_id.empty()) { | 154 if (signin_scoped_device_id.empty()) { |
| 154 // If device_id doesn't exist then generate new and save in prefs. | 155 // If device_id doesn't exist then generate new and save in prefs. |
| 155 signin_scoped_device_id = base::GenerateGUID(); | 156 signin_scoped_device_id = base::GenerateGUID(); |
| 156 DCHECK(!signin_scoped_device_id.empty()); | 157 DCHECK(!signin_scoped_device_id.empty()); |
| 157 GetPrefs()->SetString(prefs::kGoogleServicesSigninScopedDeviceId, | 158 GetPrefs()->SetString(prefs::kGoogleServicesSigninScopedDeviceId, |
| 158 signin_scoped_device_id); | 159 signin_scoped_device_id); |
| 159 } | 160 } |
| 160 return signin_scoped_device_id; | 161 return signin_scoped_device_id; |
| 161 } | 162 } |
| 162 | 163 |
| 163 void ChromeSigninClient::ClearSigninScopedDeviceId() { | 164 void ChromeSigninClient::ClearSigninClientPrefs() { |
| 164 GetPrefs()->ClearPref(prefs::kGoogleServicesSigninScopedDeviceId); | 165 GetPrefs()->ClearPref(prefs::kGoogleServicesSigninScopedDeviceId); |
| 166 GetPrefs()->ClearPref(prefs::kProfileHostedDomain); |
| 165 } | 167 } |
| 166 | 168 |
| 167 net::URLRequestContextGetter* ChromeSigninClient::GetURLRequestContext() { | 169 net::URLRequestContextGetter* ChromeSigninClient::GetURLRequestContext() { |
| 168 return profile_->GetRequestContext(); | 170 return profile_->GetRequestContext(); |
| 169 } | 171 } |
| 170 | 172 |
| 171 bool ChromeSigninClient::ShouldMergeSigninCredentialsIntoCookieJar() { | 173 bool ChromeSigninClient::ShouldMergeSigninCredentialsIntoCookieJar() { |
| 172 // If inline sign in is enabled, but account consistency is not, the user's | 174 // If inline sign in is enabled, but account consistency is not, the user's |
| 173 // credentials should be merge into the cookie jar. | 175 // credentials should be merge into the cookie jar. |
| 174 return !switches::IsEnableWebBasedSignin() && | 176 return !switches::IsEnableWebBasedSignin() && |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (!callbacks_.empty()) | 246 if (!callbacks_.empty()) |
| 245 return; | 247 return; |
| 246 // Note that it's allowed to call this method multiple times without an | 248 // Note that it's allowed to call this method multiple times without an |
| 247 // intervening call to |RegisterForCookieChangedNotification()|. | 249 // intervening call to |RegisterForCookieChangedNotification()|. |
| 248 content::Source<Profile> source(profile_); | 250 content::Source<Profile> source(profile_); |
| 249 if (!registrar_.IsRegistered( | 251 if (!registrar_.IsRegistered( |
| 250 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) | 252 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) |
| 251 return; | 253 return; |
| 252 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); | 254 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); |
| 253 } | 255 } |
| OLD | NEW |