OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_HOST_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_BALLOON_HOST_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_BALLOON_HOST_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_BALLOON_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 12 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
13 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 13 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
14 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" | 14 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
| 15 #include "chrome/common/notification_registrar.h" |
15 | 16 |
16 class Balloon; | 17 class Balloon; |
17 class Browser; | 18 class Browser; |
18 class Profile; | 19 class Profile; |
19 class SiteInstance; | 20 class SiteInstance; |
20 struct RendererPreferences; | 21 struct RendererPreferences; |
21 struct WebPreferences; | 22 struct WebPreferences; |
22 | 23 |
23 class BalloonHost : public RenderViewHostDelegate, | 24 class BalloonHost : public RenderViewHostDelegate, |
24 public RenderViewHostDelegate::View, | 25 public RenderViewHostDelegate::View, |
25 public ExtensionFunctionDispatcher::Delegate { | 26 public ExtensionFunctionDispatcher::Delegate, |
| 27 public NotificationObserver { |
26 public: | 28 public: |
27 explicit BalloonHost(Balloon* balloon); | 29 explicit BalloonHost(Balloon* balloon); |
28 | 30 |
29 // Initialize the view. | 31 // Initialize the view. |
30 void Init(); | 32 void Init(); |
31 | 33 |
32 // Stops showing the balloon. | 34 // Stops showing the balloon. |
33 void Shutdown(); | 35 void Shutdown(); |
34 | 36 |
35 // ExtensionFunctionDispatcher::Delegate overrides. | 37 // ExtensionFunctionDispatcher::Delegate overrides. |
(...skipping 16 matching lines...) Expand all Loading... |
52 virtual void RenderViewGone(RenderViewHost* render_view_host, | 54 virtual void RenderViewGone(RenderViewHost* render_view_host, |
53 base::TerminationStatus status, | 55 base::TerminationStatus status, |
54 int error_code); | 56 int error_code); |
55 virtual void UpdateTitle(RenderViewHost* render_view_host, | 57 virtual void UpdateTitle(RenderViewHost* render_view_host, |
56 int32 page_id, const std::wstring& title) {} | 58 int32 page_id, const std::wstring& title) {} |
57 virtual int GetBrowserWindowID() const; | 59 virtual int GetBrowserWindowID() const; |
58 virtual ViewType::Type GetRenderViewType() const; | 60 virtual ViewType::Type GetRenderViewType() const; |
59 virtual RenderViewHostDelegate::View* GetViewDelegate(); | 61 virtual RenderViewHostDelegate::View* GetViewDelegate(); |
60 virtual void ProcessDOMUIMessage(const ViewHostMsg_DomMessage_Params& params); | 62 virtual void ProcessDOMUIMessage(const ViewHostMsg_DomMessage_Params& params); |
61 | 63 |
| 64 // NotificationObserver override. |
| 65 virtual void Observe(NotificationType type, |
| 66 const NotificationSource& source, |
| 67 const NotificationDetails& details); |
| 68 |
| 69 |
62 // RenderViewHostDelegate::View methods. Only the ones for opening new | 70 // RenderViewHostDelegate::View methods. Only the ones for opening new |
63 // windows are currently implemented. | 71 // windows are currently implemented. |
64 virtual void CreateNewWindow( | 72 virtual void CreateNewWindow( |
65 int route_id, | 73 int route_id, |
66 WindowContainerType window_container_type, | 74 WindowContainerType window_container_type, |
67 const string16& frame_name); | 75 const string16& frame_name); |
68 virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type) {} | 76 virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type) {} |
69 virtual void CreateNewFullscreenWidget( | 77 virtual void CreateNewFullscreenWidget( |
70 int route_id, WebKit::WebPopupType popup_type) {} | 78 int route_id, WebKit::WebPopupType popup_type) {} |
71 virtual void ShowCreatedWindow(int route_id, | 79 virtual void ShowCreatedWindow(int route_id, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 virtual void UpdatePreferredSize(const gfx::Size& pref_size); | 113 virtual void UpdatePreferredSize(const gfx::Size& pref_size); |
106 virtual RendererPreferences GetRendererPrefs(Profile* profile) const; | 114 virtual RendererPreferences GetRendererPrefs(Profile* profile) const; |
107 | 115 |
108 // Enable DOM UI. This has to be called before renderer is created. | 116 // Enable DOM UI. This has to be called before renderer is created. |
109 void EnableDOMUI(); | 117 void EnableDOMUI(); |
110 | 118 |
111 virtual void UpdateInspectorSetting(const std::string& key, | 119 virtual void UpdateInspectorSetting(const std::string& key, |
112 const std::string& value); | 120 const std::string& value); |
113 virtual void ClearInspectorSettings(); | 121 virtual void ClearInspectorSettings(); |
114 | 122 |
115 // Called when the render view has painted. | |
116 void RenderWidgetHostDidPaint(); | |
117 | |
118 protected: | 123 protected: |
119 virtual ~BalloonHost(); | 124 virtual ~BalloonHost(); |
120 // Must override in platform specific implementations. | 125 // Must override in platform specific implementations. |
121 virtual void InitRenderWidgetHostView() = 0; | 126 virtual void InitRenderWidgetHostView() = 0; |
122 virtual RenderWidgetHostView* render_widget_host_view() const = 0; | 127 virtual RenderWidgetHostView* render_widget_host_view() const = 0; |
123 | 128 |
124 // Owned pointer to the host for the renderer process. | 129 // Owned pointer to the host for the renderer process. |
125 RenderViewHost* render_view_host_; | 130 RenderViewHost* render_view_host_; |
126 | 131 |
127 private: | 132 private: |
(...skipping 17 matching lines...) Expand all Loading... |
145 | 150 |
146 // Common implementations of some RenderViewHostDelegate::View methods. | 151 // Common implementations of some RenderViewHostDelegate::View methods. |
147 RenderViewHostDelegateViewHelper delegate_view_helper_; | 152 RenderViewHostDelegateViewHelper delegate_view_helper_; |
148 | 153 |
149 // Handles requests to extension APIs. Will only be non-NULL if we are | 154 // Handles requests to extension APIs. Will only be non-NULL if we are |
150 // rendering a page from an extension. | 155 // rendering a page from an extension. |
151 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 156 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
152 | 157 |
153 // A flag to enable DOM UI. | 158 // A flag to enable DOM UI. |
154 bool enable_dom_ui_; | 159 bool enable_dom_ui_; |
| 160 |
| 161 NotificationRegistrar registrar_; |
155 }; | 162 }; |
156 | 163 |
157 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_HOST_H_ | 164 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_HOST_H_ |
OLD | NEW |