OLD | NEW |
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/signin_manager_factory.h" | 5 #include "chrome/browser/signin/signin_manager_factory.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/signin/account_fetcher_service_factory.h" | 10 #include "chrome/browser/signin/account_fetcher_service_factory.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void SigninManagerFactory::AddObserver(Observer* observer) { | 93 void SigninManagerFactory::AddObserver(Observer* observer) { |
94 observer_list_.AddObserver(observer); | 94 observer_list_.AddObserver(observer); |
95 } | 95 } |
96 | 96 |
97 void SigninManagerFactory::RemoveObserver(Observer* observer) { | 97 void SigninManagerFactory::RemoveObserver(Observer* observer) { |
98 observer_list_.RemoveObserver(observer); | 98 observer_list_.RemoveObserver(observer); |
99 } | 99 } |
100 | 100 |
101 void SigninManagerFactory::NotifyObserversOfSigninManagerCreationForTesting( | 101 void SigninManagerFactory::NotifyObserversOfSigninManagerCreationForTesting( |
102 SigninManagerBase* manager) { | 102 SigninManagerBase* manager) { |
103 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerCreated(manager)); | 103 for (Observer& observer : observer_list_) |
| 104 observer.SigninManagerCreated(manager); |
104 } | 105 } |
105 | 106 |
106 KeyedService* SigninManagerFactory::BuildServiceInstanceFor( | 107 KeyedService* SigninManagerFactory::BuildServiceInstanceFor( |
107 content::BrowserContext* context) const { | 108 content::BrowserContext* context) const { |
108 SigninManagerBase* service = NULL; | 109 SigninManagerBase* service = NULL; |
109 Profile* profile = static_cast<Profile*>(context); | 110 Profile* profile = static_cast<Profile*>(context); |
110 SigninClient* client = | 111 SigninClient* client = |
111 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile); | 112 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile); |
112 #if defined(OS_CHROMEOS) | 113 #if defined(OS_CHROMEOS) |
113 service = new SigninManagerBase( | 114 service = new SigninManagerBase( |
114 client, | 115 client, |
115 AccountTrackerServiceFactory::GetForProfile(profile)); | 116 AccountTrackerServiceFactory::GetForProfile(profile)); |
116 #else | 117 #else |
117 service = new SigninManager( | 118 service = new SigninManager( |
118 client, | 119 client, |
119 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 120 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
120 AccountTrackerServiceFactory::GetForProfile(profile), | 121 AccountTrackerServiceFactory::GetForProfile(profile), |
121 GaiaCookieManagerServiceFactory::GetForProfile(profile)); | 122 GaiaCookieManagerServiceFactory::GetForProfile(profile)); |
122 AccountFetcherServiceFactory::GetForProfile(profile); | 123 AccountFetcherServiceFactory::GetForProfile(profile); |
123 #endif | 124 #endif |
124 service->Initialize(g_browser_process->local_state()); | 125 service->Initialize(g_browser_process->local_state()); |
125 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerCreated(service)); | 126 for (Observer& observer : observer_list_) |
| 127 observer.SigninManagerCreated(service); |
126 return service; | 128 return service; |
127 } | 129 } |
128 | 130 |
129 void SigninManagerFactory::BrowserContextShutdown( | 131 void SigninManagerFactory::BrowserContextShutdown( |
130 content::BrowserContext* context) { | 132 content::BrowserContext* context) { |
131 SigninManagerBase* manager = static_cast<SigninManagerBase*>( | 133 SigninManagerBase* manager = static_cast<SigninManagerBase*>( |
132 GetServiceForBrowserContext(context, false)); | 134 GetServiceForBrowserContext(context, false)); |
133 if (manager) | 135 if (manager) { |
134 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerShutdown(manager)); | 136 for (Observer& observer : observer_list_) |
| 137 observer.SigninManagerShutdown(manager); |
| 138 } |
135 BrowserContextKeyedServiceFactory::BrowserContextShutdown(context); | 139 BrowserContextKeyedServiceFactory::BrowserContextShutdown(context); |
136 } | 140 } |
OLD | NEW |