OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_ |
6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_ |
7 | 7 |
| 8 #include <set> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
8 #include "ui/message_center/message_center_export.h" | 11 #include "ui/message_center/message_center_export.h" |
9 #include "ui/message_center/notifier_settings.h" | 12 #include "ui/message_center/notifier_settings.h" |
10 #include "ui/message_center/views/message_bubble_base.h" | 13 #include "ui/message_center/views/message_bubble_base.h" |
11 #include "ui/views/controls/button/image_button.h" | 14 #include "ui/views/controls/button/image_button.h" |
| 15 #include "ui/views/controls/button/menu_button_listener.h" |
12 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
13 | 17 |
| 18 namespace views { |
| 19 class MenuRunner; |
| 20 } |
| 21 |
14 namespace message_center { | 22 namespace message_center { |
| 23 class NotifierGroupMenuModel; |
15 | 24 |
16 // A class to show the list of notifier extensions / URL patterns and allow | 25 // A class to show the list of notifier extensions / URL patterns and allow |
17 // users to customize the settings. | 26 // users to customize the settings. |
18 class MESSAGE_CENTER_EXPORT NotifierSettingsView | 27 class MESSAGE_CENTER_EXPORT NotifierSettingsView |
19 : public NotifierSettingsObserver, | 28 : public NotifierSettingsObserver, |
20 public views::View, | 29 public views::View, |
21 public views::ButtonListener { | 30 public views::ButtonListener, |
| 31 public views::MenuButtonListener { |
22 public: | 32 public: |
23 explicit NotifierSettingsView(NotifierSettingsProvider* provider); | 33 explicit NotifierSettingsView(NotifierSettingsProvider* provider); |
24 virtual ~NotifierSettingsView(); | 34 virtual ~NotifierSettingsView(); |
25 | 35 |
26 bool IsScrollable(); | 36 bool IsScrollable(); |
27 | 37 |
28 // Overridden from NotifierSettingsDelegate: | 38 // Overridden from NotifierSettingsDelegate: |
29 virtual void UpdateIconImage(const NotifierId& notifier_id, | 39 virtual void UpdateIconImage(const NotifierId& notifier_id, |
30 const gfx::Image& icon) OVERRIDE; | 40 const gfx::Image& icon) OVERRIDE; |
| 41 virtual void NotifierGroupChanged() OVERRIDE; |
31 | 42 |
32 void set_provider(NotifierSettingsProvider* new_provider) { | 43 void set_provider(NotifierSettingsProvider* new_provider) { |
33 provider_ = new_provider; | 44 provider_ = new_provider; |
34 } | 45 } |
35 | 46 |
36 private: | 47 private: |
37 class NotifierButton; | 48 class NotifierButton; |
38 | 49 |
| 50 // Given a new list of notifiers, updates the view to reflect it. |
| 51 void UpdateContentsView(const std::vector<Notifier*>& notifiers); |
| 52 |
39 // Overridden from views::View: | 53 // Overridden from views::View: |
40 virtual void Layout() OVERRIDE; | 54 virtual void Layout() OVERRIDE; |
41 virtual gfx::Size GetMinimumSize() OVERRIDE; | 55 virtual gfx::Size GetMinimumSize() OVERRIDE; |
42 virtual gfx::Size GetPreferredSize() OVERRIDE; | 56 virtual gfx::Size GetPreferredSize() OVERRIDE; |
43 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 57 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; |
44 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; | 58 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; |
45 | 59 |
46 // Overridden from views::ButtonListener: | 60 // Overridden from views::ButtonListener: |
47 virtual void ButtonPressed(views::Button* sender, | 61 virtual void ButtonPressed(views::Button* sender, |
48 const ui::Event& event) OVERRIDE; | 62 const ui::Event& event) OVERRIDE; |
| 63 virtual void OnMenuButtonClicked(views::View* source, |
| 64 const gfx::Point& point) OVERRIDE; |
49 | 65 |
50 views::ImageButton* title_arrow_; | 66 views::ImageButton* title_arrow_; |
51 views::View* title_entry_; | 67 views::View* title_entry_; |
52 views::ScrollView* scroller_; | 68 views::ScrollView* scroller_; |
53 NotifierSettingsProvider* provider_; | 69 NotifierSettingsProvider* provider_; |
54 std::set<NotifierButton*> buttons_; | 70 std::set<NotifierButton*> buttons_; |
| 71 scoped_ptr<NotifierGroupMenuModel> notifier_group_menu_model_; |
| 72 scoped_ptr<views::MenuRunner> notifier_group_menu_runner_; |
55 | 73 |
56 DISALLOW_COPY_AND_ASSIGN(NotifierSettingsView); | 74 DISALLOW_COPY_AND_ASSIGN(NotifierSettingsView); |
57 }; | 75 }; |
58 | 76 |
59 } // namespace message_center | 77 } // namespace message_center |
60 | 78 |
61 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_ | 79 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_ |
OLD | NEW |