| 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_NOTIFIER_SETTINGS_H_ | 5 #ifndef UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ |
| 6 #define UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ | 6 #define UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "ui/gfx/image/image_skia.h" | 13 #include "ui/gfx/image/image_skia.h" |
| 14 #include "ui/gfx/native_widget_types.h" |
| 14 #include "ui/message_center/message_center_export.h" | 15 #include "ui/message_center/message_center_export.h" |
| 15 #include "ui/views/controls/button/button.h" | 16 #include "ui/views/controls/button/button.h" |
| 16 #include "ui/views/widget/widget_delegate.h" | 17 #include "ui/views/widget/widget_delegate.h" |
| 17 | 18 |
| 18 namespace message_center { | 19 namespace message_center { |
| 19 | 20 |
| 20 // A class to show the list of notifier extensions / URL patterns and allow | 21 // A class to show the list of notifier extensions / URL patterns and allow |
| 21 // users to customize the settings. | 22 // users to customize the settings. |
| 22 class MESSAGE_CENTER_EXPORT NotifierSettingsView | 23 class MESSAGE_CENTER_EXPORT NotifierSettingsView |
| 23 : public views::WidgetDelegateView, | 24 : public views::WidgetDelegateView, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // operation. | 58 // operation. |
| 58 virtual void SetNotifierEnabled(const std::string& id, bool enabled) = 0; | 59 virtual void SetNotifierEnabled(const std::string& id, bool enabled) = 0; |
| 59 | 60 |
| 60 // Called when the settings window is closed. | 61 // Called when the settings window is closed. |
| 61 virtual void OnNotifierSettingsClosing(NotifierSettingsView* view) = 0; | 62 virtual void OnNotifierSettingsClosing(NotifierSettingsView* view) = 0; |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 // Create a new widget of the notifier settings and returns it. Note that | 65 // Create a new widget of the notifier settings and returns it. Note that |
| 65 // the widget and the view is self-owned. It'll be deleted when it's closed | 66 // the widget and the view is self-owned. It'll be deleted when it's closed |
| 66 // or the chrome's shutdown. | 67 // or the chrome's shutdown. |
| 67 static NotifierSettingsView* Create(Delegate* delegate); | 68 static NotifierSettingsView* Create(Delegate* delegate, |
| 69 gfx::NativeView context); |
| 68 | 70 |
| 69 void UpdateIconImage(const std::string& id, const gfx::ImageSkia& icon); | 71 void UpdateIconImage(const std::string& id, const gfx::ImageSkia& icon); |
| 70 | 72 |
| 71 private: | 73 private: |
| 72 class NotifierButton; | 74 class NotifierButton; |
| 73 | 75 |
| 74 NotifierSettingsView(Delegate* delegate); | 76 NotifierSettingsView(Delegate* delegate); |
| 75 virtual ~NotifierSettingsView(); | 77 virtual ~NotifierSettingsView(); |
| 76 | 78 |
| 77 // views::WidgetDelegate overrides: | 79 // views::WidgetDelegate overrides: |
| 78 virtual bool CanResize() const OVERRIDE; | 80 virtual bool CanResize() const OVERRIDE; |
| 79 virtual string16 GetWindowTitle() const OVERRIDE; | 81 virtual string16 GetWindowTitle() const OVERRIDE; |
| 80 virtual void WindowClosing() OVERRIDE; | 82 virtual void WindowClosing() OVERRIDE; |
| 81 virtual views::View* GetContentsView() OVERRIDE; | 83 virtual views::View* GetContentsView() OVERRIDE; |
| 82 | 84 |
| 83 // views::ButtonListener overrides: | 85 // views::ButtonListener overrides: |
| 84 virtual void ButtonPressed(views::Button* sender, | 86 virtual void ButtonPressed(views::Button* sender, |
| 85 const ui::Event& event) OVERRIDE; | 87 const ui::Event& event) OVERRIDE; |
| 86 | 88 |
| 87 Delegate* delegate_; | 89 Delegate* delegate_; |
| 88 std::set<NotifierButton*> buttons_; | 90 std::set<NotifierButton*> buttons_; |
| 89 | 91 |
| 90 DISALLOW_COPY_AND_ASSIGN(NotifierSettingsView); | 92 DISALLOW_COPY_AND_ASSIGN(NotifierSettingsView); |
| 91 }; | 93 }; |
| 92 | 94 |
| 93 } // namespace message_center | 95 } // namespace message_center |
| 94 | 96 |
| 95 #endif // UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ | 97 #endif // UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_ |
| OLD | NEW |