Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_global_error.h" | 5 #include "chrome/browser/signin/signin_global_error.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
| 11 #include "chrome/browser/signin/signin_promo.h" | 11 #include "chrome/browser/signin/signin_promo.h" |
| 12 #include "chrome/browser/ui/browser_commands.h" | 12 #include "chrome/browser/ui/browser_commands.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | |
|
Michael Courage
2014/05/15 17:18:54
Is this used?
Roger Tawa OOO till Jul 10th
2014/05/15 18:24:09
Done.
| |
| 13 #include "chrome/browser/ui/chrome_pages.h" | 14 #include "chrome/browser/ui/chrome_pages.h" |
| 14 #include "chrome/browser/ui/global_error/global_error_service.h" | 15 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 15 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 16 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 16 #include "chrome/browser/ui/singleton_tabs.h" | 17 #include "chrome/browser/ui/singleton_tabs.h" |
| 17 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 18 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 18 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 19 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 19 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 20 #include "components/signin/core/browser/signin_manager.h" | 21 #include "components/signin/core/browser/signin_manager.h" |
| 22 #include "components/signin/core/common/profile_management_switches.h" | |
|
Michael Courage
2014/05/15 17:18:54
Is this used?
Roger Tawa OOO till Jul 10th
2014/05/15 18:24:09
Done.
| |
| 21 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
| 22 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 23 #include "net/base/url_util.h" | 25 #include "net/base/url_util.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 25 | 27 |
| 26 SigninGlobalError::SigninGlobalError( | 28 SigninGlobalError::SigninGlobalError( |
| 27 SigninErrorController* error_controller, | 29 SigninErrorController* error_controller, |
| 28 Profile* profile) | 30 Profile* profile) |
| 29 : profile_(profile), | 31 : profile_(profile), |
| 30 error_controller_(error_controller) { | 32 error_controller_(error_controller) { |
| 31 error_controller_->AddObserver(this); | 33 error_controller_->AddObserver(this); |
| 32 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(this); | 34 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(this); |
| 33 } | 35 } |
| 34 | 36 |
| 35 SigninGlobalError::~SigninGlobalError() { | 37 SigninGlobalError::~SigninGlobalError() { |
| 36 DCHECK(!error_controller_) | 38 DCHECK(!error_controller_) |
| 37 << "SigninGlobalError::Shutdown() was not called"; | 39 << "SigninGlobalError::Shutdown() was not called"; |
| 38 } | 40 } |
| 39 | 41 |
| 42 bool SigninGlobalError::HasError() { | |
| 43 return HasMenuItem(); | |
| 44 } | |
| 45 | |
| 46 void SigninGlobalError::AttemptToFixError(Browser* browser) { | |
| 47 if (!HasError()) | |
| 48 return; | |
| 49 | |
| 50 ExecuteMenuItem(browser); | |
| 51 } | |
| 52 | |
| 40 void SigninGlobalError::Shutdown() { | 53 void SigninGlobalError::Shutdown() { |
| 41 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError(this); | 54 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError(this); |
| 42 error_controller_->RemoveObserver(this); | 55 error_controller_->RemoveObserver(this); |
| 43 error_controller_ = NULL; | 56 error_controller_ = NULL; |
| 44 } | 57 } |
| 45 | 58 |
| 46 bool SigninGlobalError::HasMenuItem() { | 59 bool SigninGlobalError::HasMenuItem() { |
| 47 return error_controller_->HasError(); | 60 return error_controller_->HasError(); |
| 48 } | 61 } |
| 49 | 62 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 ExecuteMenuItem(browser); | 168 ExecuteMenuItem(browser); |
| 156 } | 169 } |
| 157 | 170 |
| 158 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { | 171 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { |
| 159 NOTREACHED(); | 172 NOTREACHED(); |
| 160 } | 173 } |
| 161 | 174 |
| 162 void SigninGlobalError::OnErrorChanged() { | 175 void SigninGlobalError::OnErrorChanged() { |
| 163 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this); | 176 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this); |
| 164 } | 177 } |
| OLD | NEW |