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
3 // found in the LICENSE file.
5 #ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_
6 #define UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/message_center/message_center_export.h"
12 #include "ui/message_center/notifier_settings.h"
13 #include "ui/message_center/views/message_bubble_base.h"
14 #include "ui/views/controls/button/image_button.h"
15 #include "ui/views/controls/button/menu_button_listener.h"
16 #include "ui/views/view.h"
24 namespace message_center
{
25 class NotifierGroupMenuModel
;
27 // A class to show the list of notifier extensions / URL patterns and allow
28 // users to customize the settings.
29 class MESSAGE_CENTER_EXPORT NotifierSettingsView
30 : public NotifierSettingsObserver
,
32 public views::ButtonListener
,
33 public views::MenuButtonListener
{
35 explicit NotifierSettingsView(NotifierSettingsProvider
* provider
);
36 virtual ~NotifierSettingsView();
40 // Overridden from NotifierSettingsDelegate:
41 virtual void UpdateIconImage(const NotifierId
& notifier_id
,
42 const gfx::Image
& icon
) OVERRIDE
;
43 virtual void NotifierGroupChanged() OVERRIDE
;
45 void set_provider(NotifierSettingsProvider
* new_provider
) {
46 provider_
= new_provider
;
52 // Given a new list of notifiers, updates the view to reflect it.
53 void UpdateContentsView(const std::vector
<Notifier
*>& notifiers
);
55 // Overridden from views::View:
56 virtual void Layout() OVERRIDE
;
57 virtual gfx::Size
GetMinimumSize() OVERRIDE
;
58 virtual gfx::Size
GetPreferredSize() OVERRIDE
;
59 virtual bool OnKeyPressed(const ui::KeyEvent
& event
) OVERRIDE
;
60 virtual bool OnMouseWheel(const ui::MouseWheelEvent
& event
) OVERRIDE
;
62 // Overridden from views::ButtonListener:
63 virtual void ButtonPressed(views::Button
* sender
,
64 const ui::Event
& event
) OVERRIDE
;
65 virtual void OnMenuButtonClicked(views::View
* source
,
66 const gfx::Point
& point
) OVERRIDE
;
68 views::ImageButton
* title_arrow_
;
69 views::Label
* title_label_
;
70 views::MenuButton
* notifier_group_selector_
;
71 views::ScrollView
* scroller_
;
72 NotifierSettingsProvider
* provider_
;
73 std::set
<NotifierButton
*> buttons_
;
74 scoped_ptr
<NotifierGroupMenuModel
> notifier_group_menu_model_
;
75 scoped_ptr
<views::MenuRunner
> notifier_group_menu_runner_
;
77 DISALLOW_COPY_AND_ASSIGN(NotifierSettingsView
);
80 } // namespace message_center
82 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_