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