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

Side by Side Diff: chrome/browser/status_icons/status_tray.h

Issue 661454: Initial implementation of status tray functionality (mac-only, currently). (Closed)
Patch Set: more changes per review feedback Created 10 years, 9 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/status_icons/status_icon.h ('k') | chrome/browser/status_icons/status_tray.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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.
4
5 #ifndef CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_
6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_
7
8 #include "base/hash_tables.h"
9 #include "base/scoped_ptr.h"
10
11 class StatusIcon;
12
13 // Factory interface for creating icons to improve testability.
14 class StatusIconFactory {
15 public:
16 virtual StatusIcon* CreateIcon() = 0;
17 virtual ~StatusIconFactory() { }
18 };
19
20 // Provides a cross-platform interface to the system's status tray, and exposes
21 // APIs to add/remove icons to the tray and attach context menus.
22 class StatusTray {
23 public:
24 // Takes ownership of |factory|.
25 explicit StatusTray(StatusIconFactory* factory);
26 ~StatusTray();
27
28 // Gets the current status icon associated with this identifier, or creates
29 // a new one if none exists. The StatusTray retains ownership of the
30 // StatusIcon. Returns NULL if the status tray icon could not be created.
31 StatusIcon* GetStatusIcon(const string16& identifier);
32
33 // Removes the current status icon associated with this identifier, if any.
34 void RemoveStatusIcon(const string16& identifier);
35
36 private:
37 typedef base::hash_map<string16, StatusIcon*> StatusIconMap;
38 // Map containing all active StatusIcons.
39 // Key: String identifiers (passed in to GetStatusIcon)
40 // Value: The StatusIcon associated with that identifier (strong pointer -
41 // StatusIcons are freed when the StatusTray destructor is called).
42 StatusIconMap status_icons_;
43
44 scoped_ptr<StatusIconFactory> factory_;
45 };
46
47 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_
OLDNEW
« no previous file with comments | « chrome/browser/status_icons/status_icon.h ('k') | chrome/browser/status_icons/status_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698