Index: content/renderer/browser_plugin/guest_to_host_channel.h |
diff --git a/content/renderer/browser_plugin/guest_to_host_channel.h b/content/renderer/browser_plugin/guest_to_host_channel.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5df373e6c7e8b024f7394b6d59db0e0490db72a4 |
--- /dev/null |
+++ b/content/renderer/browser_plugin/guest_to_host_channel.h |
@@ -0,0 +1,119 @@ |
+// 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_BROWSER_PLUGIN_GUEST_TO_HOST_CHANNEL_H_ |
+#define CONTENT_RENDERER_BROWSER_PLUGIN_GUEST_TO_HOST_CHANNEL_H_ |
+#pragma once |
+ |
+#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.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 { |
jam
2012/04/06 21:05:23
for this class, please:
-add comments for all non
Fady Samuel
2012/04/06 22:46:32
Done.
|
+public: |
+ class ProxyChannelDelegateImpl: |
+ public ppapi::proxy::ProxyChannel::Delegate { |
+ public: |
+ virtual ~ProxyChannelDelegateImpl() { } |
+ |
+ // Returns the dedicated message loop for processing IPC requests. |
jam
2012/04/06 21:05:23
dont repeat the comment from parent interfaces
Fady Samuel
2012/04/06 22:46:32
Done.
|
+ 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); |
+ |
+ WebGraphicsContext3DCommandBufferImpl* GetWebGraphicsContext3D( |
+ const WebKit::WebGraphicsContext3D::Attributes& attributes); |
+ |
+ int width() const { return width_; } |
+ |
+ int height() const { return height_; } |
+ |
+ void IssueSwapBuffers(); |
+ |
+ virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
+ |
+ virtual bool Send(IPC::Message* message) OVERRIDE; |
+ |
+ virtual void OnChannelError() OVERRIDE; |
+ |
+private: |
+ |
+ void RequestInputEvents(); |
+ |
+ void CreateGraphicsContext(); |
+ |
+ void OnSupportsInterface(const std::string& interface_name, bool* result); |
+ |
+ void OnSetPreferences(const ppapi::Preferences& prefs); |
+ |
+ void OnReserveInstanceId(PP_Instance instance, bool* usable); |
+ |
+ void OnDidCreate(PP_Instance instance, |
+ const std::vector<std::string>& argn, |
+ const std::vector<std::string>& argv, |
+ PP_Bool* result); |
+ |
+ void OnDidChangeView(PP_Instance instance, |
+ const ppapi::ViewData& new_data, |
+ PP_Bool flash_fullscreen); |
+ |
+ void OnDidChangeFocus(PP_Instance instance, PP_Bool has_focus); |
+ |
+ void OnHandleDocumentLoad(PP_Instance instance, |
+ const ppapi::HostResource& url_loader, |
+ PP_Bool* result); |
+ |
+ void OnGetInstanceObject(PP_Instance instance, |
+ ppapi::proxy::SerializedVarReturnValue result); |
+ |
+ void OnHandleMessage(PP_Instance instance, |
+ ppapi::proxy::SerializedVarReceiveInput data); |
+ |
+ void OnHandleFilteredInputEvent(PP_Instance instance, |
+ const ppapi::InputEventData& data, |
+ PP_Bool* result); |
+ |
+ void OnSwapBuffersACK(const ppapi::HostResource& context, |
+ int32_t pp_error); |
+ |
+ void OnContextLost(PP_Instance instance); |
+ |
+ WebKit::WebView* webview_; |
+ GuestRenderViewObserver* guest_; |
+ ProxyChannelDelegateImpl delegate_; |
+ // Identifier for the plugin instance. |
+ PP_Instance instance_; |
+ // Handle to the pepper graphics context. |
+ ppapi::HostResource resource_; |
+ WebGraphicsContext3DCommandBufferImpl* context_; |
+ WebKit::WebGraphicsContext3D::Attributes attributes_; |
+ int width_; |
+ int height_; |
+}; |
+#endif // CONTENT_RENDERER_BROWSER_PLUGIN_GUEST_TO_HOST_CHANNEL_H_ |