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> | 8 #include <set> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 public views::ButtonListener, | 34 public views::ButtonListener, |
35 public views::MenuButtonListener { | 35 public views::MenuButtonListener { |
36 public: | 36 public: |
37 explicit NotifierSettingsView(NotifierSettingsProvider* provider); | 37 explicit NotifierSettingsView(NotifierSettingsProvider* provider); |
38 virtual ~NotifierSettingsView(); | 38 virtual ~NotifierSettingsView(); |
39 | 39 |
40 bool IsScrollable(); | 40 bool IsScrollable(); |
41 | 41 |
42 // Overridden from NotifierSettingsDelegate: | 42 // Overridden from NotifierSettingsDelegate: |
43 virtual void UpdateIconImage(const NotifierId& notifier_id, | 43 virtual void UpdateIconImage(const NotifierId& notifier_id, |
44 const gfx::Image& icon) OVERRIDE; | 44 const gfx::Image& icon) override; |
45 virtual void NotifierGroupChanged() OVERRIDE; | 45 virtual void NotifierGroupChanged() override; |
46 virtual void NotifierEnabledChanged(const NotifierId& notifier_id, | 46 virtual void NotifierEnabledChanged(const NotifierId& notifier_id, |
47 bool enabled) OVERRIDE; | 47 bool enabled) override; |
48 | 48 |
49 void set_provider(NotifierSettingsProvider* new_provider) { | 49 void set_provider(NotifierSettingsProvider* new_provider) { |
50 provider_ = new_provider; | 50 provider_ = new_provider; |
51 } | 51 } |
52 | 52 |
53 private: | 53 private: |
54 FRIEND_TEST_ALL_PREFIXES(NotifierSettingsViewTest, TestLearnMoreButton); | 54 FRIEND_TEST_ALL_PREFIXES(NotifierSettingsViewTest, TestLearnMoreButton); |
55 | 55 |
56 class MESSAGE_CENTER_EXPORT NotifierButton : public views::CustomButton, | 56 class MESSAGE_CENTER_EXPORT NotifierButton : public views::CustomButton, |
57 public views::ButtonListener { | 57 public views::ButtonListener { |
58 public: | 58 public: |
59 NotifierButton(NotifierSettingsProvider* provider, | 59 NotifierButton(NotifierSettingsProvider* provider, |
60 Notifier* notifier, | 60 Notifier* notifier, |
61 views::ButtonListener* listener); | 61 views::ButtonListener* listener); |
62 virtual ~NotifierButton(); | 62 virtual ~NotifierButton(); |
63 | 63 |
64 void UpdateIconImage(const gfx::Image& icon); | 64 void UpdateIconImage(const gfx::Image& icon); |
65 void SetChecked(bool checked); | 65 void SetChecked(bool checked); |
66 bool checked() const; | 66 bool checked() const; |
67 bool has_learn_more() const; | 67 bool has_learn_more() const; |
68 const Notifier& notifier() const; | 68 const Notifier& notifier() const; |
69 | 69 |
70 void SendLearnMorePressedForTest(); | 70 void SendLearnMorePressedForTest(); |
71 | 71 |
72 private: | 72 private: |
73 // Overridden from views::ButtonListener: | 73 // Overridden from views::ButtonListener: |
74 virtual void ButtonPressed(views::Button* button, | 74 virtual void ButtonPressed(views::Button* button, |
75 const ui::Event& event) OVERRIDE; | 75 const ui::Event& event) override; |
76 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 76 virtual void GetAccessibleState(ui::AXViewState* state) override; |
77 | 77 |
78 bool ShouldHaveLearnMoreButton() const; | 78 bool ShouldHaveLearnMoreButton() const; |
79 // Helper function to reset the layout when the view has substantially | 79 // Helper function to reset the layout when the view has substantially |
80 // changed. | 80 // changed. |
81 void GridChanged(bool has_learn_more, bool has_icon_view); | 81 void GridChanged(bool has_learn_more, bool has_icon_view); |
82 | 82 |
83 NotifierSettingsProvider* provider_; // Weak. | 83 NotifierSettingsProvider* provider_; // Weak. |
84 const scoped_ptr<Notifier> notifier_; | 84 const scoped_ptr<Notifier> notifier_; |
85 // |icon_view_| is owned by us because sometimes we don't leave it | 85 // |icon_view_| is owned by us because sometimes we don't leave it |
86 // in the view hierarchy. | 86 // in the view hierarchy. |
87 scoped_ptr<views::ImageView> icon_view_; | 87 scoped_ptr<views::ImageView> icon_view_; |
88 views::Label* name_view_; | 88 views::Label* name_view_; |
89 views::Checkbox* checkbox_; | 89 views::Checkbox* checkbox_; |
90 views::ImageButton* learn_more_; | 90 views::ImageButton* learn_more_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(NotifierButton); | 92 DISALLOW_COPY_AND_ASSIGN(NotifierButton); |
93 }; | 93 }; |
94 | 94 |
95 // Given a new list of notifiers, updates the view to reflect it. | 95 // Given a new list of notifiers, updates the view to reflect it. |
96 void UpdateContentsView(const std::vector<Notifier*>& notifiers); | 96 void UpdateContentsView(const std::vector<Notifier*>& notifiers); |
97 | 97 |
98 // Overridden from views::View: | 98 // Overridden from views::View: |
99 virtual void Layout() OVERRIDE; | 99 virtual void Layout() override; |
100 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 100 virtual gfx::Size GetMinimumSize() const override; |
101 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 101 virtual gfx::Size GetPreferredSize() const override; |
102 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | 102 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; |
103 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; | 103 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) override; |
104 | 104 |
105 // Overridden from views::ButtonListener: | 105 // Overridden from views::ButtonListener: |
106 virtual void ButtonPressed(views::Button* sender, | 106 virtual void ButtonPressed(views::Button* sender, |
107 const ui::Event& event) OVERRIDE; | 107 const ui::Event& event) override; |
108 | 108 |
109 // Overridden from views::MenuButtonListener: | 109 // Overridden from views::MenuButtonListener: |
110 virtual void OnMenuButtonClicked(views::View* source, | 110 virtual void OnMenuButtonClicked(views::View* source, |
111 const gfx::Point& point) OVERRIDE; | 111 const gfx::Point& point) override; |
112 | 112 |
113 views::ImageButton* title_arrow_; | 113 views::ImageButton* title_arrow_; |
114 views::Label* title_label_; | 114 views::Label* title_label_; |
115 views::MenuButton* notifier_group_selector_; | 115 views::MenuButton* notifier_group_selector_; |
116 views::ScrollView* scroller_; | 116 views::ScrollView* scroller_; |
117 NotifierSettingsProvider* provider_; | 117 NotifierSettingsProvider* provider_; |
118 std::set<NotifierButton*> buttons_; | 118 std::set<NotifierButton*> buttons_; |
119 scoped_ptr<NotifierGroupMenuModel> notifier_group_menu_model_; | 119 scoped_ptr<NotifierGroupMenuModel> notifier_group_menu_model_; |
120 scoped_ptr<views::MenuRunner> notifier_group_menu_runner_; | 120 scoped_ptr<views::MenuRunner> notifier_group_menu_runner_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(NotifierSettingsView); | 122 DISALLOW_COPY_AND_ASSIGN(NotifierSettingsView); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace message_center | 125 } // namespace message_center |
126 | 126 |
127 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_ | 127 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_ |
OLD | NEW |