OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ash/system/locale/locale_notification_controller.h" | 5 #include "ash/system/locale/locale_notification_controller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/system_notifier.h" | 8 #include "ash/system/system_notifier.h" |
9 #include "ash/system/tray/system_tray_notifier.h" | 9 #include "ash/system/tray/system_tray_notifier.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 const char kLocaleChangeNotificationId[] = "chrome://settings/locale"; | 25 const char kLocaleChangeNotificationId[] = "chrome://settings/locale"; |
26 | 26 |
27 class LocaleNotificationDelegate : public message_center::NotificationDelegate { | 27 class LocaleNotificationDelegate : public message_center::NotificationDelegate { |
28 public: | 28 public: |
29 explicit LocaleNotificationDelegate(LocaleObserver::Delegate* delegate); | 29 explicit LocaleNotificationDelegate(LocaleObserver::Delegate* delegate); |
30 | 30 |
31 protected: | 31 protected: |
32 ~LocaleNotificationDelegate() override; | 32 ~LocaleNotificationDelegate() override; |
33 | 33 |
34 // message_center::NotificationDelegate overrides: | 34 // message_center::NotificationDelegate overrides: |
35 void Display() override; | |
36 void Error() override; | |
37 void Close(bool by_user) override; | 35 void Close(bool by_user) override; |
38 bool HasClickedListener() override; | 36 bool HasClickedListener() override; |
39 void Click() override; | 37 void Click() override; |
40 void ButtonClick(int button_index) override; | 38 void ButtonClick(int button_index) override; |
41 | 39 |
42 private: | 40 private: |
43 LocaleObserver::Delegate* delegate_; | 41 LocaleObserver::Delegate* delegate_; |
44 | 42 |
45 DISALLOW_COPY_AND_ASSIGN(LocaleNotificationDelegate); | 43 DISALLOW_COPY_AND_ASSIGN(LocaleNotificationDelegate); |
46 }; | 44 }; |
47 | 45 |
48 LocaleNotificationDelegate::LocaleNotificationDelegate( | 46 LocaleNotificationDelegate::LocaleNotificationDelegate( |
49 LocaleObserver::Delegate* delegate) | 47 LocaleObserver::Delegate* delegate) |
50 : delegate_(delegate) { | 48 : delegate_(delegate) { |
51 DCHECK(delegate_); | 49 DCHECK(delegate_); |
52 } | 50 } |
53 | 51 |
54 LocaleNotificationDelegate::~LocaleNotificationDelegate() { | 52 LocaleNotificationDelegate::~LocaleNotificationDelegate() { |
55 } | 53 } |
56 | 54 |
57 void LocaleNotificationDelegate::Display() { | |
58 } | |
59 | |
60 void LocaleNotificationDelegate::Error() { | |
61 } | |
62 | |
63 void LocaleNotificationDelegate::Close(bool by_user) { | 55 void LocaleNotificationDelegate::Close(bool by_user) { |
64 delegate_->AcceptLocaleChange(); | 56 delegate_->AcceptLocaleChange(); |
65 } | 57 } |
66 | 58 |
67 bool LocaleNotificationDelegate::HasClickedListener() { | 59 bool LocaleNotificationDelegate::HasClickedListener() { |
68 return true; | 60 return true; |
69 } | 61 } |
70 | 62 |
71 void LocaleNotificationDelegate::Click() { | 63 void LocaleNotificationDelegate::Click() { |
72 delegate_->AcceptLocaleChange(); | 64 delegate_->AcceptLocaleChange(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 base::string16() /* display_source */, | 110 base::string16() /* display_source */, |
119 message_center::NotifierId( | 111 message_center::NotifierId( |
120 message_center::NotifierId::SYSTEM_COMPONENT, | 112 message_center::NotifierId::SYSTEM_COMPONENT, |
121 system_notifier::kNotifierLocale), | 113 system_notifier::kNotifierLocale), |
122 optional, | 114 optional, |
123 new LocaleNotificationDelegate(delegate))); | 115 new LocaleNotificationDelegate(delegate))); |
124 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 116 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
125 } | 117 } |
126 | 118 |
127 } // namespace ash | 119 } // namespace ash |
OLD | NEW |