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

Side by Side Diff: chrome/browser/ui/views/status_icons/status_icon_chromeos.h

Issue 8476003: Implement the status tray/icon API for ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disabling the unit test for non-chromeos builds. Created 9 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_UI_VIEWS_STATUS_ICONS_STATUS_ICON_CHROMEOS_H_
6 #define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_CHROMEOS_H_
7 #pragma once
8
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/status_icons/desktop_notification_balloon.h"
12 #include "chrome/browser/status_icons/status_icon.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15
16 #include <map>
17
18 namespace chromeos {
19 class BrowserView;
20 }
21
22 namespace views {
23 class MenuModelAdapter;
24 class MenuRunner;
25 }
26
27 class Browser;
28 class SkBitmap;
29
30 class StatusIconChromeOS : public StatusIcon,
31 public content::NotificationObserver {
32 public:
33 StatusIconChromeOS();
34 virtual ~StatusIconChromeOS();
35
36 // Public methods from StatusIcon.
37 virtual void SetImage(const SkBitmap& image) OVERRIDE;
38 virtual void SetPressedImage(const SkBitmap& image) OVERRIDE;
39 virtual void SetToolTip(const string16& tool_tip) OVERRIDE;
40 virtual void DisplayBalloon(const SkBitmap& icon,
41 const string16& title,
42 const string16& contents) OVERRIDE;
43
44 // Methods from content::NotificationObserver.
45 virtual void Observe(int type,
46 const content::NotificationSource& source,
47 const content::NotificationDetails& details) OVERRIDE;
48
49 // Called by the NotificationTrayButton and exposed for testing.
50 void Clicked();
stevenjb 2011/11/14 19:03:22 nit: name something like TestClicked() so that the
Leandro Graciá Gil 2011/11/15 22:23:31 Done.
51
52 views::MenuRunner* menu_runner() const {
53 return menu_runner_.get();
54 }
55
56 private:
57 // Protected methods from StatusIcon.
58 virtual void UpdatePlatformContextMenu(ui::MenuModel* model) OVERRIDE;
59
60 void AddIconToBrowser(Browser* browser);
61
62 class NotificationTrayButton;
63 typedef std::map<chromeos::BrowserView*, NotificationTrayButton*>
64 TrayButtonMap;
stevenjb 2011/11/14 19:03:22 nit: typedef at top of section
Leandro Graciá Gil 2011/11/15 22:23:31 Done.
65
66 // Notification registrar for listening to browser window events.
67 content::NotificationRegistrar registrar_;
68
69 // Map of tray icons for each browser window.
70 TrayButtonMap tray_button_map_;
71
72 // Notification balloon.
73 DesktopNotificationBalloon notification_;
74
75 // A copy of the last set image. Required to initialize the tray icon
76 // in any new browser windows.
77 scoped_ptr<SkBitmap> last_image_;
78
79 // The context menu for this icon (if any).
80 scoped_ptr<views::MenuModelAdapter> context_menu_adapter_;
81 scoped_ptr<views::MenuRunner> menu_runner_;
82
83 DISALLOW_COPY_AND_ASSIGN(StatusIconChromeOS);
84 };
85
86 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698