Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: chrome/browser/signin/fake_signin_manager.cc

Issue 14630003: signin: move SigninManagerBase::Signout to SigninManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apocalypse Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/chrome_signin_manager_delegate.h" 10 #include "chrome/browser/signin/chrome_signin_manager_delegate.h"
11 #include "chrome/browser/signin/signin_global_error.h" 11 #include "chrome/browser/signin/signin_global_error.h"
12 #include "chrome/browser/ui/global_error/global_error_service.h" 12 #include "chrome/browser/ui/global_error/global_error_service.h"
13 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 13 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
14 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.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(Profile* profile) { 18 FakeSigninManagerBase::FakeSigninManagerBase() {
19 profile_ = profile;
20 signin_global_error_.reset(new SigninGlobalError(this, profile));
21 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(
22 signin_global_error_.get());
23 signin_allowed_.Init(prefs::kSigninAllowed, profile_->GetPrefs(),
24 base::Bind(&SigninManagerBase::OnSigninAllowedPrefChanged,
25 base::Unretained(this)));
26 } 19 }
27 20
28 FakeSigninManagerBase::~FakeSigninManagerBase() { 21 FakeSigninManagerBase::~FakeSigninManagerBase() {
29 if (signin_global_error_.get()) {
30 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError(
31 signin_global_error_.get());
32 signin_global_error_.reset();
33 }
34 } 22 }
35 23
36 void FakeSigninManagerBase::SignOut() { 24 void FakeSigninManagerBase::InitTokenService() {
37 authenticated_username_.clear();
38 content::NotificationService::current()->Notify(
39 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT,
40 content::Source<Profile>(profile_),
41 content::NotificationService::NoDetails());
42 } 25 }
43 26
44 // static 27 // static
45 ProfileKeyedService* FakeSigninManagerBase::Build( 28 ProfileKeyedService* FakeSigninManagerBase::Build(
46 content::BrowserContext* profile) { 29 content::BrowserContext* profile) {
47 return new FakeSigninManagerBase(static_cast<Profile*>(profile)); 30 return new FakeSigninManagerBase();
48 } 31 }
49 32
50 #if !defined (OS_CHROMEOS) 33 #if !defined (OS_CHROMEOS)
51 34
52 FakeSigninManager::FakeSigninManager(Profile* profile) 35 FakeSigninManager::FakeSigninManager(Profile* profile)
53 : SigninManager(scoped_ptr<SigninManagerDelegate>( 36 : SigninManager(scoped_ptr<SigninManagerDelegate>(
54 new ChromeSigninManagerDelegate(profile))) { 37 new ChromeSigninManagerDelegate(profile))) {
55 Initialize(profile);
56 } 38 }
57 39
58 FakeSigninManager::~FakeSigninManager() { 40 FakeSigninManager::~FakeSigninManager() {
59 } 41 }
60 42
61 void FakeSigninManager::InitTokenService() { 43 void FakeSigninManager::InitTokenService() {
62 } 44 }
63 45
64 void FakeSigninManager::StartSignIn(const std::string& username, 46 void FakeSigninManager::StartSignIn(const std::string& username,
65 const std::string& password, 47 const std::string& password,
(...skipping 28 matching lines...) Expand all
94 content::NotificationService::NoDetails()); 76 content::NotificationService::NoDetails());
95 } 77 }
96 78
97 // static 79 // static
98 ProfileKeyedService* FakeSigninManager::Build( 80 ProfileKeyedService* FakeSigninManager::Build(
99 content::BrowserContext* profile) { 81 content::BrowserContext* profile) {
100 return new FakeSigninManager(static_cast<Profile*>(profile)); 82 return new FakeSigninManager(static_cast<Profile*>(profile));
101 } 83 }
102 84
103 #endif // !defined (OS_CHROMEOS) 85 #endif // !defined (OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/signin/fake_signin_manager.h ('k') | chrome/browser/signin/signin_global_error_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698