OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_ | 5 #ifndef CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_ |
6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_ | 6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "chrome/browser/status_icons/status_icon_menu_model.h" | 12 #include "chrome/browser/status_icons/status_icon_menu_model.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 class ImageSkia; | 15 class ImageSkia; |
16 } | 16 } |
17 | 17 |
18 namespace message_center { | |
19 struct NotifierId; | |
20 } | |
21 | |
18 class StatusIconObserver; | 22 class StatusIconObserver; |
19 | 23 |
20 class StatusIcon { | 24 class StatusIcon { |
21 public: | 25 public: |
22 StatusIcon(); | 26 StatusIcon(); |
23 virtual ~StatusIcon(); | 27 virtual ~StatusIcon(); |
24 | 28 |
25 // Sets the image associated with this status icon. | 29 // Sets the image associated with this status icon. |
26 virtual void SetImage(const gfx::ImageSkia& image) = 0; | 30 virtual void SetImage(const gfx::ImageSkia& image) = 0; |
27 | 31 |
28 // Sets the hover text for this status icon. This is also used as the label | 32 // Sets the hover text for this status icon. This is also used as the label |
29 // for the menu item which is created as a replacement for the status icon | 33 // for the menu item which is created as a replacement for the status icon |
30 // click action on platforms that do not support custom click actions for the | 34 // click action on platforms that do not support custom click actions for the |
31 // status icon (e.g. Ubuntu Unity). | 35 // status icon (e.g. Ubuntu Unity). |
32 virtual void SetToolTip(const base::string16& tool_tip) = 0; | 36 virtual void SetToolTip(const base::string16& tool_tip) = 0; |
33 | 37 |
34 // Displays a notification balloon with the specified contents. | 38 // Displays a notification balloon with the specified contents. |
35 // Depending on the platform it might not appear by the icon tray. | 39 // Depending on the platform it might not appear by the icon tray. |
36 virtual void DisplayBalloon(const gfx::ImageSkia& icon, | 40 virtual void DisplayBalloon( |
37 const base::string16& title, | 41 const gfx::ImageSkia& icon, |
38 const base::string16& contents) = 0; | 42 const base::string16& title, |
43 const base::string16& contents, | |
44 const message_center::NotifierId& notifier_id) = 0; | |
Peter Beverloo
2015/10/10 16:35:27
I'm a bit torn on what type to use here.
Yes, mc:
johnme
2015/10/12 14:34:09
Since this is a method for displaying "a notificat
| |
39 | 45 |
40 // Set the context menu for this icon. The icon takes ownership of the passed | 46 // Set the context menu for this icon. The icon takes ownership of the passed |
41 // context menu. Passing NULL results in no menu at all. | 47 // context menu. Passing NULL results in no menu at all. |
42 void SetContextMenu(scoped_ptr<StatusIconMenuModel> menu); | 48 void SetContextMenu(scoped_ptr<StatusIconMenuModel> menu); |
43 | 49 |
44 // Adds/Removes an observer for clicks on the status icon. If an observer is | 50 // Adds/Removes an observer for clicks on the status icon. If an observer is |
45 // registered, then left clicks on the status icon will result in the observer | 51 // registered, then left clicks on the status icon will result in the observer |
46 // being called, otherwise, both left and right clicks will display the | 52 // being called, otherwise, both left and right clicks will display the |
47 // context menu (if any). | 53 // context menu (if any). |
48 void AddObserver(StatusIconObserver* observer); | 54 void AddObserver(StatusIconObserver* observer); |
(...skipping 24 matching lines...) Expand all Loading... | |
73 private: | 79 private: |
74 base::ObserverList<StatusIconObserver> observers_; | 80 base::ObserverList<StatusIconObserver> observers_; |
75 | 81 |
76 // Context menu, if any. | 82 // Context menu, if any. |
77 scoped_ptr<StatusIconMenuModel> context_menu_contents_; | 83 scoped_ptr<StatusIconMenuModel> context_menu_contents_; |
78 | 84 |
79 DISALLOW_COPY_AND_ASSIGN(StatusIcon); | 85 DISALLOW_COPY_AND_ASSIGN(StatusIcon); |
80 }; | 86 }; |
81 | 87 |
82 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_ | 88 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_ |
OLD | NEW |