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/sync/sync_global_error.h" | 5 #include "chrome/browser/sync/sync_global_error.h" |
6 | 6 |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/sync/profile_sync_service.h" | 8 #include "chrome/browser/sync/profile_sync_service.h" |
9 #include "chrome/browser/sync/profile_sync_service_observer.h" | 9 #include "chrome/browser/sync/profile_sync_service_observer.h" |
10 #include "chrome/browser/sync/sync_ui_util.h" | 10 #include "chrome/browser/sync/sync_ui_util.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_commands.h" | 12 #include "chrome/browser/ui/browser_commands.h" |
13 #include "chrome/browser/ui/chrome_pages.h" | 13 #include "chrome/browser/ui/chrome_pages.h" |
14 #include "chrome/browser/ui/global_error/global_error_service.h" | 14 #include "chrome/browser/ui/global_error/global_error_service.h" |
15 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 15 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
16 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 16 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
17 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 17 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
19 #include "google_apis/gaia/google_service_auth_error.h" | 19 #include "google_apis/gaia/google_service_auth_error.h" |
20 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 22 #include "grit/theme_resources.h" |
22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/gfx/image/image.h" |
23 | 26 |
24 SyncGlobalError::SyncGlobalError(ProfileSyncService* service, | 27 SyncGlobalError::SyncGlobalError(ProfileSyncService* service, |
25 SigninManagerBase* signin) | 28 SigninManagerBase* signin) |
26 : service_(service), | 29 : service_(service), |
27 signin_(signin) { | 30 signin_(signin) { |
28 DCHECK(service_); | 31 DCHECK(service_); |
29 DCHECK(signin_); | 32 DCHECK(signin_); |
30 OnStateChanged(); | 33 OnStateChanged(); |
31 } | 34 } |
32 | 35 |
(...skipping 20 matching lines...) Expand all Loading... |
53 return; | 56 return; |
54 } | 57 } |
55 // Need to navigate to the settings page and display the UI. | 58 // Need to navigate to the settings page and display the UI. |
56 chrome::ShowSettingsSubPage(browser, chrome::kSyncSetupSubPage); | 59 chrome::ShowSettingsSubPage(browser, chrome::kSyncSetupSubPage); |
57 } | 60 } |
58 | 61 |
59 bool SyncGlobalError::HasBubbleView() { | 62 bool SyncGlobalError::HasBubbleView() { |
60 return !bubble_message_.empty() && !bubble_accept_label_.empty(); | 63 return !bubble_message_.empty() && !bubble_accept_label_.empty(); |
61 } | 64 } |
62 | 65 |
| 66 gfx::Image SyncGlobalError::GetBubbleViewIcon() { |
| 67 return ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 68 IDR_INPUT_ALERT); |
| 69 } |
| 70 |
63 string16 SyncGlobalError::GetBubbleViewTitle() { | 71 string16 SyncGlobalError::GetBubbleViewTitle() { |
64 return l10n_util::GetStringUTF16(IDS_SYNC_ERROR_BUBBLE_VIEW_TITLE); | 72 return l10n_util::GetStringUTF16(IDS_SYNC_ERROR_BUBBLE_VIEW_TITLE); |
65 } | 73 } |
66 | 74 |
67 std::vector<string16> SyncGlobalError::GetBubbleViewMessages() { | 75 std::vector<string16> SyncGlobalError::GetBubbleViewMessages() { |
68 return std::vector<string16>(1, bubble_message_); | 76 return std::vector<string16>(1, bubble_message_); |
69 } | 77 } |
70 | 78 |
71 string16 SyncGlobalError::GetBubbleViewAcceptButtonLabel() { | 79 string16 SyncGlobalError::GetBubbleViewAcceptButtonLabel() { |
72 return bubble_accept_label_; | 80 return bubble_accept_label_; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 bubble_accept_label_ = bubble_accept_label; | 115 bubble_accept_label_ = bubble_accept_label; |
108 | 116 |
109 // Profile can be NULL during tests. | 117 // Profile can be NULL during tests. |
110 Profile* profile = service_->profile(); | 118 Profile* profile = service_->profile(); |
111 if (profile) { | 119 if (profile) { |
112 GlobalErrorServiceFactory::GetForProfile( | 120 GlobalErrorServiceFactory::GetForProfile( |
113 profile)->NotifyErrorsChanged(this); | 121 profile)->NotifyErrorsChanged(this); |
114 } | 122 } |
115 } | 123 } |
116 } | 124 } |
OLD | NEW |