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_fake.h" | 5 #include "chrome/browser/signin/signin_manager_fake.h" |
6 | 6 |
7 #include "chrome/browser/signin/signin_global_error.h" | 7 #include "chrome/browser/signin/signin_global_error.h" |
8 #include "chrome/browser/ui/global_error/global_error_service.h" | 8 #include "chrome/browser/ui/global_error/global_error_service.h" |
9 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 9 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
11 #include "content/public/browser/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
12 | 12 |
13 FakeSigninManager::FakeSigninManager(Profile* profile) { | 13 FakeSigninManager::FakeSigninManager(Profile* profile) |
| 14 : auth_in_progress_(false) { |
14 profile_ = profile; | 15 profile_ = profile; |
15 signin_global_error_.reset(new SigninGlobalError(profile)); | 16 signin_global_error_.reset(new SigninGlobalError(this, profile)); |
16 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError( | 17 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError( |
17 signin_global_error_.get()); | 18 signin_global_error_.get()); |
18 } | 19 } |
19 | 20 |
20 FakeSigninManager::~FakeSigninManager() { | 21 FakeSigninManager::~FakeSigninManager() { |
21 if (signin_global_error_.get()) { | 22 if (signin_global_error_.get()) { |
22 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError( | 23 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError( |
23 signin_global_error_.get()); | 24 signin_global_error_.get()); |
24 signin_global_error_.reset(); | 25 signin_global_error_.reset(); |
25 } | 26 } |
(...skipping 19 matching lines...) Expand all Loading... |
45 } | 46 } |
46 | 47 |
47 void FakeSigninManager::SignOut() { | 48 void FakeSigninManager::SignOut() { |
48 authenticated_username_.clear(); | 49 authenticated_username_.clear(); |
49 content::NotificationService::current()->Notify( | 50 content::NotificationService::current()->Notify( |
50 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | 51 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, |
51 content::Source<Profile>(profile_), | 52 content::Source<Profile>(profile_), |
52 content::NotificationService::NoDetails()); | 53 content::NotificationService::NoDetails()); |
53 } | 54 } |
54 | 55 |
| 56 bool FakeSigninManager::AuthInProgress() const { |
| 57 return auth_in_progress_; |
| 58 } |
| 59 |
55 // static | 60 // static |
56 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { | 61 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { |
57 return new FakeSigninManager(profile); | 62 return new FakeSigninManager(profile); |
58 } | 63 } |
OLD | NEW |