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_
11 #include "base/string16.h"
12 #include "ui/gfx/image/image.h"
13 #include "ui/gfx/image/image_skia.h"
14 #include "ui/gfx/native_widget_types.h"
15 #include "ui/message_center/message_center_export.h"
16 #include "ui/message_center/notifier_settings.h"
17 #include "ui/views/controls/button/button.h"
18 #include "ui/views/widget/widget_delegate.h"
24 namespace message_center
{
26 // A class to show the list of notifier extensions / URL patterns and allow
27 // users to customize the settings.
28 class MESSAGE_CENTER_EXPORT NotifierSettingsView
29 : public NotifierSettingsDelegate
,
30 public views::WidgetDelegateView
,
31 public views::ButtonListener
{
33 // Create a new widget of the notifier settings and returns it. Note that
34 // the widget and the view is self-owned. It'll be deleted when it's closed
35 // or the chrome's shutdown.
36 static NotifierSettingsView
* Create(NotifierSettingsProvider
* delegate
,
37 gfx::NativeView context
);
39 // Overridden from NotifierSettingsDelegate:
40 virtual void UpdateIconImage(const std::string
& id
,
41 const gfx::Image
& icon
) OVERRIDE
;
42 virtual void UpdateFavicon(const GURL
& url
, const gfx::Image
& icon
) OVERRIDE
;
44 void set_delegate(NotifierSettingsProvider
* new_delegate
) {
45 delegate_
= new_delegate
;
51 NotifierSettingsView(NotifierSettingsProvider
* delegate
);
52 virtual ~NotifierSettingsView();
54 // Overridden from views::WidgetDelegate:
55 virtual void WindowClosing() OVERRIDE
;
56 virtual views::View
* GetContentsView() OVERRIDE
;
57 virtual bool CanResize() const OVERRIDE
;
59 // Overridden from views::View:
60 virtual void Layout() OVERRIDE
;
61 virtual gfx::Size
GetMinimumSize() OVERRIDE
;
62 virtual gfx::Size
GetPreferredSize() OVERRIDE
;
64 // Overridden from views::ButtonListener:
65 virtual void ButtonPressed(views::Button
* sender
,
66 const ui::Event
& event
) OVERRIDE
;
68 views::View
* title_entry_
;
69 views::ScrollView
* scroller_
;
70 NotifierSettingsProvider
* delegate_
;
71 std::set
<NotifierButton
*> buttons_
;
73 DISALLOW_COPY_AND_ASSIGN(NotifierSettingsView
);
76 } // namespace message_center
78 #endif // UI_MESSAGE_CENTER_VIEWS_NOTIFIER_SETTINGS_VIEW_H_