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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 error_controller_(error_controller) { | 30 error_controller_(error_controller) { |
31 error_controller_->AddObserver(this); | 31 error_controller_->AddObserver(this); |
32 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(this); | 32 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(this); |
33 } | 33 } |
34 | 34 |
35 SigninGlobalError::~SigninGlobalError() { | 35 SigninGlobalError::~SigninGlobalError() { |
36 DCHECK(!error_controller_) | 36 DCHECK(!error_controller_) |
37 << "SigninGlobalError::Shutdown() was not called"; | 37 << "SigninGlobalError::Shutdown() was not called"; |
38 } | 38 } |
39 | 39 |
| 40 bool SigninGlobalError::HasError() { |
| 41 return HasMenuItem(); |
| 42 } |
| 43 |
| 44 void SigninGlobalError::AttemptToFixError(Browser* browser) { |
| 45 if (!HasError()) |
| 46 return; |
| 47 |
| 48 ExecuteMenuItem(browser); |
| 49 } |
| 50 |
40 void SigninGlobalError::Shutdown() { | 51 void SigninGlobalError::Shutdown() { |
41 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError(this); | 52 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError(this); |
42 error_controller_->RemoveObserver(this); | 53 error_controller_->RemoveObserver(this); |
43 error_controller_ = NULL; | 54 error_controller_ = NULL; |
44 } | 55 } |
45 | 56 |
46 bool SigninGlobalError::HasMenuItem() { | 57 bool SigninGlobalError::HasMenuItem() { |
47 return error_controller_->HasError(); | 58 return error_controller_->HasError(); |
48 } | 59 } |
49 | 60 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 ExecuteMenuItem(browser); | 166 ExecuteMenuItem(browser); |
156 } | 167 } |
157 | 168 |
158 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { | 169 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { |
159 NOTREACHED(); | 170 NOTREACHED(); |
160 } | 171 } |
161 | 172 |
162 void SigninGlobalError::OnErrorChanged() { | 173 void SigninGlobalError::OnErrorChanged() { |
163 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this); | 174 GlobalErrorServiceFactory::GetForProfile(profile_)->NotifyErrorsChanged(this); |
164 } | 175 } |
OLD | NEW |