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 #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 "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 13 #include "chrome/browser/extensions/extension_function_dispatcher.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 "content/browser/renderer_host/render_view_host_delegate.h" | 15 #include "content/browser/renderer_host/render_view_host_delegate.h" |
16 #include "content/common/notification_observer.h" | 16 #include "content/common/notification_observer.h" |
17 #include "content/common/notification_registrar.h" | 17 #include "content/common/notification_registrar.h" |
18 | 18 |
19 class Balloon; | 19 class Balloon; |
20 class Browser; | 20 class Browser; |
| 21 class ExtensionMessageHandler; |
21 class Profile; | 22 class Profile; |
22 class SiteInstance; | 23 class SiteInstance; |
23 struct RendererPreferences; | 24 struct RendererPreferences; |
24 struct WebPreferences; | 25 struct WebPreferences; |
25 | 26 |
26 class BalloonHost : public RenderViewHostDelegate, | 27 class BalloonHost : public RenderViewHostDelegate, |
27 public RenderViewHostDelegate::View, | 28 public RenderViewHostDelegate::View, |
28 public ExtensionFunctionDispatcher::Delegate, | 29 public ExtensionFunctionDispatcher::Delegate, |
29 public NotificationObserver { | 30 public NotificationObserver { |
30 public: | 31 public: |
31 explicit BalloonHost(Balloon* balloon); | 32 explicit BalloonHost(Balloon* balloon); |
32 | 33 |
33 // Initialize the view. | 34 // Initialize the view. |
34 void Init(); | 35 void Init(); |
35 | 36 |
36 // Stops showing the balloon. | 37 // Stops showing the balloon. |
37 void Shutdown(); | 38 void Shutdown(); |
38 | 39 |
39 // ExtensionFunctionDispatcher::Delegate overrides. | 40 // ExtensionFunctionDispatcher::Delegate overrides. |
40 virtual Browser* GetBrowser(); | 41 virtual Browser* GetBrowser(); |
41 virtual gfx::NativeView GetNativeViewOfHost(); | 42 virtual gfx::NativeView GetNativeViewOfHost(); |
42 virtual TabContents* associated_tab_contents() const; | 43 virtual TabContents* associated_tab_contents() const; |
43 | 44 |
44 RenderViewHost* render_view_host() const { return render_view_host_; } | 45 RenderViewHost* render_view_host() const { return render_view_host_; } |
45 | 46 |
46 const string16& GetSource() const; | 47 const string16& GetSource() const; |
47 | 48 |
48 // RenderViewHostDelegate overrides. | 49 // RenderViewHostDelegate overrides. |
| 50 virtual bool OnMessageReceived(const IPC::Message& message); |
49 virtual WebPreferences GetWebkitPrefs(); | 51 virtual WebPreferences GetWebkitPrefs(); |
50 virtual SiteInstance* GetSiteInstance() const; | 52 virtual SiteInstance* GetSiteInstance() const; |
51 virtual Profile* GetProfile() const; | 53 virtual Profile* GetProfile() const; |
52 virtual const GURL& GetURL() const; | 54 virtual const GURL& GetURL() const; |
53 virtual void Close(RenderViewHost* render_view_host); | 55 virtual void Close(RenderViewHost* render_view_host); |
54 virtual void RenderViewCreated(RenderViewHost* render_view_host); | 56 virtual void RenderViewCreated(RenderViewHost* render_view_host); |
55 virtual void RenderViewReady(RenderViewHost* render_view_host); | 57 virtual void RenderViewReady(RenderViewHost* render_view_host); |
56 virtual void RenderViewGone(RenderViewHost* render_view_host, | 58 virtual void RenderViewGone(RenderViewHost* render_view_host, |
57 base::TerminationStatus status, | 59 base::TerminationStatus status, |
58 int error_code); | 60 int error_code); |
59 virtual void UpdateTitle(RenderViewHost* render_view_host, | 61 virtual void UpdateTitle(RenderViewHost* render_view_host, |
60 int32 page_id, const std::wstring& title) {} | 62 int32 page_id, const std::wstring& title) {} |
61 virtual int GetBrowserWindowID() const; | 63 virtual int GetBrowserWindowID() const; |
62 virtual ViewType::Type GetRenderViewType() const; | 64 virtual ViewType::Type GetRenderViewType() const; |
63 virtual RenderViewHostDelegate::View* GetViewDelegate(); | 65 virtual RenderViewHostDelegate::View* GetViewDelegate(); |
64 virtual void ProcessWebUIMessage( | |
65 const ExtensionHostMsg_DomMessage_Params& params); | |
66 | 66 |
67 // NotificationObserver override. | 67 // NotificationObserver override. |
68 virtual void Observe(NotificationType type, | 68 virtual void Observe(NotificationType type, |
69 const NotificationSource& source, | 69 const NotificationSource& source, |
70 const NotificationDetails& details); | 70 const NotificationDetails& details); |
71 | 71 |
72 | 72 |
73 // RenderViewHostDelegate::View methods. Only the ones for opening new | 73 // RenderViewHostDelegate::View methods. Only the ones for opening new |
74 // windows are currently implemented. | 74 // windows are currently implemented. |
75 virtual void CreateNewWindow( | 75 virtual void CreateNewWindow( |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 RenderViewHostDelegateViewHelper delegate_view_helper_; | 153 RenderViewHostDelegateViewHelper delegate_view_helper_; |
154 | 154 |
155 // Handles requests to extension APIs. Will only be non-NULL if we are | 155 // Handles requests to extension APIs. Will only be non-NULL if we are |
156 // rendering a page from an extension. | 156 // rendering a page from an extension. |
157 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 157 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
158 | 158 |
159 // A flag to enable Web UI. | 159 // A flag to enable Web UI. |
160 bool enable_web_ui_; | 160 bool enable_web_ui_; |
161 | 161 |
162 NotificationRegistrar registrar_; | 162 NotificationRegistrar registrar_; |
| 163 |
| 164 // Handles extension IPCs. |
| 165 scoped_ptr<ExtensionMessageHandler> extension_message_handler_; |
163 }; | 166 }; |
164 | 167 |
165 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_HOST_H_ | 168 #endif // CHROME_BROWSER_NOTIFICATIONS_BALLOON_HOST_H_ |
OLD | NEW |