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/about_signin_internals.h" | 5 #include "chrome/browser/signin/about_signin_internals.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/hash.h" | 8 #include "base/hash.h" |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 RefreshSigninPrefs(); | 198 RefreshSigninPrefs(); |
199 | 199 |
200 SigninManagerFactory::GetForProfile(profile)-> | 200 SigninManagerFactory::GetForProfile(profile)-> |
201 AddSigninDiagnosticsObserver(this); | 201 AddSigninDiagnosticsObserver(this); |
202 TokenServiceFactory::GetForProfile(profile)-> | 202 TokenServiceFactory::GetForProfile(profile)-> |
203 AddSigninDiagnosticsObserver(this); | 203 AddSigninDiagnosticsObserver(this); |
204 } | 204 } |
205 | 205 |
206 void AboutSigninInternals::Shutdown() { | 206 void AboutSigninInternals::Shutdown() { |
207 SigninManagerFactory::GetForProfile(profile_)-> | 207 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); |
208 RemoveSigninDiagnosticsObserver(this); | 208 // Some unit tests do stuff like switching profiles to incognito in mid-test, |
209 TokenServiceFactory::GetForProfile(profile_)-> | 209 // so there may not always be |
210 RemoveSigninDiagnosticsObserver(this); | 210 if (signin) |
| 211 signin->RemoveSigninDiagnosticsObserver(this); |
| 212 |
| 213 TokenService* token = TokenServiceFactory::GetForProfile(profile_); |
| 214 if (token) |
| 215 token->RemoveSigninDiagnosticsObserver(this); |
211 } | 216 } |
212 | 217 |
213 void AboutSigninInternals::NotifyObservers() { | 218 void AboutSigninInternals::NotifyObservers() { |
214 FOR_EACH_OBSERVER(AboutSigninInternals::Observer, | 219 FOR_EACH_OBSERVER(AboutSigninInternals::Observer, |
215 signin_observers_, | 220 signin_observers_, |
216 OnSigninStateChanged(signin_status_.ToValue())); | 221 OnSigninStateChanged(signin_status_.ToValue())); |
217 } | 222 } |
218 | 223 |
219 scoped_ptr<DictionaryValue> AboutSigninInternals::GetSigninStatus() { | 224 scoped_ptr<DictionaryValue> AboutSigninInternals::GetSigninStatus() { |
220 return signin_status_.ToValue().Pass(); | 225 return signin_status_.ToValue().Pass(); |
221 } | 226 } |
OLD | NEW |