Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4113)

Unified Diff: chrome/browser/status_icons/status_icon.h

Issue 10408039: status_icons: Factor out status icon observer into its own header file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/status_icons/status_icon.h
diff --git a/chrome/browser/status_icons/status_icon.h b/chrome/browser/status_icons/status_icon.h
index 71a350b468dd25c0fdb921a2e1d15fc88af44a83..c40bf70f265c916fea5660f947637b45af647055 100644
--- a/chrome/browser/status_icons/status_icon.h
+++ b/chrome/browser/status_icons/status_icon.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_
#pragma once
+#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/string16.h"
@@ -16,6 +17,8 @@ namespace ui {
class MenuModel;
}
+class StatusIconObserver;
+
class StatusIcon {
public:
StatusIcon();
@@ -40,29 +43,15 @@ class StatusIcon {
// context menu. Passing NULL results in no menu at all.
void SetContextMenu(ui::MenuModel* menu);
- class Observer {
- public:
- virtual ~Observer() {}
-
- // Called when the user clicks on the system tray icon. Clicks that result
- // in the context menu being displayed will not be passed to this observer
- // (i.e. if there's a context menu set on this status icon, and the user
- // right clicks on the icon to display the context menu, OnClicked will not
- // be called).
- // Note: Chrome OS displays the context menu on left button clicks.
- // This will only be fired for this platform if no context menu is present.
- virtual void OnClicked() = 0;
- };
-
// Adds/Removes an observer for clicks on the status icon. If an observer is
// registered, then left clicks on the status icon will result in the observer
// being called, otherwise, both left and right clicks will display the
// context menu (if any).
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
+ void AddObserver(StatusIconObserver* observer);
+ void RemoveObserver(StatusIconObserver* observer);
// Returns true if there are registered click observers.
- bool HasObservers();
+ bool HasObservers() const;
// Dispatches a click event to the observers.
void DispatchClickEvent();
@@ -74,9 +63,11 @@ class StatusIcon {
virtual void UpdatePlatformContextMenu(ui::MenuModel* model) = 0;
private:
- ObserverList<Observer> observers_;
+ ObserverList<StatusIconObserver> observers_;
+
// Context menu, if any.
scoped_ptr<ui::MenuModel> context_menu_contents_;
+
DISALLOW_COPY_AND_ASSIGN(StatusIcon);
};
« no previous file with comments | « no previous file | chrome/browser/status_icons/status_icon.cc » ('j') | chrome/browser/status_icons/status_icon_observer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698