| 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" |
| 8 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 9 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 7 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| 8 #include "content/public/browser/notification_service.h" | 11 #include "content/public/browser/notification_service.h" |
| 9 | 12 |
| 10 FakeSigninManager::FakeSigninManager(Profile* profile) { | 13 FakeSigninManager::FakeSigninManager(Profile* profile) { |
| 11 profile_ = profile; | 14 profile_ = profile; |
| 15 signin_global_error_.reset(new SigninGlobalError(profile)); |
| 16 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError( |
| 17 signin_global_error_.get()); |
| 12 } | 18 } |
| 13 | 19 |
| 14 FakeSigninManager::~FakeSigninManager() {} | 20 FakeSigninManager::~FakeSigninManager() { |
| 21 if (signin_global_error_.get()) { |
| 22 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError( |
| 23 signin_global_error_.get()); |
| 24 signin_global_error_.reset(); |
| 25 } |
| 26 } |
| 15 | 27 |
| 16 void FakeSigninManager::StartSignIn(const std::string& username, | 28 void FakeSigninManager::StartSignIn(const std::string& username, |
| 17 const std::string& password, | 29 const std::string& password, |
| 18 const std::string& login_token, | 30 const std::string& login_token, |
| 19 const std::string& login_captcha) { | 31 const std::string& login_captcha) { |
| 20 SetAuthenticatedUsername(username); | 32 SetAuthenticatedUsername(username); |
| 21 } | 33 } |
| 22 | 34 |
| 23 void FakeSigninManager::StartSignInWithCredentials( | 35 void FakeSigninManager::StartSignInWithCredentials( |
| 24 const std::string& session_index, | 36 const std::string& session_index, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 37 content::NotificationService::current()->Notify( | 49 content::NotificationService::current()->Notify( |
| 38 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | 50 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, |
| 39 content::Source<Profile>(profile_), | 51 content::Source<Profile>(profile_), |
| 40 content::NotificationService::NoDetails()); | 52 content::NotificationService::NoDetails()); |
| 41 } | 53 } |
| 42 | 54 |
| 43 // static | 55 // static |
| 44 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { | 56 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { |
| 45 return new FakeSigninManager(profile); | 57 return new FakeSigninManager(profile); |
| 46 } | 58 } |
| OLD | NEW |