| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Draws the view for the balloons. | 5 // Draws the view for the balloons. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_H_ | 7 #ifndef CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_H_ |
| 8 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_H_ | 8 #define CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/task.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/notifications/balloon.h" | 14 #include "chrome/browser/notifications/balloon.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "ui/gfx/path.h" | 17 #include "ui/gfx/path.h" |
| 18 #include "ui/gfx/point.h" | 18 #include "ui/gfx/point.h" |
| 19 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
| 20 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
| 21 #include "views/view.h" | 21 #include "views/view.h" |
| 22 | 22 |
| 23 namespace views { | 23 namespace views { |
| 24 class MenuButton; | 24 class MenuButton; |
| 25 class MouseEvent; | 25 class MouseEvent; |
| 26 class TextButton; | 26 class TextButton; |
| 27 class Widget; | 27 class Widget; |
| 28 } // namespace views | 28 } // namespace views |
| 29 | 29 |
| 30 class Notification; | 30 class Notification; |
| 31 | 31 |
| 32 namespace chromeos { | 32 namespace chromeos { |
| 33 | 33 |
| 34 class BalloonViewHost; | 34 class BalloonViewHost; |
| 35 class NotificationControlView; | 35 class NotificationControlView; |
| 36 | 36 |
| 37 // A balloon view is the UI component for a notification panel. | 37 // A balloon view is the UI component for a notification panel. |
| 38 class BalloonViewImpl : public BalloonView, | 38 class BalloonViewImpl : public BalloonView, |
| 39 public views::View, | 39 public views::View, |
| 40 public content::NotificationObserver { | 40 public content::NotificationObserver, |
| 41 public base::SupportsWeakPtr<BalloonViewImpl> { |
| 41 public: | 42 public: |
| 42 BalloonViewImpl(bool sticky, bool controls, bool web_ui); | 43 BalloonViewImpl(bool sticky, bool controls, bool web_ui); |
| 43 virtual ~BalloonViewImpl(); | 44 virtual ~BalloonViewImpl(); |
| 44 | 45 |
| 45 // views::View interface. | 46 // views::View interface. |
| 46 virtual void Layout(); | 47 virtual void Layout(); |
| 47 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); | 48 virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); |
| 48 | 49 |
| 49 // BalloonView interface. | 50 // BalloonView interface. |
| 50 virtual void Show(Balloon* balloon); | 51 virtual void Show(Balloon* balloon); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 98 |
| 98 // Returns the renderer's native view. | 99 // Returns the renderer's native view. |
| 99 gfx::NativeView GetParentNativeView(); | 100 gfx::NativeView GetParentNativeView(); |
| 100 | 101 |
| 101 // Non-owned pointer to the balloon which owns this object. | 102 // Non-owned pointer to the balloon which owns this object. |
| 102 Balloon* balloon_; | 103 Balloon* balloon_; |
| 103 | 104 |
| 104 // The renderer of the HTML contents. Pointer owned by the views hierarchy. | 105 // The renderer of the HTML contents. Pointer owned by the views hierarchy. |
| 105 BalloonViewHost* html_contents_; | 106 BalloonViewHost* html_contents_; |
| 106 | 107 |
| 107 // The following factory is used to call methods at a later time. | |
| 108 ScopedRunnableMethodFactory<BalloonViewImpl> method_factory_; | |
| 109 | |
| 110 // A widget for ControlView. | 108 // A widget for ControlView. |
| 111 scoped_ptr<views::Widget> control_view_host_; | 109 scoped_ptr<views::Widget> control_view_host_; |
| 112 | 110 |
| 113 bool stale_; | 111 bool stale_; |
| 114 content::NotificationRegistrar notification_registrar_; | 112 content::NotificationRegistrar notification_registrar_; |
| 115 // A sticky flag. A sticky notification cannot be dismissed by a user. | 113 // A sticky flag. A sticky notification cannot be dismissed by a user. |
| 116 bool sticky_; | 114 bool sticky_; |
| 117 // True if a notification should have info/option/dismiss label/buttons. | 115 // True if a notification should have info/option/dismiss label/buttons. |
| 118 bool controls_; | 116 bool controls_; |
| 119 // True if the notification is being closed. | 117 // True if the notification is being closed. |
| 120 bool closed_; | 118 bool closed_; |
| 121 // True to enable WebUI in the notification. | 119 // True to enable WebUI in the notification. |
| 122 bool web_ui_; | 120 bool web_ui_; |
| 123 | 121 |
| 124 DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl); | 122 DISALLOW_COPY_AND_ASSIGN(BalloonViewImpl); |
| 125 }; | 123 }; |
| 126 | 124 |
| 127 } // namespace chromeos | 125 } // namespace chromeos |
| 128 | 126 |
| 129 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_H_ | 127 #endif // CHROME_BROWSER_CHROMEOS_NOTIFICATIONS_BALLOON_VIEW_H_ |
| OLD | NEW |