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

Unified Diff: chrome/browser/signin/chrome_signin_client.cc

Issue 362613002: Implementation of SigninClient::GetSigninScopedDeviceId (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/chrome_signin_client.cc
diff --git a/chrome/browser/signin/chrome_signin_client.cc b/chrome/browser/signin/chrome_signin_client.cc
index 223fb7a0a17c31cdeab19c02b0e1141ec72721fd..78b0b1357d10724ee0fc27347e63c82a6f3291c5 100644
--- a/chrome/browser/signin/chrome_signin_client.cc
+++ b/chrome/browser/signin/chrome_signin_client.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/signin/chrome_signin_client.h"
+#include "base/guid.h"
+#include "base/prefs/pref_service.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/content_settings/cookie_settings.h"
#include "chrome/browser/net/chrome_cookie_notification_details.h"
@@ -11,6 +13,7 @@
#include "chrome/browser/webdata/web_data_service_factory.h"
#include "chrome/common/chrome_version_info.h"
#include "components/signin/core/common/profile_management_switches.h"
+#include "components/signin/core/common/signin_pref_names.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/render_process_host.h"
@@ -127,10 +130,20 @@ bool ChromeSigninClient::CanRevokeCredentials() {
}
std::string ChromeSigninClient::GetSigninScopedDeviceId() {
- // TODO(pavely): crbug/382968. In the future this method will read
- // SigninScopedDeviceId from prefs, generating new one if it doesn't exist.
- // For now it returns empty string to maintain existing behavior.
- return std::string();
+ std::string signin_scoped_device_id =
+ GetPrefs()->GetString(prefs::kGoogleServicesSigninScopedDeviceId);
+ if (signin_scoped_device_id.empty()) {
+ // If device_id doesn't exist then generate new and save in prefs.
+ signin_scoped_device_id = base::GenerateGUID();
+ DCHECK(!signin_scoped_device_id.empty());
+ GetPrefs()->SetString(prefs::kGoogleServicesSigninScopedDeviceId,
+ signin_scoped_device_id);
+ }
+ return signin_scoped_device_id;
+}
+
+void ChromeSigninClient::ClearSigninScopedDeviceId() {
+ GetPrefs()->ClearPref(prefs::kGoogleServicesSigninScopedDeviceId);
}
net::URLRequestContextGetter* ChromeSigninClient::GetURLRequestContext() {

Powered by Google App Engine
This is Rietveld 408576698