| 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/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/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.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/profile_oauth2_token_service_factory.h" |
| 12 #include "chrome/browser/signin/signin_global_error.h" | 13 #include "chrome/browser/signin/signin_global_error.h" |
| 13 #include "chrome/browser/signin/signin_manager_factory.h" | 14 #include "chrome/browser/signin/signin_manager_factory.h" |
| 14 #include "chrome/browser/ui/global_error/global_error_service.h" | 15 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 15 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 16 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 18 | 19 |
| 19 FakeSigninManagerBase::FakeSigninManagerBase(Profile* profile) | 20 FakeSigninManagerBase::FakeSigninManagerBase(Profile* profile) |
| 20 : SigninManagerBase( | 21 : SigninManagerBase( |
| 21 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile)) {} | 22 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile)) {} |
| (...skipping 13 matching lines...) Expand all Loading... |
| 35 manager->Initialize(profile, NULL); | 36 manager->Initialize(profile, NULL); |
| 36 SigninManagerFactory::GetInstance() | 37 SigninManagerFactory::GetInstance() |
| 37 ->NotifyObserversOfSigninManagerCreationForTesting(manager); | 38 ->NotifyObserversOfSigninManagerCreationForTesting(manager); |
| 38 return manager; | 39 return manager; |
| 39 } | 40 } |
| 40 | 41 |
| 41 #if !defined (OS_CHROMEOS) | 42 #if !defined (OS_CHROMEOS) |
| 42 | 43 |
| 43 FakeSigninManager::FakeSigninManager(Profile* profile) | 44 FakeSigninManager::FakeSigninManager(Profile* profile) |
| 44 : SigninManager( | 45 : SigninManager( |
| 45 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile)) {} | 46 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile), |
| 47 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)) {} |
| 46 | 48 |
| 47 FakeSigninManager::~FakeSigninManager() { | 49 FakeSigninManager::~FakeSigninManager() { |
| 48 } | 50 } |
| 49 | 51 |
| 50 void FakeSigninManager::StartSignInWithRefreshToken( | 52 void FakeSigninManager::StartSignInWithRefreshToken( |
| 51 const std::string& refresh_token, | 53 const std::string& refresh_token, |
| 52 const std::string& username, | 54 const std::string& username, |
| 53 const std::string& password, | 55 const std::string& password, |
| 54 const OAuthTokenFetchedCallback& oauth_fetched_callback) { | 56 const OAuthTokenFetchedCallback& oauth_fetched_callback) { |
| 55 set_auth_in_progress(username); | 57 set_auth_in_progress(username); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 content::NotificationService::current()->Notify( | 94 content::NotificationService::current()->Notify( |
| 93 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | 95 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, |
| 94 content::Source<Profile>(profile_), | 96 content::Source<Profile>(profile_), |
| 95 content::Details<const GoogleServiceSignoutDetails>(&details)); | 97 content::Details<const GoogleServiceSignoutDetails>(&details)); |
| 96 | 98 |
| 97 FOR_EACH_OBSERVER(SigninManagerBase::Observer, observer_list_, | 99 FOR_EACH_OBSERVER(SigninManagerBase::Observer, observer_list_, |
| 98 GoogleSignedOut(username)); | 100 GoogleSignedOut(username)); |
| 99 } | 101 } |
| 100 | 102 |
| 101 #endif // !defined (OS_CHROMEOS) | 103 #endif // !defined (OS_CHROMEOS) |
| OLD | NEW |