| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ | 5 #ifndef CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ |
| 6 #define CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ | 6 #define CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 WebPluginProxy(PluginChannel* channel, | 45 WebPluginProxy(PluginChannel* channel, |
| 46 int route_id, | 46 int route_id, |
| 47 const GURL& page_url, | 47 const GURL& page_url, |
| 48 int host_render_view_routing_id); | 48 int host_render_view_routing_id); |
| 49 virtual ~WebPluginProxy(); | 49 virtual ~WebPluginProxy(); |
| 50 | 50 |
| 51 void set_delegate(WebPluginDelegateImpl* d) { delegate_ = d; } | 51 void set_delegate(WebPluginDelegateImpl* d) { delegate_ = d; } |
| 52 | 52 |
| 53 // WebPlugin overrides | 53 // WebPlugin overrides |
| 54 virtual void SetWindow(gfx::PluginWindowHandle window) OVERRIDE; | 54 virtual void SetWindow(gfx::PluginWindowHandle window) OVERRIDE; |
| 55 | |
| 56 // Whether input events should be sent to the delegate. | |
| 57 virtual void SetAcceptsInputEvents(bool accepts) OVERRIDE; | 55 virtual void SetAcceptsInputEvents(bool accepts) OVERRIDE; |
| 58 | |
| 59 virtual void WillDestroyWindow(gfx::PluginWindowHandle window) OVERRIDE; | 56 virtual void WillDestroyWindow(gfx::PluginWindowHandle window) OVERRIDE; |
| 60 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
| 61 void SetWindowlessData(HANDLE pump_messages_event, | 58 void SetWindowlessData(HANDLE pump_messages_event, |
| 62 gfx::NativeViewId dummy_activation_window); | 59 gfx::NativeViewId dummy_activation_window); |
| 63 #endif | 60 #endif |
| 64 | |
| 65 virtual void CancelResource(unsigned long id) OVERRIDE; | 61 virtual void CancelResource(unsigned long id) OVERRIDE; |
| 66 virtual void Invalidate() OVERRIDE; | 62 virtual void Invalidate() OVERRIDE; |
| 67 virtual void InvalidateRect(const gfx::Rect& rect) OVERRIDE; | 63 virtual void InvalidateRect(const gfx::Rect& rect) OVERRIDE; |
| 68 virtual NPObject* GetWindowScriptNPObject() OVERRIDE; | 64 virtual NPObject* GetWindowScriptNPObject() OVERRIDE; |
| 69 virtual NPObject* GetPluginElement() OVERRIDE; | 65 virtual NPObject* GetPluginElement() OVERRIDE; |
| 70 virtual bool FindProxyForUrl(const GURL& url, | 66 virtual bool FindProxyForUrl(const GURL& url, |
| 71 std::string* proxy_list) OVERRIDE; | 67 std::string* proxy_list) OVERRIDE; |
| 72 virtual void SetCookie(const GURL& url, | 68 virtual void SetCookie(const GURL& url, |
| 73 const GURL& first_party_for_cookies, | 69 const GURL& first_party_for_cookies, |
| 74 const std::string& cookie) OVERRIDE; | 70 const std::string& cookie) OVERRIDE; |
| 75 virtual std::string GetCookies(const GURL& url, | 71 virtual std::string GetCookies(const GURL& url, |
| 76 const GURL& first_party_for_cookies) OVERRIDE; | 72 const GURL& first_party_for_cookies) OVERRIDE; |
| 77 | |
| 78 // class-specific methods | |
| 79 | |
| 80 // Returns a WebPluginResourceClient object given its id, or NULL if no | |
| 81 // object with that id exists. | |
| 82 WebPluginResourceClient* GetResourceClient(int id); | |
| 83 | |
| 84 // Returns the id of the renderer that contains this plugin. | |
| 85 int GetRendererId(); | |
| 86 | |
| 87 // Returns the id of the associated render view. | |
| 88 int host_render_view_routing_id() const { | |
| 89 return host_render_view_routing_id_; | |
| 90 } | |
| 91 | |
| 92 // For windowless plugins, paints the given rectangle into the local buffer. | |
| 93 void Paint(const gfx::Rect& rect); | |
| 94 | |
| 95 // Callback from the renderer to let us know that a paint occurred. | |
| 96 void DidPaint(); | |
| 97 | |
| 98 // Notification received on a plugin issued resource request creation. | |
| 99 void OnResourceCreated(int resource_id, WebPluginResourceClient* client); | |
| 100 | |
| 101 virtual void HandleURLRequest(const char* url, | 73 virtual void HandleURLRequest(const char* url, |
| 102 const char* method, | 74 const char* method, |
| 103 const char* target, | 75 const char* target, |
| 104 const char* buf, | 76 const char* buf, |
| 105 unsigned int len, | 77 unsigned int len, |
| 106 int notify_id, | 78 int notify_id, |
| 107 bool popups_allowed, | 79 bool popups_allowed, |
| 108 bool notify_redirects) OVERRIDE; | 80 bool notify_redirects) OVERRIDE; |
| 109 void UpdateGeometry(const gfx::Rect& window_rect, | 81 void UpdateGeometry(const gfx::Rect& window_rect, |
| 110 const gfx::Rect& clip_rect, | 82 const gfx::Rect& clip_rect, |
| 111 const TransportDIB::Handle& windowless_buffer0, | 83 const TransportDIB::Handle& windowless_buffer0, |
| 112 const TransportDIB::Handle& windowless_buffer1, | 84 const TransportDIB::Handle& windowless_buffer1, |
| 113 int windowless_buffer_index); | 85 int windowless_buffer_index); |
| 114 virtual void CancelDocumentLoad() OVERRIDE; | 86 virtual void CancelDocumentLoad() OVERRIDE; |
| 115 virtual void InitiateHTTPRangeRequest( | 87 virtual void InitiateHTTPRangeRequest( |
| 116 const char* url, const char* range_info, int range_request_id) OVERRIDE; | 88 const char* url, const char* range_info, int range_request_id) OVERRIDE; |
| 117 virtual void SetDeferResourceLoading(unsigned long resource_id, | 89 virtual void SetDeferResourceLoading(unsigned long resource_id, |
| 118 bool defer) OVERRIDE; | 90 bool defer) OVERRIDE; |
| 119 virtual bool IsOffTheRecord() OVERRIDE; | 91 virtual bool IsOffTheRecord() OVERRIDE; |
| 120 virtual void ResourceClientDeleted( | 92 virtual void ResourceClientDeleted( |
| 121 WebPluginResourceClient* resource_client) OVERRIDE; | 93 WebPluginResourceClient* resource_client) OVERRIDE; |
| 122 | 94 |
| 123 #if defined(OS_MACOSX) | 95 #if defined(OS_MACOSX) |
| 124 virtual void FocusChanged(bool focused) OVERRIDE; | 96 virtual void FocusChanged(bool focused) OVERRIDE; |
| 125 virtual void StartIme() OVERRIDE; | 97 virtual void StartIme() OVERRIDE; |
| 126 virtual WebPluginAcceleratedSurface* | 98 virtual WebPluginAcceleratedSurface* |
| 127 GetAcceleratedSurface(gfx::GpuPreference gpu_preference) OVERRIDE; | 99 GetAcceleratedSurface(gfx::GpuPreference gpu_preference) OVERRIDE; |
| 128 | |
| 129 //---------------------------------------------------------------------- | |
| 130 // Accelerated plugin implementation which renders via the compositor. | |
| 131 | |
| 132 // Tells the renderer, and from there the GPU process, that the plugin | |
| 133 // is using accelerated rather than software rendering. | |
| 134 virtual void AcceleratedPluginEnabledRendering() OVERRIDE; | 100 virtual void AcceleratedPluginEnabledRendering() OVERRIDE; |
| 135 | |
| 136 // Tells the renderer, and from there the GPU process, that the plugin | |
| 137 // allocated the given IOSurface to be used as its backing store. | |
| 138 virtual void AcceleratedPluginAllocatedIOSurface(int32 width, | 101 virtual void AcceleratedPluginAllocatedIOSurface(int32 width, |
| 139 int32 height, | 102 int32 height, |
| 140 uint32 surface_id) OVERRIDE; | 103 uint32 surface_id) OVERRIDE; |
| 141 virtual void AcceleratedPluginSwappedIOSurface() OVERRIDE; | 104 virtual void AcceleratedPluginSwappedIOSurface() OVERRIDE; |
| 142 #endif | 105 #endif |
| 106 virtual void URLRedirectResponse(bool allow, int resource_id) OVERRIDE; |
| 143 | 107 |
| 144 virtual void URLRedirectResponse(bool allow, int resource_id) OVERRIDE; | 108 // class-specific methods |
| 109 |
| 110 // Returns a WebPluginResourceClient object given its id, or NULL if no |
| 111 // object with that id exists. |
| 112 WebPluginResourceClient* GetResourceClient(int id); |
| 113 |
| 114 // Returns the id of the renderer that contains this plugin. |
| 115 int GetRendererId(); |
| 116 |
| 117 // Returns the id of the associated render view. |
| 118 int host_render_view_routing_id() const { |
| 119 return host_render_view_routing_id_; |
| 120 } |
| 121 |
| 122 // For windowless plugins, paints the given rectangle into the local buffer. |
| 123 void Paint(const gfx::Rect& rect); |
| 124 |
| 125 // Callback from the renderer to let us know that a paint occurred. |
| 126 void DidPaint(); |
| 127 |
| 128 // Notification received on a plugin issued resource request creation. |
| 129 void OnResourceCreated(int resource_id, WebPluginResourceClient* client); |
| 145 | 130 |
| 146 #if defined(OS_WIN) && !defined(USE_AURA) | 131 #if defined(OS_WIN) && !defined(USE_AURA) |
| 147 // Retrieves the IME status from a windowless plug-in and sends it to a | 132 // Retrieves the IME status from a windowless plug-in and sends it to a |
| 148 // renderer process. A renderer process will convert the coordinates from | 133 // renderer process. A renderer process will convert the coordinates from |
| 149 // local to the window coordinates and send the converted coordinates to a | 134 // local to the window coordinates and send the converted coordinates to a |
| 150 // browser process. | 135 // browser process. |
| 151 void UpdateIMEStatus(); | 136 void UpdateIMEStatus(); |
| 152 #endif | 137 #endif |
| 153 | 138 |
| 154 private: | 139 private: |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 236 |
| 252 // Contains the routing id of the host render view. | 237 // Contains the routing id of the host render view. |
| 253 int host_render_view_routing_id_; | 238 int host_render_view_routing_id_; |
| 254 | 239 |
| 255 base::WeakPtrFactory<WebPluginProxy> weak_factory_; | 240 base::WeakPtrFactory<WebPluginProxy> weak_factory_; |
| 256 }; | 241 }; |
| 257 | 242 |
| 258 } // namespace content | 243 } // namespace content |
| 259 | 244 |
| 260 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ | 245 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ |
| OLD | NEW |