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

Side by Side Diff: chrome/browser/managed_mode/managed_user_registration_utility.cc

Issue 150003004: Replace PO2TS::GetPrimaryAccountId() with SMB::GetAuthenticatedAccountId. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/managed_mode/managed_user_registration_utility.h" 5 #include "chrome/browser/managed_mode/managed_user_registration_utility.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/managed_mode/managed_user_refresh_token_fetcher.h" 14 #include "chrome/browser/managed_mode/managed_user_refresh_token_fetcher.h"
15 #include "chrome/browser/managed_mode/managed_user_sync_service.h" 15 #include "chrome/browser/managed_mode/managed_user_sync_service.h"
16 #include "chrome/browser/managed_mode/managed_user_sync_service_factory.h" 16 #include "chrome/browser/managed_mode/managed_user_sync_service_factory.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/signin/profile_oauth2_token_service.h" 18 #include "chrome/browser/signin/profile_oauth2_token_service.h"
19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
20 #include "chrome/browser/signin/signin_manager.h"
21 #include "chrome/browser/signin/signin_manager_factory.h"
20 #include "chrome/browser/sync/glue/device_info.h" 22 #include "chrome/browser/sync/glue/device_info.h"
21 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
23 #include "google_apis/gaia/gaia_urls.h" 25 #include "google_apis/gaia/gaia_urls.h"
24 #include "google_apis/gaia/google_service_auth_error.h" 26 #include "google_apis/gaia/google_service_auth_error.h"
25 27
26 using base::DictionaryValue; 28 using base::DictionaryValue;
27 29
28 namespace { 30 namespace {
29 31
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 scoped_ptr<ManagedUserRegistrationUtility> 129 scoped_ptr<ManagedUserRegistrationUtility>
128 ManagedUserRegistrationUtility::Create(Profile* profile) { 130 ManagedUserRegistrationUtility::Create(Profile* profile) {
129 if (g_instance_for_tests) { 131 if (g_instance_for_tests) {
130 ManagedUserRegistrationUtility* result = g_instance_for_tests; 132 ManagedUserRegistrationUtility* result = g_instance_for_tests;
131 g_instance_for_tests = NULL; 133 g_instance_for_tests = NULL;
132 return make_scoped_ptr(result); 134 return make_scoped_ptr(result);
133 } 135 }
134 136
135 ProfileOAuth2TokenService* token_service = 137 ProfileOAuth2TokenService* token_service =
136 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 138 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
139 SigninManagerBase* signin_manager =
140 SigninManagerFactory::GetForProfile(profile);
137 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher = 141 scoped_ptr<ManagedUserRefreshTokenFetcher> token_fetcher =
138 ManagedUserRefreshTokenFetcher::Create( 142 ManagedUserRefreshTokenFetcher::Create(
139 token_service, 143 token_service,
140 token_service->GetPrimaryAccountId(), 144 signin_manager->GetAuthenticatedAccountId(),
141 profile->GetRequestContext()); 145 profile->GetRequestContext());
142 ManagedUserSyncService* managed_user_sync_service = 146 ManagedUserSyncService* managed_user_sync_service =
143 ManagedUserSyncServiceFactory::GetForProfile(profile); 147 ManagedUserSyncServiceFactory::GetForProfile(profile);
144 return make_scoped_ptr(ManagedUserRegistrationUtility::CreateImpl( 148 return make_scoped_ptr(ManagedUserRegistrationUtility::CreateImpl(
145 profile->GetPrefs(), 149 profile->GetPrefs(),
146 token_fetcher.Pass(), 150 token_fetcher.Pass(),
147 managed_user_sync_service)); 151 managed_user_sync_service));
148 } 152 }
149 153
150 // static 154 // static
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 pending_managed_user_id_); 310 pending_managed_user_id_);
307 } 311 }
308 } 312 }
309 313
310 if (run_callback) 314 if (run_callback)
311 callback_.Run(error, pending_managed_user_token_); 315 callback_.Run(error, pending_managed_user_token_);
312 callback_.Reset(); 316 callback_.Reset();
313 } 317 }
314 318
315 } // namespace 319 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698