Chromium Code Reviews| 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_RENDERER_BROWSER_PLUGIN_GUEST_TO_HOST_CHANNEL_H_ | |
| 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_GUEST_TO_HOST_CHANNEL_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | |
| 10 #include "ipc/ipc_channel_handle.h" | |
| 11 #include "ppapi/c/pp_bool.h" | |
| 12 #include "ppapi/c/pp_instance.h" | |
| 13 #include "ppapi/shared_impl/ppb_view_shared.h" | |
| 14 #include "ppapi/proxy/proxy_channel.h" | |
| 15 #include "ppapi/proxy/serialized_var.h" | |
| 16 #include "ppapi/shared_impl/host_resource.h" | |
| 17 #include "ppapi/shared_impl/ppapi_preferences.h" | |
| 18 #include "ppapi/shared_impl/ppb_input_event_shared.h" | |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC ontext3D.h" | |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | |
| 21 | |
| 22 class GuestRenderViewObserver; | |
| 23 | |
| 24 namespace gpu { | |
| 25 class CommandBuffer; | |
| 26 } | |
| 27 | |
| 28 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.
| |
| 29 public: | |
| 30 class ProxyChannelDelegateImpl: | |
| 31 public ppapi::proxy::ProxyChannel::Delegate { | |
| 32 public: | |
| 33 virtual ~ProxyChannelDelegateImpl() { } | |
| 34 | |
| 35 // 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.
| |
| 36 virtual base::MessageLoopProxy* GetIPCMessageLoop(); | |
| 37 | |
| 38 // Returns the event object that becomes signalled when the main thread's | |
| 39 // message loop exits. | |
| 40 virtual base::WaitableEvent* GetShutdownEvent(); | |
| 41 }; | |
| 42 | |
| 43 GuestToHostChannel(GuestRenderViewObserver* guest, | |
| 44 WebKit::WebView* webview); | |
| 45 | |
| 46 virtual ~GuestToHostChannel() { } | |
| 47 | |
| 48 bool InitChannel(const IPC::ChannelHandle& channel_handle); | |
| 49 | |
| 50 WebGraphicsContext3DCommandBufferImpl* GetWebGraphicsContext3D( | |
| 51 const WebKit::WebGraphicsContext3D::Attributes& attributes); | |
| 52 | |
| 53 int width() const { return width_; } | |
| 54 | |
| 55 int height() const { return height_; } | |
| 56 | |
| 57 void IssueSwapBuffers(); | |
| 58 | |
| 59 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | |
| 60 | |
| 61 virtual bool Send(IPC::Message* message) OVERRIDE; | |
| 62 | |
| 63 virtual void OnChannelError() OVERRIDE; | |
| 64 | |
| 65 private: | |
| 66 | |
| 67 void RequestInputEvents(); | |
| 68 | |
| 69 void CreateGraphicsContext(); | |
| 70 | |
| 71 void OnSupportsInterface(const std::string& interface_name, bool* result); | |
| 72 | |
| 73 void OnSetPreferences(const ppapi::Preferences& prefs); | |
| 74 | |
| 75 void OnReserveInstanceId(PP_Instance instance, bool* usable); | |
| 76 | |
| 77 void OnDidCreate(PP_Instance instance, | |
| 78 const std::vector<std::string>& argn, | |
| 79 const std::vector<std::string>& argv, | |
| 80 PP_Bool* result); | |
| 81 | |
| 82 void OnDidChangeView(PP_Instance instance, | |
| 83 const ppapi::ViewData& new_data, | |
| 84 PP_Bool flash_fullscreen); | |
| 85 | |
| 86 void OnDidChangeFocus(PP_Instance instance, PP_Bool has_focus); | |
| 87 | |
| 88 void OnHandleDocumentLoad(PP_Instance instance, | |
| 89 const ppapi::HostResource& url_loader, | |
| 90 PP_Bool* result); | |
| 91 | |
| 92 void OnGetInstanceObject(PP_Instance instance, | |
| 93 ppapi::proxy::SerializedVarReturnValue result); | |
| 94 | |
| 95 void OnHandleMessage(PP_Instance instance, | |
| 96 ppapi::proxy::SerializedVarReceiveInput data); | |
| 97 | |
| 98 void OnHandleFilteredInputEvent(PP_Instance instance, | |
| 99 const ppapi::InputEventData& data, | |
| 100 PP_Bool* result); | |
| 101 | |
| 102 void OnSwapBuffersACK(const ppapi::HostResource& context, | |
| 103 int32_t pp_error); | |
| 104 | |
| 105 void OnContextLost(PP_Instance instance); | |
| 106 | |
| 107 WebKit::WebView* webview_; | |
| 108 GuestRenderViewObserver* guest_; | |
| 109 ProxyChannelDelegateImpl delegate_; | |
| 110 // Identifier for the plugin instance. | |
| 111 PP_Instance instance_; | |
| 112 // Handle to the pepper graphics context. | |
| 113 ppapi::HostResource resource_; | |
| 114 WebGraphicsContext3DCommandBufferImpl* context_; | |
| 115 WebKit::WebGraphicsContext3D::Attributes attributes_; | |
| 116 int width_; | |
| 117 int height_; | |
| 118 }; | |
| 119 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_GUEST_TO_HOST_CHANNEL_H_ | |
| OLD | NEW |