- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / status_icons / status_tray.h
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.
4
5 #ifndef CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_
6 #define CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_
7
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"
12
13 namespace gfx {
14 class ImageSkia;
15 }
16
17 class StatusIcon;
18
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
29   };
30
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();
35
36   virtual ~StatusTray();
37
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 string16& tool_tip);
43
44   // Removes |icon| from this status tray.
45   void RemoveStatusIcon(StatusIcon* icon);
46
47  protected:
48   typedef ScopedVector<StatusIcon> StatusIcons;
49
50   StatusTray();
51
52   // Factory method for creating a status icon for this platform.
53   virtual StatusIcon* CreatePlatformStatusIcon(StatusIconType type,
54                                                const gfx::ImageSkia& image,
55                                                const string16& tool_tip) = 0;
56
57   // Returns the list of active status icons so subclasses can operate on them.
58   const StatusIcons& status_icons() const { return status_icons_; }
59
60  private:
61   // List containing all active StatusIcons. The icons are owned by this
62   // StatusTray.
63   StatusIcons status_icons_;
64
65   DISALLOW_COPY_AND_ASSIGN(StatusTray);
66 };
67
68 #endif  // CHROME_BROWSER_STATUS_ICONS_STATUS_TRAY_H_