| 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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/signin_global_error.h" | 10 #include "chrome/browser/signin/signin_global_error.h" |
| 11 #include "chrome/browser/ui/global_error/global_error_service.h" | 11 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 12 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 12 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 16 | 16 |
| 17 FakeSigninManagerBase::FakeSigninManagerBase(Profile* profile) { | 17 FakeSigninManagerBase::FakeSigninManagerBase(Profile* profile) { |
| 18 profile_ = profile; | 18 profile_ = profile; |
| 19 signin_global_error_.reset(new SigninGlobalError(this, profile)); | 19 signin_global_error_.reset(new SigninGlobalError(this, profile)); |
| 20 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError( | 20 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError( |
| 21 signin_global_error_.get()); | 21 signin_global_error_.get()); |
| 22 signin_allowed_.Init(prefs::kSigninAllowed, profile_->GetPrefs(), | |
| 23 base::Bind(&SigninManagerBase::OnSigninAllowedPrefChanged, | |
| 24 base::Unretained(this))); | |
| 25 } | 22 } |
| 26 | 23 |
| 27 FakeSigninManagerBase::~FakeSigninManagerBase() { | 24 FakeSigninManagerBase::~FakeSigninManagerBase() { |
| 28 if (signin_global_error_.get()) { | 25 if (signin_global_error_.get()) { |
| 29 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError( | 26 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError( |
| 30 signin_global_error_.get()); | 27 signin_global_error_.get()); |
| 31 signin_global_error_.reset(); | 28 signin_global_error_.reset(); |
| 32 } | 29 } |
| 33 } | 30 } |
| 34 | 31 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 content::Source<Profile>(profile_), | 77 content::Source<Profile>(profile_), |
| 81 content::NotificationService::NoDetails()); | 78 content::NotificationService::NoDetails()); |
| 82 } | 79 } |
| 83 | 80 |
| 84 // static | 81 // static |
| 85 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { | 82 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { |
| 86 return new FakeSigninManager(profile); | 83 return new FakeSigninManager(profile); |
| 87 } | 84 } |
| 88 | 85 |
| 89 #endif // !defined (OS_CHROMEOS) | 86 #endif // !defined (OS_CHROMEOS) |
| OLD | NEW |