| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Sets the image associated with this status icon. | 24 // Sets the image associated with this status icon. |
| 25 virtual void SetImage(const SkBitmap& image) = 0; | 25 virtual void SetImage(const SkBitmap& image) = 0; |
| 26 | 26 |
| 27 // Sets the image associated with this status icon when pressed. | 27 // Sets the image associated with this status icon when pressed. |
| 28 virtual void SetPressedImage(const SkBitmap& image) = 0; | 28 virtual void SetPressedImage(const SkBitmap& image) = 0; |
| 29 | 29 |
| 30 // Sets the hover text for this status icon. | 30 // Sets the hover text for this status icon. |
| 31 virtual void SetToolTip(const string16& tool_tip) = 0; | 31 virtual void SetToolTip(const string16& tool_tip) = 0; |
| 32 | 32 |
| 33 // Displays a notification balloon with the specified contents. | 33 // Displays a notification balloon with the specified contents. |
| 34 virtual void DisplayBalloon(const string16& title, | 34 // Depending on the platform it might not appear by the icon tray. |
| 35 virtual void DisplayBalloon(const SkBitmap& icon, |
| 36 const string16& title, |
| 35 const string16& contents) = 0; | 37 const string16& contents) = 0; |
| 36 | 38 |
| 37 // Set the context menu for this icon. The icon takes ownership of the passed | 39 // Set the context menu for this icon. The icon takes ownership of the passed |
| 38 // context menu. Passing NULL results in no menu at all. | 40 // context menu. Passing NULL results in no menu at all. |
| 39 void SetContextMenu(ui::MenuModel* menu); | 41 void SetContextMenu(ui::MenuModel* menu); |
| 40 | 42 |
| 41 class Observer { | 43 class Observer { |
| 42 public: | 44 public: |
| 43 virtual ~Observer() {} | 45 virtual ~Observer() {} |
| 44 | 46 |
| 45 // Called when the user clicks on the system tray icon. Clicks that result | 47 // Called when the user clicks on the system tray icon. Clicks that result |
| 46 // in the context menu being displayed will not be passed to this observer | 48 // in the context menu being displayed will not be passed to this observer |
| 47 // (i.e. if there's a context menu set on this status icon, and the user | 49 // (i.e. if there's a context menu set on this status icon, and the user |
| 48 // right clicks on the icon to display the context menu, OnClicked will not | 50 // right clicks on the icon to display the context menu, OnClicked will not |
| 49 // be called). | 51 // be called). |
| 52 // Note: Chrome OS displays the context menu on left button clicks. |
| 53 // This will only be fired for this platform if no context menu is present. |
| 50 virtual void OnClicked() = 0; | 54 virtual void OnClicked() = 0; |
| 51 }; | 55 }; |
| 52 | 56 |
| 53 // Adds/Removes an observer for clicks on the status icon. If an observer is | 57 // Adds/Removes an observer for clicks on the status icon. If an observer is |
| 54 // registered, then left clicks on the status icon will result in the observer | 58 // registered, then left clicks on the status icon will result in the observer |
| 55 // being called, otherwise, both left and right clicks will display the | 59 // being called, otherwise, both left and right clicks will display the |
| 56 // context menu (if any). | 60 // context menu (if any). |
| 57 void AddObserver(Observer* observer); | 61 void AddObserver(Observer* observer); |
| 58 void RemoveObserver(Observer* observer); | 62 void RemoveObserver(Observer* observer); |
| 59 | 63 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 70 virtual void UpdatePlatformContextMenu(ui::MenuModel* model) = 0; | 74 virtual void UpdatePlatformContextMenu(ui::MenuModel* model) = 0; |
| 71 | 75 |
| 72 private: | 76 private: |
| 73 ObserverList<Observer> observers_; | 77 ObserverList<Observer> observers_; |
| 74 // Context menu, if any. | 78 // Context menu, if any. |
| 75 scoped_ptr<ui::MenuModel> context_menu_contents_; | 79 scoped_ptr<ui::MenuModel> context_menu_contents_; |
| 76 DISALLOW_COPY_AND_ASSIGN(StatusIcon); | 80 DISALLOW_COPY_AND_ASSIGN(StatusIcon); |
| 77 }; | 81 }; |
| 78 | 82 |
| 79 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_ | 83 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_ |
| OLD | NEW |