Chromium Code Reviews| Index: chrome/browser/ui/views/status_icons/status_icon_chromeos.h |
| diff --git a/chrome/browser/ui/views/status_icons/status_icon_chromeos.h b/chrome/browser/ui/views/status_icons/status_icon_chromeos.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9f91655b543a4938885fb45c5d97730bbc6ba02c |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/status_icons/status_icon_chromeos.h |
| @@ -0,0 +1,88 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_CHROMEOS_H_ |
| +#define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_CHROMEOS_H_ |
| +#pragma once |
| + |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/status_icons/desktop_notification_balloon.h" |
| +#include "chrome/browser/status_icons/status_icon.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| + |
| +#include <map> |
| + |
| +namespace chromeos { |
| +class BrowserView; |
| +} |
| + |
| +namespace views { |
| +class MenuModelAdapter; |
| +class MenuRunner; |
| +} |
| + |
| +class Browser; |
| +class SkBitmap; |
| + |
| +class StatusIconChromeOS : public StatusIcon, |
| + public content::NotificationObserver { |
| + public: |
| + StatusIconChromeOS(); |
| + virtual ~StatusIconChromeOS(); |
| + |
| + // Public methods from StatusIcon. |
| + virtual void SetImage(const SkBitmap& image) OVERRIDE; |
| + virtual void SetPressedImage(const SkBitmap& image) OVERRIDE; |
| + virtual void SetToolTip(const string16& tool_tip) OVERRIDE; |
| + virtual void DisplayBalloon(const SkBitmap& icon, |
| + const string16& title, |
| + const string16& contents) OVERRIDE; |
| + |
| + // Methods from content::NotificationObserver. |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + // Exposed for testing. |
| + bool TestIsIconContainedInView(); |
| + void TestSendClick(); |
| + |
| + views::MenuRunner* menu_runner() const { |
| + return menu_runner_.get(); |
| + } |
| + |
| + private: |
| + 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
|
| + typedef std::map<chromeos::BrowserView*, NotificationTrayButton*> |
| + TrayButtonMap; |
| + |
| + // Protected methods from StatusIcon. |
| + virtual void UpdatePlatformContextMenu(ui::MenuModel* model) OVERRIDE; |
| + |
| + void AddIconToBrowser(Browser* browser); |
| + void Clicked(); |
| + |
| + // Notification registrar for listening to browser window events. |
| + content::NotificationRegistrar registrar_; |
| + |
| + // Map of tray icons for each browser window. |
| + TrayButtonMap tray_button_map_; |
| + |
| + // Notification balloon. |
| + DesktopNotificationBalloon notification_; |
| + |
| + // A copy of the last set image. Required to initialize the tray icon |
| + // in any new browser windows. |
| + scoped_ptr<SkBitmap> last_image_; |
| + |
| + // The context menu for this icon (if any). |
| + scoped_ptr<views::MenuModelAdapter> context_menu_adapter_; |
| + scoped_ptr<views::MenuRunner> menu_runner_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(StatusIconChromeOS); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_CHROMEOS_H_ |