OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_error_notifier_ash.h" | 5 #include "chrome/browser/sync/sync_error_notifier_ash.h" |
6 | 6 |
7 #include "ash/common/system/system_notifier.h" | 7 #include "ash/common/system/system_notifier.h" |
8 #include "ash/shell.h" | |
9 #include "ash/shell_delegate.h" | |
10 #include "base/macros.h" | 8 #include "base/macros.h" |
11 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
12 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
13 #include "build/build_config.h" | 11 #include "build/build_config.h" |
14 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/notifications/notification.h" | 13 #include "chrome/browser/notifications/notification.h" |
16 #include "chrome/browser/notifications/notification_ui_manager.h" | 14 #include "chrome/browser/notifications/notification_ui_manager.h" |
17 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 16 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
19 #include "chrome/browser/ui/chrome_pages.h" | 17 #include "chrome/browser/ui/chrome_pages.h" |
20 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 18 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
21 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 19 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
22 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
23 #include "chrome/grit/chromium_strings.h" | 21 #include "chrome/grit/chromium_strings.h" |
24 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
25 #include "components/signin/core/account_id/account_id.h" | 23 #include "components/signin/core/account_id/account_id.h" |
26 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
27 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
29 #include "ui/message_center/notification.h" | 27 #include "ui/message_center/notification.h" |
30 #include "ui/message_center/notification_delegate.h" | 28 #include "ui/message_center/notification_delegate.h" |
31 | 29 |
32 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
33 #include "chrome/browser/chromeos/login/user_flow.h" | 31 #include "chrome/browser/chromeos/login/user_flow.h" |
34 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 32 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
35 #include "components/user_manager/user_manager.h" | 33 #include "components/user_manager/user_manager.h" |
36 #endif | 34 #endif |
37 | 35 |
38 | |
39 namespace { | 36 namespace { |
40 | 37 |
41 const char kProfileSyncNotificationId[] = "chrome://settings/sync/"; | 38 const char kProfileSyncNotificationId[] = "chrome://settings/sync/"; |
42 | 39 |
43 // A simple notification delegate for the sync setup button. | 40 // A simple notification delegate for the sync setup button. |
44 class SyncNotificationDelegate : public NotificationDelegate { | 41 class SyncNotificationDelegate : public NotificationDelegate { |
45 public: | 42 public: |
46 SyncNotificationDelegate(const std::string& id, | 43 SyncNotificationDelegate(const std::string& id, |
47 Profile* profile); | 44 Profile* profile); |
48 | 45 |
(...skipping 18 matching lines...) Expand all Loading... |
67 | 64 |
68 SyncNotificationDelegate::SyncNotificationDelegate( | 65 SyncNotificationDelegate::SyncNotificationDelegate( |
69 const std::string& id, | 66 const std::string& id, |
70 Profile* profile) | 67 Profile* profile) |
71 : id_(id), | 68 : id_(id), |
72 profile_(profile) { | 69 profile_(profile) { |
73 } | 70 } |
74 | 71 |
75 SyncNotificationDelegate::~SyncNotificationDelegate() { | 72 SyncNotificationDelegate::~SyncNotificationDelegate() { |
76 } | 73 } |
| 74 |
77 void SyncNotificationDelegate::Click() { | 75 void SyncNotificationDelegate::Click() { |
78 ShowSyncSetup(); | 76 ShowSyncSetup(); |
79 } | 77 } |
80 | 78 |
81 void SyncNotificationDelegate::ButtonClick(int button_index) { | 79 void SyncNotificationDelegate::ButtonClick(int button_index) { |
82 ShowSyncSetup(); | 80 ShowSyncSetup(); |
83 } | 81 } |
84 | 82 |
85 std::string SyncNotificationDelegate::id() const { | 83 std::string SyncNotificationDelegate::id() const { |
86 return id_; | 84 return id_; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 message_center::NOTIFICATION_TYPE_SIMPLE, | 174 message_center::NOTIFICATION_TYPE_SIMPLE, |
177 l10n_util::GetStringUTF16(IDS_SYNC_ERROR_BUBBLE_VIEW_TITLE), | 175 l10n_util::GetStringUTF16(IDS_SYNC_ERROR_BUBBLE_VIEW_TITLE), |
178 l10n_util::GetStringUTF16(IDS_SYNC_PASSPHRASE_ERROR_BUBBLE_VIEW_MESSAGE), | 176 l10n_util::GetStringUTF16(IDS_SYNC_PASSPHRASE_ERROR_BUBBLE_VIEW_MESSAGE), |
179 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 177 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
180 IDR_NOTIFICATION_ALERT), | 178 IDR_NOTIFICATION_ALERT), |
181 notifier_id, | 179 notifier_id, |
182 base::string16(), // display_source | 180 base::string16(), // display_source |
183 GURL(notification_id_), notification_id_, data, delegate); | 181 GURL(notification_id_), notification_id_, data, delegate); |
184 notification_ui_manager->Add(notification, profile_); | 182 notification_ui_manager->Add(notification, profile_); |
185 } | 183 } |
OLD | NEW |