| 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_manager_delegate.h" | 11 #include "chrome/browser/signin/chrome_signin_manager_delegate.h" |
| 12 #include "chrome/browser/signin/signin_global_error.h" | 12 #include "chrome/browser/signin/signin_global_error.h" |
| 13 #include "chrome/browser/ui/global_error/global_error_service.h" | 13 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 14 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 14 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 17 | 17 |
| 18 FakeSigninManagerBase::FakeSigninManagerBase() { | 18 FakeSigninManagerBase::FakeSigninManagerBase() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 FakeSigninManagerBase::~FakeSigninManagerBase() { | 21 FakeSigninManagerBase::~FakeSigninManagerBase() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 void FakeSigninManagerBase::InitTokenService() { | |
| 25 } | |
| 26 | |
| 27 // static | 24 // static |
| 28 BrowserContextKeyedService* FakeSigninManagerBase::Build( | 25 BrowserContextKeyedService* FakeSigninManagerBase::Build( |
| 29 content::BrowserContext* profile) { | 26 content::BrowserContext* profile) { |
| 30 return new FakeSigninManagerBase(); | 27 return new FakeSigninManagerBase(); |
| 31 } | 28 } |
| 32 | 29 |
| 33 #if !defined (OS_CHROMEOS) | 30 #if !defined (OS_CHROMEOS) |
| 34 | 31 |
| 35 FakeSigninManager::FakeSigninManager(Profile* profile) | 32 FakeSigninManager::FakeSigninManager(Profile* profile) |
| 36 : SigninManager(scoped_ptr<SigninManagerDelegate>( | 33 : SigninManager(scoped_ptr<SigninManagerDelegate>( |
| 37 new ChromeSigninManagerDelegate(profile))) { | 34 new ChromeSigninManagerDelegate(profile))) { |
| 38 } | 35 } |
| 39 | 36 |
| 40 FakeSigninManager::~FakeSigninManager() { | 37 FakeSigninManager::~FakeSigninManager() { |
| 41 } | 38 } |
| 42 | 39 |
| 43 void FakeSigninManager::InitTokenService() { | |
| 44 } | |
| 45 | |
| 46 void FakeSigninManager::StartSignInWithCredentials( | 40 void FakeSigninManager::StartSignInWithCredentials( |
| 47 const std::string& session_index, | 41 const std::string& session_index, |
| 48 const std::string& username, | 42 const std::string& username, |
| 49 const std::string& password, | 43 const std::string& password, |
| 50 const OAuthTokenFetchedCallback& oauth_fetched_callback) { | 44 const OAuthTokenFetchedCallback& oauth_fetched_callback) { |
| 51 set_auth_in_progress(username); | 45 set_auth_in_progress(username); |
| 52 if (!oauth_fetched_callback.is_null()) | 46 if (!oauth_fetched_callback.is_null()) |
| 53 oauth_fetched_callback.Run("fake_oauth_token"); | 47 oauth_fetched_callback.Run("fake_oauth_token"); |
| 54 } | 48 } |
| 55 | 49 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 69 content::NotificationService::NoDetails()); | 63 content::NotificationService::NoDetails()); |
| 70 } | 64 } |
| 71 | 65 |
| 72 // static | 66 // static |
| 73 BrowserContextKeyedService* FakeSigninManager::Build( | 67 BrowserContextKeyedService* FakeSigninManager::Build( |
| 74 content::BrowserContext* profile) { | 68 content::BrowserContext* profile) { |
| 75 return new FakeSigninManager(static_cast<Profile*>(profile)); | 69 return new FakeSigninManager(static_cast<Profile*>(profile)); |
| 76 } | 70 } |
| 77 | 71 |
| 78 #endif // !defined (OS_CHROMEOS) | 72 #endif // !defined (OS_CHROMEOS) |
| OLD | NEW |