Index: content/browser/browser_plugin/browser_plugin_host_guest_role.h |
diff --git a/content/browser/browser_plugin/browser_plugin_host_guest_role.h b/content/browser/browser_plugin/browser_plugin_host_guest_role.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..446d179b859e54d07faac2a251e51b970a2c10b0 |
--- /dev/null |
+++ b/content/browser/browser_plugin/browser_plugin_host_guest_role.h |
@@ -0,0 +1,68 @@ |
+// Copyright (c) 2012 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 CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_GUEST_ROLE_H_ |
+#define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_GUEST_ROLE_H_ |
+ |
+#include <string> |
+ |
+#include "base/compiler_specific.h" |
+#include "content/browser/browser_plugin/browser_plugin_host_guest_delegate.h" |
+#include "content/browser/browser_plugin/browser_plugin_host_role.h" |
+#include "content/public/browser/render_view_host_observer.h" |
+#include "content/public/browser/notification_observer.h" |
+#include "content/public/browser/web_contents_observer.h" |
+#include "content/public/browser/notification_registrar.h" |
+#include "ipc/ipc_channel_handle.h" |
+#include "ipc/ipc_sync_message.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
+#include "ui/surface/transport_dib.h" |
+#include "webkit/glue/webcursor.h" |
+ |
+namespace gfx { |
+class Size; |
+} |
+ |
+struct BrowserPluginHostMsg_ResizeGuest_Params; |
+struct ViewHostMsg_UpdateRect_Params; |
+ |
+namespace content { |
+ |
+class RenderViewHost; |
+ |
+// Role for browser plugin guest. It overrides different WebContents messages |
+// that require special treatment for a WebContents to act as a guest. All |
+// functionalities are handled by its delegate, this class exists so we have |
+// separation of messages it handles, which can be move to a message filter (IPC |
+// thread) for future optimization. |
+class BrowserPluginHostGuestRole : public BrowserPluginHostRole, |
+ public RenderViewHostObserver, |
+ public WebContentsObserver { |
+ public: |
+ BrowserPluginHostGuestRole(int instance_id, WebContentsImpl* web_contents, |
+ RenderViewHost* render_view_host); |
+ virtual ~BrowserPluginHostGuestRole(); |
+ BrowserPluginHostGuestDelegate* GetDelegate(); |
+ |
+ private: |
+ void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); |
+ void OnHandleInputEventAck(WebKit::WebInputEvent::Type event_type, |
+ bool processed); |
+ void OnTakeFocus(bool reverse); |
+ void OnShowWidget(int route_id, const gfx::Rect& initial_pos); |
+ void OnSetCursor(const WebCursor& cursor); |
+ |
+ // RenderViewHostObserver implementation. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ scoped_ptr<BrowserPluginHostGuestDelegate> delegate_; |
+ // A scoped container for notification registries. |
+ NotificationRegistrar registrar_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostGuestRole); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_GUEST_ROLE_H_ |