| 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/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (profile_->IsSupervised()) { | 126 if (profile_->IsSupervised()) { |
| 127 LOG(ERROR) << "Attempt to revoke supervised user refresh " | 127 LOG(ERROR) << "Attempt to revoke supervised user refresh " |
| 128 << "token detected, ignoring."; | 128 << "token detected, ignoring."; |
| 129 return false; | 129 return false; |
| 130 } | 130 } |
| 131 #endif | 131 #endif |
| 132 return true; | 132 return true; |
| 133 } | 133 } |
| 134 | 134 |
| 135 std::string ChromeSigninClient::GetSigninScopedDeviceId() { | 135 std::string ChromeSigninClient::GetSigninScopedDeviceId() { |
| 136 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 137 switches::kDisableSigninScopedDeviceId)) { |
| 138 return std::string(); |
| 139 } |
| 140 |
| 136 std::string signin_scoped_device_id = | 141 std::string signin_scoped_device_id = |
| 137 GetPrefs()->GetString(prefs::kGoogleServicesSigninScopedDeviceId); | 142 GetPrefs()->GetString(prefs::kGoogleServicesSigninScopedDeviceId); |
| 138 if (CommandLine::ForCurrentProcess()->HasSwitch( | 143 if (signin_scoped_device_id.empty()) { |
| 139 switches::kEnableSigninScopedDeviceId) && | |
| 140 signin_scoped_device_id.empty()) { | |
| 141 // If device_id doesn't exist then generate new and save in prefs. | 144 // If device_id doesn't exist then generate new and save in prefs. |
| 142 signin_scoped_device_id = base::GenerateGUID(); | 145 signin_scoped_device_id = base::GenerateGUID(); |
| 143 DCHECK(!signin_scoped_device_id.empty()); | 146 DCHECK(!signin_scoped_device_id.empty()); |
| 144 GetPrefs()->SetString(prefs::kGoogleServicesSigninScopedDeviceId, | 147 GetPrefs()->SetString(prefs::kGoogleServicesSigninScopedDeviceId, |
| 145 signin_scoped_device_id); | 148 signin_scoped_device_id); |
| 146 } | 149 } |
| 147 return signin_scoped_device_id; | 150 return signin_scoped_device_id; |
| 148 } | 151 } |
| 149 | 152 |
| 150 void ChromeSigninClient::ClearSigninScopedDeviceId() { | 153 void ChromeSigninClient::ClearSigninScopedDeviceId() { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 221 |
| 219 void ChromeSigninClient::UnregisterForCookieChangedNotification() { | 222 void ChromeSigninClient::UnregisterForCookieChangedNotification() { |
| 220 // Note that it's allowed to call this method multiple times without an | 223 // Note that it's allowed to call this method multiple times without an |
| 221 // intervening call to |RegisterForCookieChangedNotification()|. | 224 // intervening call to |RegisterForCookieChangedNotification()|. |
| 222 content::Source<Profile> source(profile_); | 225 content::Source<Profile> source(profile_); |
| 223 if (!registrar_.IsRegistered( | 226 if (!registrar_.IsRegistered( |
| 224 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) | 227 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) |
| 225 return; | 228 return; |
| 226 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); | 229 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); |
| 227 } | 230 } |
| OLD | NEW |