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

Side by Side Diff: chrome/browser/signin/chrome_signin_client.cc

Issue 395013002: Pass signin_scoped_device_id to DeviceInfoSpecifics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 "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
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 std::string signin_scoped_device_id = 136 std::string signin_scoped_device_id;
pavely 2014/07/16 00:24:45 I made a mistake in my previous change. If command
137
138 if (!CommandLine::ForCurrentProcess()->HasSwitch(
139 switches::kEnableSigninScopedDeviceId)) {
140 return signin_scoped_device_id;
141 }
142 signin_scoped_device_id =
137 GetPrefs()->GetString(prefs::kGoogleServicesSigninScopedDeviceId); 143 GetPrefs()->GetString(prefs::kGoogleServicesSigninScopedDeviceId);
138 if (CommandLine::ForCurrentProcess()->HasSwitch( 144 if (!signin_scoped_device_id.empty()) {
139 switches::kEnableSigninScopedDeviceId) && 145 return signin_scoped_device_id;
140 signin_scoped_device_id.empty()) {
141 // If device_id doesn't exist then generate new and save in prefs.
142 signin_scoped_device_id = base::GenerateGUID();
143 DCHECK(!signin_scoped_device_id.empty());
144 GetPrefs()->SetString(prefs::kGoogleServicesSigninScopedDeviceId,
145 signin_scoped_device_id);
146 } 146 }
147 // If device_id doesn't exist then generate new and save in prefs.
148 signin_scoped_device_id = base::GenerateGUID();
149 DCHECK(!signin_scoped_device_id.empty());
150 GetPrefs()->SetString(prefs::kGoogleServicesSigninScopedDeviceId,
151 signin_scoped_device_id);
147 return signin_scoped_device_id; 152 return signin_scoped_device_id;
148 } 153 }
149 154
150 void ChromeSigninClient::ClearSigninScopedDeviceId() { 155 void ChromeSigninClient::ClearSigninScopedDeviceId() {
151 GetPrefs()->ClearPref(prefs::kGoogleServicesSigninScopedDeviceId); 156 GetPrefs()->ClearPref(prefs::kGoogleServicesSigninScopedDeviceId);
152 } 157 }
153 158
154 net::URLRequestContextGetter* ChromeSigninClient::GetURLRequestContext() { 159 net::URLRequestContextGetter* ChromeSigninClient::GetURLRequestContext() {
155 return profile_->GetRequestContext(); 160 return profile_->GetRequestContext();
156 } 161 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 223
219 void ChromeSigninClient::UnregisterForCookieChangedNotification() { 224 void ChromeSigninClient::UnregisterForCookieChangedNotification() {
220 // Note that it's allowed to call this method multiple times without an 225 // Note that it's allowed to call this method multiple times without an
221 // intervening call to |RegisterForCookieChangedNotification()|. 226 // intervening call to |RegisterForCookieChangedNotification()|.
222 content::Source<Profile> source(profile_); 227 content::Source<Profile> source(profile_);
223 if (!registrar_.IsRegistered( 228 if (!registrar_.IsRegistered(
224 this, chrome::NOTIFICATION_COOKIE_CHANGED, source)) 229 this, chrome::NOTIFICATION_COOKIE_CHANGED, source))
225 return; 230 return;
226 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source); 231 registrar_.Remove(this, chrome::NOTIFICATION_COOKIE_CHANGED, source);
227 } 232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698