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_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 | 7 |
8 #include <memory> | |
9 #include <vector> | |
10 | |
8 #include "base/macros.h" | 11 #include "base/macros.h" |
9 #include "base/memory/scoped_vector.h" | |
10 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
11 | 13 |
12 namespace gfx { | 14 namespace gfx { |
13 class ImageSkia; | 15 class ImageSkia; |
14 } | 16 } |
15 | 17 |
16 class StatusIcon; | 18 class StatusIcon; |
17 | 19 |
18 // Provides a cross-platform interface to the system's status tray, and exposes | 20 // Provides a cross-platform interface to the system's status tray, and exposes |
19 // APIs to add/remove icons to the tray and attach context menus. | 21 // APIs to add/remove icons to the tray and attach context menus. |
(...skipping 17 matching lines...) Expand all Loading... | |
37 // Creates a new StatusIcon. The StatusTray retains ownership of the | 39 // Creates a new StatusIcon. The StatusTray retains ownership of the |
38 // StatusIcon. Returns NULL if the StatusIcon could not be created. | 40 // StatusIcon. Returns NULL if the StatusIcon could not be created. |
39 StatusIcon* CreateStatusIcon(StatusIconType type, | 41 StatusIcon* CreateStatusIcon(StatusIconType type, |
40 const gfx::ImageSkia& image, | 42 const gfx::ImageSkia& image, |
41 const base::string16& tool_tip); | 43 const base::string16& tool_tip); |
42 | 44 |
43 // Removes |icon| from this status tray. | 45 // Removes |icon| from this status tray. |
44 void RemoveStatusIcon(StatusIcon* icon); | 46 void RemoveStatusIcon(StatusIcon* icon); |
45 | 47 |
46 protected: | 48 protected: |
47 typedef ScopedVector<StatusIcon> StatusIcons; | 49 typedef std::vector<std::unique_ptr<StatusIcon>> StatusIcons; |
Lei Zhang
2017/03/23 02:59:26
using
leonhsl(Using Gerrit)
2017/03/23 15:03:17
Done.
| |
48 | 50 |
49 StatusTray(); | 51 StatusTray(); |
50 | 52 |
51 // Factory method for creating a status icon for this platform. | 53 // Factory method for creating a status icon for this platform. |
52 virtual StatusIcon* CreatePlatformStatusIcon( | 54 virtual std::unique_ptr<StatusIcon> CreatePlatformStatusIcon( |
53 StatusIconType type, | 55 StatusIconType type, |
54 const gfx::ImageSkia& image, | 56 const gfx::ImageSkia& image, |
55 const base::string16& tool_tip) = 0; | 57 const base::string16& tool_tip) = 0; |
56 | 58 |
57 // Returns the list of active status icons so subclasses can operate on them. | 59 // Returns the list of active status icons so subclasses can operate on them. |
58 const StatusIcons& status_icons() const { return status_icons_; } | 60 const StatusIcons& status_icons() const { return status_icons_; } |
59 | 61 |
60 private: | 62 private: |
61 // List containing all active StatusIcons. The icons are owned by this | 63 // List containing all active StatusIcons. The icons are owned by this |
62 // StatusTray. | 64 // StatusTray. |
63 StatusIcons status_icons_; | 65 StatusIcons status_icons_; |
64 | 66 |
65 DISALLOW_COPY_AND_ASSIGN(StatusTray); | 67 DISALLOW_COPY_AND_ASSIGN(StatusTray); |
66 }; | 68 }; |
67 | 69 |
68 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_ | 70 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_ |
OLD | NEW |