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 "grit/theme_resources.h" |
19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/gfx/image/image.h" |
20 | 23 |
21 SigninGlobalError::SigninGlobalError(SigninManagerBase* manager, | 24 SigninGlobalError::SigninGlobalError(SigninManagerBase* manager, |
22 Profile* profile) | 25 Profile* profile) |
23 : auth_error_(GoogleServiceAuthError::AuthErrorNone()), | 26 : auth_error_(GoogleServiceAuthError::AuthErrorNone()), |
24 signin_manager_(manager), | 27 signin_manager_(manager), |
25 profile_(profile) { | 28 profile_(profile) { |
26 } | 29 } |
27 | 30 |
28 SigninGlobalError::~SigninGlobalError() { | 31 SigninGlobalError::~SigninGlobalError() { |
29 DCHECK(provider_set_.empty()) | 32 DCHECK(provider_set_.empty()) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 118 } |
116 // Need to navigate to the settings page and display the UI. | 119 // Need to navigate to the settings page and display the UI. |
117 chrome::ShowSettingsSubPage(browser, chrome::kSyncSetupSubPage); | 120 chrome::ShowSettingsSubPage(browser, chrome::kSyncSetupSubPage); |
118 #endif | 121 #endif |
119 } | 122 } |
120 | 123 |
121 bool SigninGlobalError::HasBubbleView() { | 124 bool SigninGlobalError::HasBubbleView() { |
122 return !GetBubbleViewMessages().empty(); | 125 return !GetBubbleViewMessages().empty(); |
123 } | 126 } |
124 | 127 |
| 128 gfx::Image SigninGlobalError::GetBubbleViewIcon() { |
| 129 return ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 130 IDR_INPUT_ALERT); |
| 131 } |
| 132 |
125 string16 SigninGlobalError::GetBubbleViewTitle() { | 133 string16 SigninGlobalError::GetBubbleViewTitle() { |
126 return l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE); | 134 return l10n_util::GetStringUTF16(IDS_SIGNIN_ERROR_BUBBLE_VIEW_TITLE); |
127 } | 135 } |
128 | 136 |
129 std::vector<string16> SigninGlobalError::GetBubbleViewMessages() { | 137 std::vector<string16> SigninGlobalError::GetBubbleViewMessages() { |
130 std::vector<string16> messages; | 138 std::vector<string16> messages; |
131 // If the user isn't signed in, no need to display an error bubble. | 139 // If the user isn't signed in, no need to display an error bubble. |
132 if (signin_manager_->GetAuthenticatedUsername().empty()) { | 140 if (signin_manager_->GetAuthenticatedUsername().empty()) { |
133 return messages; | 141 return messages; |
134 } | 142 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 void SigninGlobalError::OnBubbleViewDidClose(Browser* browser) { | 191 void SigninGlobalError::OnBubbleViewDidClose(Browser* browser) { |
184 } | 192 } |
185 | 193 |
186 void SigninGlobalError::BubbleViewAcceptButtonPressed(Browser* browser) { | 194 void SigninGlobalError::BubbleViewAcceptButtonPressed(Browser* browser) { |
187 ExecuteMenuItem(browser); | 195 ExecuteMenuItem(browser); |
188 } | 196 } |
189 | 197 |
190 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { | 198 void SigninGlobalError::BubbleViewCancelButtonPressed(Browser* browser) { |
191 NOTREACHED(); | 199 NOTREACHED(); |
192 } | 200 } |
OLD | NEW |