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

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

Issue 10156004: status_icons: Fold RemoveAllIcons() into StatusTray dtor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: atwilson review Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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
1 // Copyright (c) 2010 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_TRAY_H_ 5 #ifndef CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_
6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_ 6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 13
14 class StatusIcon; 14 class StatusIcon;
15 15
16 // Provides a cross-platform interface to the system's status tray, and exposes 16 // Provides a cross-platform interface to the system's status tray, and exposes
17 // APIs to add/remove icons to the tray and attach context menus. 17 // APIs to add/remove icons to the tray and attach context menus.
18 class StatusTray { 18 class StatusTray {
19 public: 19 public:
20 // Static factory method that is implemented separately for each platform to 20 // Static factory method that is implemented separately for each platform to
21 // produce the appropriate platform-specific instance. Returns NULL if this 21 // produce the appropriate platform-specific instance. Returns NULL if this
22 // platform does not support status icons. 22 // platform does not support status icons.
23 static StatusTray* Create(); 23 static StatusTray* Create();
24 24
25 virtual ~StatusTray(); 25 virtual ~StatusTray();
26 26
27 // Creates a new StatusIcon. The StatusTray retains ownership of the 27 // Creates a new StatusIcon. The StatusTray retains ownership of the
28 // StatusIcon. Returns NULL if the StatusIcon could not be created. 28 // StatusIcon. Returns NULL if the StatusIcon could not be created.
29 StatusIcon* CreateStatusIcon(); 29 StatusIcon* CreateStatusIcon();
30 30
31 // Removes the current status icon associated with this identifier, if any. 31 // Removes |icon| from this status tray.
32 void RemoveStatusIcon(StatusIcon* icon); 32 void RemoveStatusIcon(StatusIcon* icon);
33 33
34 protected: 34 protected:
35 typedef std::vector<StatusIcon*> StatusIconList;
36
35 StatusTray(); 37 StatusTray();
38
36 // Factory method for creating a status icon for this platform. 39 // Factory method for creating a status icon for this platform.
37 virtual StatusIcon* CreatePlatformStatusIcon() = 0; 40 virtual StatusIcon* CreatePlatformStatusIcon() = 0;
38 41
39 // Removes all StatusIcons (used by derived classes to clean up in case they
40 // track external state used by the StatusIcons).
41 void RemoveAllIcons();
42
43 typedef std::vector<StatusIcon*> StatusIconList;
44 // Returns the list of active status icons so subclasses can operate on them. 42 // Returns the list of active status icons so subclasses can operate on them.
45 const StatusIconList& status_icons() { return status_icons_; } 43 const StatusIconList& status_icons() { return status_icons_; }
46 44
47 private: 45 private:
48 FRIEND_TEST_ALL_PREFIXES(StatusTrayTest, CreateRemove); 46 FRIEND_TEST_ALL_PREFIXES(StatusTrayTest, CreateRemove);
49 47
50 // List containing all active StatusIcons. 48 // List containing all active StatusIcons.
51 StatusIconList status_icons_; 49 StatusIconList status_icons_;
52 50
53 DISALLOW_COPY_AND_ASSIGN(StatusTray); 51 DISALLOW_COPY_AND_ASSIGN(StatusTray);
54 }; 52 };
55 53
56 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_ 54 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/status_icons/status_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698