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

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

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/fake_signin_manager.h" 5 #include "chrome/browser/signin/fake_signin_manager.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/account_tracker_service_factory.h" 10 #include "chrome/browser/signin/account_tracker_service_factory.h"
11 #include "chrome/browser/signin/chrome_signin_client_factory.h" 11 #include "chrome/browser/signin/chrome_signin_client_factory.h"
12 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" 12 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
14 #include "chrome/browser/signin/signin_manager_factory.h" 14 #include "chrome/browser/signin/signin_manager_factory.h"
15 #include "chrome/browser/ui/global_error/global_error_service.h" 15 #include "chrome/browser/ui/global_error/global_error_service.h"
16 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 16 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "components/signin/core/browser/account_tracker_service.h" 18 #include "components/signin/core/browser/account_tracker_service.h"
19 19
20 FakeSigninManagerBase::FakeSigninManagerBase(Profile* profile) 20 FakeSigninManagerBase::FakeSigninManagerBase(Profile* profile)
21 : SigninManagerBase( 21 : SigninManagerBase(
22 ChromeSigninClientFactory::GetForProfile(profile), 22 ChromeSigninClientFactory::GetForProfile(profile),
23 AccountTrackerServiceFactory::GetForProfile(profile)) {} 23 AccountTrackerServiceFactory::GetForProfile(profile)) {}
24 24
25 FakeSigninManagerBase::~FakeSigninManagerBase() { 25 FakeSigninManagerBase::~FakeSigninManagerBase() {
26 } 26 }
27 27
28 // static 28 // static
29 KeyedService* FakeSigninManagerBase::Build(content::BrowserContext* context) { 29 scoped_ptr<KeyedService> FakeSigninManagerBase::Build(
30 SigninManagerBase* manager; 30 content::BrowserContext* context) {
31 scoped_ptr<SigninManagerBase> manager;
31 Profile* profile = static_cast<Profile*>(context); 32 Profile* profile = static_cast<Profile*>(context);
32 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
33 manager = new FakeSigninManagerBase(profile); 34 manager.reset(new FakeSigninManagerBase(profile));
34 #else 35 #else
35 manager = new FakeSigninManager(profile); 36 manager.reset(new FakeSigninManager(profile));
36 #endif 37 #endif
37 manager->Initialize(NULL); 38 manager->Initialize(NULL);
38 SigninManagerFactory::GetInstance() 39 SigninManagerFactory::GetInstance()
39 ->NotifyObserversOfSigninManagerCreationForTesting(manager); 40 ->NotifyObserversOfSigninManagerCreationForTesting(manager.get());
40 return manager; 41 return manager.Pass();
41 } 42 }
42 43
43 #if !defined (OS_CHROMEOS) 44 #if !defined (OS_CHROMEOS)
44 45
45 FakeSigninManager::FakeSigninManager(Profile* profile) 46 FakeSigninManager::FakeSigninManager(Profile* profile)
46 : SigninManager( 47 : SigninManager(
47 ChromeSigninClientFactory::GetForProfile(profile), 48 ChromeSigninClientFactory::GetForProfile(profile),
48 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 49 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
49 AccountTrackerServiceFactory::GetForProfile(profile), 50 AccountTrackerServiceFactory::GetForProfile(profile),
50 GaiaCookieManagerServiceFactory::GetForProfile(profile)) {} 51 GaiaCookieManagerServiceFactory::GetForProfile(profile)) {}
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 set_password(std::string()); 102 set_password(std::string());
102 const std::string account_id = GetAuthenticatedAccountId(); 103 const std::string account_id = GetAuthenticatedAccountId();
103 const std::string username = GetAuthenticatedUsername(); 104 const std::string username = GetAuthenticatedUsername();
104 authenticated_account_id_.clear(); 105 authenticated_account_id_.clear();
105 106
106 FOR_EACH_OBSERVER(SigninManagerBase::Observer, observer_list_, 107 FOR_EACH_OBSERVER(SigninManagerBase::Observer, observer_list_,
107 GoogleSignedOut(account_id, username)); 108 GoogleSignedOut(account_id, username));
108 } 109 }
109 110
110 #endif // !defined (OS_CHROMEOS) 111 #endif // !defined (OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698