OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_GUEST_ROLE_H_ |
| 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_GUEST_ROLE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "content/browser/browser_plugin/browser_plugin_host_guest_delegate.h" |
| 12 #include "content/browser/browser_plugin/browser_plugin_host_role.h" |
| 13 #include "content/public/browser/render_view_host_observer.h" |
| 14 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/web_contents_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "ipc/ipc_channel_handle.h" |
| 18 #include "ipc/ipc_sync_message.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 20 #include "ui/surface/transport_dib.h" |
| 21 #include "webkit/glue/webcursor.h" |
| 22 |
| 23 namespace gfx { |
| 24 class Size; |
| 25 } |
| 26 |
| 27 struct BrowserPluginHostMsg_ResizeGuest_Params; |
| 28 struct ViewHostMsg_UpdateRect_Params; |
| 29 |
| 30 namespace content { |
| 31 |
| 32 class RenderViewHost; |
| 33 |
| 34 // Role for browser plugin guest. It overrides different WebContents messages |
| 35 // that require special treatment for a WebContents to act as a guest. All |
| 36 // functionalities are handled by its delegate, this class exists so we have |
| 37 // separation of messages it handles, which can be move to a message filter (IPC |
| 38 // thread) for future optimization. |
| 39 class BrowserPluginHostGuestRole : public BrowserPluginHostRole, |
| 40 public RenderViewHostObserver, |
| 41 public WebContentsObserver { |
| 42 public: |
| 43 BrowserPluginHostGuestRole(int instance_id, WebContentsImpl* web_contents, |
| 44 RenderViewHost* render_view_host); |
| 45 virtual ~BrowserPluginHostGuestRole(); |
| 46 BrowserPluginHostGuestDelegate* GetDelegate(); |
| 47 |
| 48 private: |
| 49 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); |
| 50 void OnHandleInputEventAck(WebKit::WebInputEvent::Type event_type, |
| 51 bool processed); |
| 52 void OnTakeFocus(bool reverse); |
| 53 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); |
| 54 void OnSetCursor(const WebCursor& cursor); |
| 55 |
| 56 // RenderViewHostObserver implementation. |
| 57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 58 |
| 59 scoped_ptr<BrowserPluginHostGuestDelegate> delegate_; |
| 60 // A scoped container for notification registries. |
| 61 NotificationRegistrar registrar_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostGuestRole); |
| 64 }; |
| 65 |
| 66 } // namespace content |
| 67 |
| 68 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_GUEST_ROLE_H_ |
OLD | NEW |