| OLD | NEW | 
|---|
|  | (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 class StatusAreaButton; |  | 
| 30 |  | 
| 31 class StatusIconChromeOS : public StatusIcon, |  | 
| 32                            public content::NotificationObserver { |  | 
| 33  public: |  | 
| 34   StatusIconChromeOS(); |  | 
| 35   virtual ~StatusIconChromeOS(); |  | 
| 36 |  | 
| 37   // Public methods from StatusIcon. |  | 
| 38   virtual void SetImage(const SkBitmap& image) OVERRIDE; |  | 
| 39   virtual void SetPressedImage(const SkBitmap& image) OVERRIDE; |  | 
| 40   virtual void SetToolTip(const string16& tool_tip) OVERRIDE; |  | 
| 41   virtual void DisplayBalloon(const SkBitmap& icon, |  | 
| 42                               const string16& title, |  | 
| 43                               const string16& contents) OVERRIDE; |  | 
| 44 |  | 
| 45   // Methods from content::NotificationObserver. |  | 
| 46   virtual void Observe(int type, |  | 
| 47                        const content::NotificationSource& source, |  | 
| 48                        const content::NotificationDetails& details) OVERRIDE; |  | 
| 49 |  | 
| 50   // Exposed for testing. |  | 
| 51   StatusAreaButton* GetButtonForBrowser(Browser* browser); |  | 
| 52 |  | 
| 53   views::MenuRunner* menu_runner() const { |  | 
| 54     return menu_runner_.get(); |  | 
| 55   } |  | 
| 56 |  | 
| 57  private: |  | 
| 58   class NotificationTrayButton; |  | 
| 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_ |  | 
| OLD | NEW | 
|---|