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/signin/signin_manager.h" | 9 #include "chrome/browser/signin/signin_manager.h" |
10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
11 #include "chrome/browser/ui/chrome_pages.h" | 11 #include "chrome/browser/ui/chrome_pages.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/browser/ui/webui/signin/login_ui_service.h" | 14 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
15 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 15 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
17 #include "grit/chromium_strings.h" | 17 #include "grit/chromium_strings.h" |
18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
20 | 20 |
21 SigninGlobalError::SigninGlobalError(SigninManager* manager, Profile* profile) | 21 SigninGlobalError::SigninGlobalError(SigninManager* manager, Profile* profile) |
22 : auth_error_(GoogleServiceAuthError::None()), | 22 : auth_error_(GoogleServiceAuthError::AuthErrorNone()), |
23 signin_manager_(manager), | 23 signin_manager_(manager), |
24 profile_(profile) { | 24 profile_(profile) { |
25 } | 25 } |
26 | 26 |
27 SigninGlobalError::~SigninGlobalError() { | 27 SigninGlobalError::~SigninGlobalError() { |
28 DCHECK(provider_set_.empty()) | 28 DCHECK(provider_set_.empty()) |
29 << "All AuthStatusProviders should be unregistered before" | 29 << "All AuthStatusProviders should be unregistered before" |
30 << " SigninManager::Shutdown() is called"; | 30 << " SigninManager::Shutdown() is called"; |
31 } | 31 } |
32 | 32 |
(...skipping 14 matching lines...) Expand all Loading... |
47 } | 47 } |
48 | 48 |
49 SigninGlobalError::AuthStatusProvider::AuthStatusProvider() { | 49 SigninGlobalError::AuthStatusProvider::AuthStatusProvider() { |
50 } | 50 } |
51 | 51 |
52 SigninGlobalError::AuthStatusProvider::~AuthStatusProvider() { | 52 SigninGlobalError::AuthStatusProvider::~AuthStatusProvider() { |
53 } | 53 } |
54 | 54 |
55 void SigninGlobalError::AuthStatusChanged() { | 55 void SigninGlobalError::AuthStatusChanged() { |
56 // Walk all of the status providers and collect any error. | 56 // Walk all of the status providers and collect any error. |
57 GoogleServiceAuthError current_error(GoogleServiceAuthError::None()); | 57 GoogleServiceAuthError current_error(GoogleServiceAuthError::AuthErrorNone()); |
58 for (std::set<const AuthStatusProvider*>::const_iterator it = | 58 for (std::set<const AuthStatusProvider*>::const_iterator it = |
59 provider_set_.begin(); it != provider_set_.end(); ++it) { | 59 provider_set_.begin(); it != provider_set_.end(); ++it) { |
60 current_error = (*it)->GetAuthStatus(); | 60 current_error = (*it)->GetAuthStatus(); |
61 // Break out if any provider reports an error (ignoring ordinary network | 61 // Break out if any provider reports an error (ignoring ordinary network |
62 // errors, which are not surfaced to the user). This logic may eventually | 62 // errors, which are not surfaced to the user). This logic may eventually |
63 // need to be extended to prioritize different auth errors, but for now | 63 // need to be extended to prioritize different auth errors, but for now |
64 // all auth errors are treated the same. | 64 // all auth errors are treated the same. |
65 if (current_error.state() != GoogleServiceAuthError::NONE && | 65 if (current_error.state() != GoogleServiceAuthError::NONE && |
66 current_error.state() != GoogleServiceAuthError::CONNECTION_FAILED) { | 66 current_error.state() != GoogleServiceAuthError::CONNECTION_FAILED) { |
67 break; | 67 break; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 void SigninGlobalError::OnBubbleViewDidClose(Browser* browser) { | 191 void SigninGlobalError::OnBubbleViewDidClose(Browser* browser) { |
192 } | 192 } |
193 | 193 |
194 void SigninGlobalError::BubbleViewAcceptButtonPressed(Browser* browser) { | 194 void SigninGlobalError::BubbleViewAcceptButtonPressed(Browser* browser) { |
195 ExecuteMenuItem(browser); | 195 ExecuteMenuItem(browser); |
196 } | 196 } |
197 | 197 |
198 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { | 198 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { |
199 NOTREACHED(); | 199 NOTREACHED(); |
200 } | 200 } |
OLD | NEW |