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/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "ash/system/system_notifier.h" | 9 #include "ash/system/system_notifier.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 const char kProfileSyncNotificationId[] = "chrome://settings/sync/"; | 39 const char kProfileSyncNotificationId[] = "chrome://settings/sync/"; |
40 | 40 |
41 // A simple notification delegate for the sync setup button. | 41 // A simple notification delegate for the sync setup button. |
42 class SyncNotificationDelegate : public NotificationDelegate { | 42 class SyncNotificationDelegate : public NotificationDelegate { |
43 public: | 43 public: |
44 SyncNotificationDelegate(const std::string& id, | 44 SyncNotificationDelegate(const std::string& id, |
45 Profile* profile); | 45 Profile* profile); |
46 | 46 |
47 // NotificationDelegate: | 47 // NotificationDelegate: |
48 void Display() override; | |
49 void Error() override; | |
50 void Close(bool by_user) override; | |
51 bool HasClickedListener() override; | |
52 void Click() override; | 48 void Click() override; |
53 void ButtonClick(int button_index) override; | 49 void ButtonClick(int button_index) override; |
54 std::string id() const override; | 50 std::string id() const override; |
55 | 51 |
56 protected: | 52 protected: |
57 ~SyncNotificationDelegate() override; | 53 ~SyncNotificationDelegate() override; |
58 | 54 |
59 private: | 55 private: |
60 void ShowSyncSetup(); | 56 void ShowSyncSetup(); |
61 | 57 |
62 // Unique id of the notification. | 58 // Unique id of the notification. |
63 const std::string id_; | 59 const std::string id_; |
64 | 60 |
65 Profile* profile_; | 61 Profile* profile_; |
66 | 62 |
67 DISALLOW_COPY_AND_ASSIGN(SyncNotificationDelegate); | 63 DISALLOW_COPY_AND_ASSIGN(SyncNotificationDelegate); |
68 }; | 64 }; |
69 | 65 |
70 SyncNotificationDelegate::SyncNotificationDelegate( | 66 SyncNotificationDelegate::SyncNotificationDelegate( |
71 const std::string& id, | 67 const std::string& id, |
72 Profile* profile) | 68 Profile* profile) |
73 : id_(id), | 69 : id_(id), |
74 profile_(profile) { | 70 profile_(profile) { |
75 } | 71 } |
76 | 72 |
77 SyncNotificationDelegate::~SyncNotificationDelegate() { | 73 SyncNotificationDelegate::~SyncNotificationDelegate() { |
78 } | 74 } |
79 | |
80 void SyncNotificationDelegate::Display() { | |
81 } | |
82 | |
83 void SyncNotificationDelegate::Error() { | |
84 } | |
85 | |
86 void SyncNotificationDelegate::Close(bool by_user) { | |
87 } | |
88 | |
89 bool SyncNotificationDelegate::HasClickedListener() { | |
90 return false; | |
91 } | |
92 | |
93 void SyncNotificationDelegate::Click() { | 75 void SyncNotificationDelegate::Click() { |
94 ShowSyncSetup(); | 76 ShowSyncSetup(); |
95 } | 77 } |
96 | 78 |
97 void SyncNotificationDelegate::ButtonClick(int button_index) { | 79 void SyncNotificationDelegate::ButtonClick(int button_index) { |
98 ShowSyncSetup(); | 80 ShowSyncSetup(); |
99 } | 81 } |
100 | 82 |
101 std::string SyncNotificationDelegate::id() const { | 83 std::string SyncNotificationDelegate::id() const { |
102 return id_; | 84 return id_; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 176 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
195 IDR_NOTIFICATION_ALERT), | 177 IDR_NOTIFICATION_ALERT), |
196 blink::WebTextDirectionDefault, | 178 blink::WebTextDirectionDefault, |
197 notifier_id, | 179 notifier_id, |
198 base::string16(), // display_source | 180 base::string16(), // display_source |
199 base::ASCIIToUTF16(notification_id_), | 181 base::ASCIIToUTF16(notification_id_), |
200 data, | 182 data, |
201 delegate); | 183 delegate); |
202 notification_ui_manager->Add(notification, profile_); | 184 notification_ui_manager->Add(notification, profile_); |
203 } | 185 } |
OLD | NEW |