| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/services/gcm/fake_signin_manager.h" | 5 #include "chrome/browser/services/gcm/fake_signin_manager.h" |
| 6 | 6 |
| 7 #include "base/observer_list.h" | 7 #include "base/observer_list.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 10 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 FakeSigninManager::~FakeSigninManager() { | 34 FakeSigninManager::~FakeSigninManager() { |
| 35 } | 35 } |
| 36 | 36 |
| 37 void FakeSigninManager::SignIn(const std::string& username) { | 37 void FakeSigninManager::SignIn(const std::string& username) { |
| 38 SetAuthenticatedUsername(username); | 38 SetAuthenticatedUsername(username); |
| 39 FOR_EACH_OBSERVER(Observer, | 39 FOR_EACH_OBSERVER(Observer, |
| 40 observer_list_, | 40 observer_list_, |
| 41 GoogleSigninSucceeded(username, std::string())); | 41 GoogleSigninSucceeded(username, std::string())); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void FakeSigninManager::SignOut() { | 44 void FakeSigninManager::SignOut( |
| 45 signin_metrics::ProfileSignout signout_source_metric) { |
| 45 const std::string username = GetAuthenticatedUsername(); | 46 const std::string username = GetAuthenticatedUsername(); |
| 46 clear_authenticated_username(); | 47 clear_authenticated_username(); |
| 47 profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); | 48 profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); |
| 48 FOR_EACH_OBSERVER(Observer, observer_list_, GoogleSignedOut(username)); | 49 FOR_EACH_OBSERVER(Observer, observer_list_, GoogleSignedOut(username)); |
| 49 } | 50 } |
| 50 | 51 |
| 51 // static | 52 // static |
| 52 KeyedService* FakeSigninManager::Build(content::BrowserContext* context) { | 53 KeyedService* FakeSigninManager::Build(content::BrowserContext* context) { |
| 53 return new FakeSigninManager(Profile::FromBrowserContext(context)); | 54 return new FakeSigninManager(Profile::FromBrowserContext(context)); |
| 54 } | 55 } |
| 55 | 56 |
| 56 } // namespace gcm | 57 } // namespace gcm |
| OLD | NEW |