| 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 "base/callback_helpers.h" |
| 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" |
| 7 #include "chrome/browser/signin/signin_global_error.h" | 10 #include "chrome/browser/signin/signin_global_error.h" |
| 8 #include "chrome/browser/ui/global_error/global_error_service.h" | 11 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 9 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 12 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "chrome/common/pref_names.h" |
| 11 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 12 | 16 |
| 13 FakeSigninManager::FakeSigninManager(Profile* profile) | 17 FakeSigninManager::FakeSigninManager(Profile* profile) |
| 14 : auth_in_progress_(false) { | 18 : auth_in_progress_(false) { |
| 15 profile_ = profile; | 19 profile_ = profile; |
| 16 signin_global_error_.reset(new SigninGlobalError(this, profile)); | 20 signin_global_error_.reset(new SigninGlobalError(this, profile)); |
| 17 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError( | 21 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError( |
| 18 signin_global_error_.get()); | 22 signin_global_error_.get()); |
| 23 signin_allowed_.Init(prefs::kSigninAllowed, profile_->GetPrefs(), |
| 24 base::Bind(&SigninManager::OnSigninAllowedPrefChanged, |
| 25 base::Unretained(this))); |
| 19 } | 26 } |
| 20 | 27 |
| 21 FakeSigninManager::~FakeSigninManager() { | 28 FakeSigninManager::~FakeSigninManager() { |
| 22 if (signin_global_error_.get()) { | 29 if (signin_global_error_.get()) { |
| 23 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError( | 30 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError( |
| 24 signin_global_error_.get()); | 31 signin_global_error_.get()); |
| 25 signin_global_error_.reset(); | 32 signin_global_error_.reset(); |
| 26 } | 33 } |
| 27 } | 34 } |
| 28 | 35 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 54 } | 61 } |
| 55 | 62 |
| 56 bool FakeSigninManager::AuthInProgress() const { | 63 bool FakeSigninManager::AuthInProgress() const { |
| 57 return auth_in_progress_; | 64 return auth_in_progress_; |
| 58 } | 65 } |
| 59 | 66 |
| 60 // static | 67 // static |
| 61 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { | 68 ProfileKeyedService* FakeSigninManager::Build(Profile* profile) { |
| 62 return new FakeSigninManager(profile); | 69 return new FakeSigninManager(profile); |
| 63 } | 70 } |
| OLD | NEW |