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

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: Changes after feedback from Roger. 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
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.h ('k') | chrome/browser/signin/signin_manager_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..02f674e15a55701f2b09e0da4bead91b965a29bd 100644
--- a/chrome/browser/signin/chrome_signin_client.cc
+++ b/chrome/browser/signin/chrome_signin_client.cc
@@ -4,6 +4,9 @@
#include "chrome/browser/signin/chrome_signin_client.h"
+#include "base/command_line.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 +14,8 @@
#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 "components/signin/core/common/signin_switches.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 +132,22 @@ 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 (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableSigninScopedDeviceId) &&
+ 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() {
« no previous file with comments | « chrome/browser/signin/chrome_signin_client.h ('k') | chrome/browser/signin/signin_manager_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698