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 15 matching lines...) Expand all Loading... |
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; | 35 void Display() override; |
36 void Error() override; | |
37 void Close(bool by_user) override; | 36 void Close(bool by_user) override; |
38 bool HasClickedListener() override; | 37 bool HasClickedListener() override; |
39 void Click() override; | 38 void Click() override; |
40 void ButtonClick(int button_index) override; | 39 void ButtonClick(int button_index) override; |
41 | 40 |
42 private: | 41 private: |
43 LocaleObserver::Delegate* delegate_; | 42 LocaleObserver::Delegate* delegate_; |
44 | 43 |
45 DISALLOW_COPY_AND_ASSIGN(LocaleNotificationDelegate); | 44 DISALLOW_COPY_AND_ASSIGN(LocaleNotificationDelegate); |
46 }; | 45 }; |
47 | 46 |
48 LocaleNotificationDelegate::LocaleNotificationDelegate( | 47 LocaleNotificationDelegate::LocaleNotificationDelegate( |
49 LocaleObserver::Delegate* delegate) | 48 LocaleObserver::Delegate* delegate) |
50 : delegate_(delegate) { | 49 : delegate_(delegate) { |
51 DCHECK(delegate_); | 50 DCHECK(delegate_); |
52 } | 51 } |
53 | 52 |
54 LocaleNotificationDelegate::~LocaleNotificationDelegate() { | 53 LocaleNotificationDelegate::~LocaleNotificationDelegate() { |
55 } | 54 } |
56 | 55 |
57 void LocaleNotificationDelegate::Display() { | 56 void LocaleNotificationDelegate::Display() { |
58 } | 57 } |
59 | 58 |
60 void LocaleNotificationDelegate::Error() { | |
61 } | |
62 | |
63 void LocaleNotificationDelegate::Close(bool by_user) { | 59 void LocaleNotificationDelegate::Close(bool by_user) { |
64 delegate_->AcceptLocaleChange(); | 60 delegate_->AcceptLocaleChange(); |
65 } | 61 } |
66 | 62 |
67 bool LocaleNotificationDelegate::HasClickedListener() { | 63 bool LocaleNotificationDelegate::HasClickedListener() { |
68 return true; | 64 return true; |
69 } | 65 } |
70 | 66 |
71 void LocaleNotificationDelegate::Click() { | 67 void LocaleNotificationDelegate::Click() { |
72 delegate_->AcceptLocaleChange(); | 68 delegate_->AcceptLocaleChange(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 base::string16() /* display_source */, | 114 base::string16() /* display_source */, |
119 message_center::NotifierId( | 115 message_center::NotifierId( |
120 message_center::NotifierId::SYSTEM_COMPONENT, | 116 message_center::NotifierId::SYSTEM_COMPONENT, |
121 system_notifier::kNotifierLocale), | 117 system_notifier::kNotifierLocale), |
122 optional, | 118 optional, |
123 new LocaleNotificationDelegate(delegate))); | 119 new LocaleNotificationDelegate(delegate))); |
124 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 120 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
125 } | 121 } |
126 | 122 |
127 } // namespace ash | 123 } // namespace ash |
OLD | NEW |