| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 const std::string& password) { | 39 const std::string& password) { |
| 40 SetAuthenticatedUsername(username); | 40 SetAuthenticatedUsername(username); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void FakeSigninManager::StartSignInWithOAuth(const std::string& username, | 43 void FakeSigninManager::StartSignInWithOAuth(const std::string& username, |
| 44 const std::string& password) { | 44 const std::string& password) { |
| 45 SetAuthenticatedUsername(username); | 45 SetAuthenticatedUsername(username); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void FakeSigninManager::SignOut() { | 48 void FakeSigninManager::SignOut() { |
| 49 if (IsSignoutProhibited()) |
| 50 return; |
| 49 authenticated_username_.clear(); | 51 authenticated_username_.clear(); |
| 50 content::NotificationService::current()->Notify( | 52 content::NotificationService::current()->Notify( |
| 51 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | 53 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, |
| 52 content::Source<Profile>(profile_), | 54 content::Source<Profile>(profile_), |
| 53 content::NotificationService::NoDetails()); | 55 content::NotificationService::NoDetails()); |
| 54 } | 56 } |
| 55 | 57 |
| 58 void FakeSigninManager::ForceSignOut() { |
| 59 // Allow signing out now. |
| 60 prohibit_signout_ = false; |
| 61 SignOut(); |
| 62 } |
| 63 |
| 56 bool FakeSigninManager::AuthInProgress() const { | 64 bool FakeSigninManager::AuthInProgress() const { |
| 57 return auth_in_progress_; | 65 return auth_in_progress_; |
| 58 } | 66 } |
| 59 | 67 |
| 60 // static | 68 // static |
| 61 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { | 69 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { |
| 62 return new FakeSigninManager(profile); | 70 return new FakeSigninManager(profile); |
| 63 } | 71 } |
| OLD | NEW |