Revert 187797 "Added tests for page launcher extensions in the a..."
[chromium-blink-merge.git] / ui / message_center / notifier_settings.h
blobf62e964a3ac428e5daeb2a82ab00519c44bad632
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_NOTIFIER_SETTINGS_H_
6 #define UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_
8 #include <string>
10 #include "base/string16.h"
11 #include "googleurl/src/gurl.h"
12 #include "ui/gfx/image/image.h"
13 #include "ui/message_center/message_center_export.h"
15 namespace message_center {
17 class NotifierSettingsDelegate;
18 class NotifierSettingsProvider;
20 // Brings up the settings dialog and returns a weak reference to the delegate,
21 // which is typically the view. If the dialog already exists, it is brought to
22 // the front, otherwise it is created.
23 MESSAGE_CENTER_EXPORT NotifierSettingsDelegate* ShowSettings(
24 NotifierSettingsProvider* provider,
25 gfx::NativeView context);
27 // The struct to hold the information of notifiers. The information will be
28 // used by NotifierSettingsView.
29 struct MESSAGE_CENTER_EXPORT Notifier {
30 enum NotifierType {
31 APPLICATION,
32 WEB_PAGE,
35 // Constructor for APPLICATION type.
36 Notifier(const std::string& id, const string16& name, bool enabled);
38 // Constructor for WEB_PAGE type.
39 Notifier(const GURL& url, const string16& name, bool enabled);
41 ~Notifier();
43 // The identifier of the app notifier. Empty if it's URL_PATTERN.
44 std::string id;
46 // The URL pattern of the notifer.
47 GURL url;
49 // The human-readable name of the notifier such like the extension name.
50 // It can be empty.
51 string16 name;
53 // True if the source is allowed to send notifications. True is default.
54 bool enabled;
56 // The type of notifier: Chrome app or URL pattern.
57 NotifierType type;
59 // The icon image of the notifier. The extension icon or favicon.
60 gfx::Image icon;
62 private:
63 DISALLOW_COPY_AND_ASSIGN(Notifier);
66 // A class used by NotifierSettingsView to integrate with a setting system
67 // for the clients of this module.
68 class MESSAGE_CENTER_EXPORT NotifierSettingsProvider {
69 public:
70 // Collects the current notifier list and fills to |notifiers|. Caller takes
71 // the ownership of the elements of |notifiers|.
72 virtual void GetNotifierList(std::vector<Notifier*>* notifiers) = 0;
74 // Called when the |enabled| for the |notifier| has been changed by user
75 // operation.
76 virtual void SetNotifierEnabled(const Notifier& notifier, bool enabled) = 0;
78 // Called when the settings window is closed.
79 virtual void OnNotifierSettingsClosing() = 0;
82 // A delegate class implemented by the view of the NotifierSettings to get
83 // notified when the controller has changed data.
84 class MESSAGE_CENTER_EXPORT NotifierSettingsDelegate {
85 public:
86 // Called when an icon in the controller has been updated.
87 virtual void UpdateIconImage(const std::string& id,
88 const gfx::Image& icon) = 0;
90 // Called when the controller detects that a favicon has changed.
91 virtual void UpdateFavicon(const GURL& url, const gfx::Image& icon) = 0;
94 } // namespace message_center
96 #endif // UI_MESSAGE_CENTER_NOTIFIER_SETTINGS_H_