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

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: review and gyp fixes. 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 // Exposed for testing.
50 bool TestIsIconContainedInView();
51 void TestSendClick();
52
53 views::MenuRunner* menu_runner() const {
54 return menu_runner_.get();
55 }
56
57 private:
58 class NotificationTrayButton;
stevenjb 2011/11/17 20:49:53 nit: class forward declarations should be at top o
Leandro GraciĆ” Gil 2011/11/17 20:56:20 In this case it's an internal class that needs to
59 typedef std::map<chromeos::BrowserView*, NotificationTrayButton*>
60 TrayButtonMap;
61
62 // Protected methods from StatusIcon.
63 virtual void UpdatePlatformContextMenu(ui::MenuModel* model) OVERRIDE;
64
65 void AddIconToBrowser(Browser* browser);
66 void Clicked();
67
68 // Notification registrar for listening to browser window events.
69 content::NotificationRegistrar registrar_;
70
71 // Map of tray icons for each browser window.
72 TrayButtonMap tray_button_map_;
73
74 // Notification balloon.
75 DesktopNotificationBalloon notification_;
76
77 // A copy of the last set image. Required to initialize the tray icon
78 // in any new browser windows.
79 scoped_ptr<SkBitmap> last_image_;
80
81 // The context menu for this icon (if any).
82 scoped_ptr<views::MenuModelAdapter> context_menu_adapter_;
83 scoped_ptr<views::MenuRunner> menu_runner_;
84
85 DISALLOW_COPY_AND_ASSIGN(StatusIconChromeOS);
86 };
87
88 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698