Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / status_icons / status_tray.h
blobbd160d3c77721c5fd0a59d4f940bb775b8cd4056
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_
6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_
8 #include "base/basictypes.h"
9 #include "base/gtest_prod_util.h"
10 #include "base/memory/scoped_vector.h"
11 #include "base/strings/string16.h"
13 namespace gfx {
14 class ImageSkia;
17 class StatusIcon;
19 // Provides a cross-platform interface to the system's status tray, and exposes
20 // APIs to add/remove icons to the tray and attach context menus.
21 class StatusTray {
22 public:
23 enum StatusIconType {
24 NOTIFICATION_TRAY_ICON = 0,
25 MEDIA_STREAM_CAPTURE_ICON,
26 BACKGROUND_MODE_ICON,
27 OTHER_ICON,
28 NAMED_STATUS_ICON_COUNT
31 // Static factory method that is implemented separately for each platform to
32 // produce the appropriate platform-specific instance. Returns NULL if this
33 // platform does not support status icons.
34 static StatusTray* Create();
36 virtual ~StatusTray();
38 // Creates a new StatusIcon. The StatusTray retains ownership of the
39 // StatusIcon. Returns NULL if the StatusIcon could not be created.
40 StatusIcon* CreateStatusIcon(StatusIconType type,
41 const gfx::ImageSkia& image,
42 const base::string16& tool_tip);
44 // Removes |icon| from this status tray.
45 void RemoveStatusIcon(StatusIcon* icon);
47 protected:
48 typedef ScopedVector<StatusIcon> StatusIcons;
50 StatusTray();
52 // Factory method for creating a status icon for this platform.
53 virtual StatusIcon* CreatePlatformStatusIcon(
54 StatusIconType type,
55 const gfx::ImageSkia& image,
56 const base::string16& tool_tip) = 0;
58 // Returns the list of active status icons so subclasses can operate on them.
59 const StatusIcons& status_icons() const { return status_icons_; }
61 private:
62 // List containing all active StatusIcons. The icons are owned by this
63 // StatusTray.
64 StatusIcons status_icons_;
66 DISALLOW_COPY_AND_ASSIGN(StatusTray);
69 #endif // CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_