Index: content/renderer/guest_to_host_channel.h |
diff --git a/content/renderer/guest_to_host_channel.h b/content/renderer/guest_to_host_channel.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a0be775c8df50b266fdfd1d4ff069608caa7f8b9 |
--- /dev/null |
+++ b/content/renderer/guest_to_host_channel.h |
@@ -0,0 +1,126 @@ |
+// 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_RENDERER_GUEST_TO_HOST_CHANNEL_H_ |
+#define CONTENT_RENDERER_GUEST_TO_HOST_CHANNEL_H_ |
+#pragma once |
+ |
+#include "content/renderer/gpu/webgraphicscontext3d_guest.h" |
+#include "gpu/command_buffer/client/gles2_cmd_helper.h" |
+#include "gpu/command_buffer/client/gles2_implementation.h" |
+#include "ipc/ipc_channel_handle.h" |
+#include "ppapi/c/pp_bool.h" |
+#include "ppapi/c/pp_instance.h" |
+#include "ppapi/shared_impl/ppb_view_shared.h" |
+#include "ppapi/proxy/proxy_channel.h" |
+#include "ppapi/proxy/serialized_var.h" |
+#include "ppapi/shared_impl/host_resource.h" |
+#include "ppapi/shared_impl/ppapi_preferences.h" |
+#include "ppapi/shared_impl/ppb_input_event_shared.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
+ |
+class GuestRenderViewObserver; |
+ |
+namespace gpu { |
+ class CommandBuffer; |
+} |
+ |
+class GuestToHostChannel: public ppapi::proxy::ProxyChannel { |
+public: |
+ class ProxyChannelDelegateImpl: |
+ public ppapi::proxy::ProxyChannel::Delegate { |
+ public: |
+ virtual ~ProxyChannelDelegateImpl() { } |
+ |
+ // Returns the dedicated message loop for processing IPC requests. |
+ virtual base::MessageLoopProxy* GetIPCMessageLoop(); |
+ |
+ // Returns the event object that becomes signalled when the main thread's |
+ // message loop exits. |
+ virtual base::WaitableEvent* GetShutdownEvent(); |
+ }; |
+ |
+ GuestToHostChannel(GuestRenderViewObserver* guest, |
+ WebKit::WebView* webview); |
+ |
+ virtual ~GuestToHostChannel() { } |
+ |
+ bool InitChannel(const IPC::ChannelHandle& channel_handle); |
+ |
+ virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
+ |
+ virtual bool Send(IPC::Message* message) OVERRIDE; |
+ |
+ virtual void OnChannelError() OVERRIDE; |
+ |
+ WebKit::WebGraphicsContext3D* GetWebGraphicsContext3D(); |
+ |
+ int width() const { return width_; } |
+ |
+ int height() const { return height_; } |
+ |
+private: |
+ friend class WebGraphicsContext3DGuest; |
+ |
+ void IssueSwapBuffers(); |
+ |
+ bool BindGraphics(); |
+ |
+ void RequestInputEvents(); |
+ |
+ void CreateGraphicsContext(); |
+ |
+ void OnMsgSupportsInterface(const std::string& interface_name, bool*result); |
+ |
+ void OnMsgSetPreferences(const ppapi::Preferences& prefs); |
+ |
+ void OnMsgReserveInstanceId(PP_Instance instance, bool* usable); |
+ |
+ // Message handlers from ppp_instance_proxy |
+ void OnPluginMsgDidCreate(PP_Instance instance, |
+ const std::vector<std::string>& argn, |
+ const std::vector<std::string>& argv, |
+ PP_Bool* result); |
+ void OnPluginMsgDidDestroy(PP_Instance instance); |
+ void OnPluginMsgDidChangeView(PP_Instance instance, |
+ const ppapi::ViewData& new_data, |
+ PP_Bool flash_fullscreen); |
+ void OnPluginMsgDidChangeFocus(PP_Instance instance, PP_Bool has_focus); |
+ void OnPluginMsgHandleDocumentLoad(PP_Instance instance, |
+ const ppapi::HostResource& url_loader, |
+ PP_Bool* result); |
+ |
+ // Message handlers from ppp_instance_private_proxy |
+ void OnMsgGetInstanceObject(PP_Instance instance, |
+ ppapi::proxy::SerializedVarReturnValue result); |
+ |
+ // Message handlers from ppp_messaging_proxy |
+ void OnMsgHandleMessage(PP_Instance instance, |
+ ppapi::proxy::SerializedVarReceiveInput data); |
+ |
+ // Message handlers from ppp_input_event_proxy |
+ void OnMsgHandleInputEvent(PP_Instance instance, |
+ const ppapi::InputEventData& data); |
+ void OnMsgHandleFilteredInputEvent(PP_Instance instance, |
+ const ppapi::InputEventData& data, |
+ PP_Bool* result); |
+ |
+ // Message handlers from ppb_graphics_3d_proxy |
+ void OnMsgSwapBuffersACK(const ppapi::HostResource& context, |
+ int32_t pp_error); |
+ |
+ // Message handlers from ppp_graphics3d_proxy |
+ void OnMsgContextLost(PP_Instance instance); |
+ |
+ WebKit::WebView* webview_; |
+ GuestRenderViewObserver* guest_; |
+ ProxyChannelDelegateImpl delegate_; |
+ PP_Instance instance_; |
+ ppapi::HostResource resource_; |
+ scoped_ptr<WebGraphicsContext3DGuest> context_; |
+ int width_; |
+ int height_; |
+}; |
+#endif |