Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: content/renderer/webplugin_delegate_proxy.h

Issue 19761007: Move NPAPI implementation out of webkit/plugins/npapi and into content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ 5 #ifndef CONTENT_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_
6 #define CONTENT_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ 6 #define CONTENT_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/sequenced_task_runner_helpers.h" 14 #include "base/sequenced_task_runner_helpers.h"
15 #include "content/child/npapi/webplugin_delegate.h"
15 #include "ipc/ipc_listener.h" 16 #include "ipc/ipc_listener.h"
16 #include "ipc/ipc_message.h" 17 #include "ipc/ipc_message.h"
17 #include "ipc/ipc_sender.h" 18 #include "ipc/ipc_sender.h"
18 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
19 #include "ui/gfx/rect.h" 20 #include "ui/gfx/rect.h"
20 #include "ui/surface/transport_dib.h" 21 #include "ui/surface/transport_dib.h"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
22 #include "webkit/plugins/npapi/webplugin_delegate.h"
23 #include "webkit/plugins/webplugininfo.h" 23 #include "webkit/plugins/webplugininfo.h"
24 24
25 #if defined(OS_MACOSX) 25 #if defined(OS_MACOSX)
26 #include "base/containers/hash_tables.h" 26 #include "base/containers/hash_tables.h"
27 #include "base/memory/linked_ptr.h" 27 #include "base/memory/linked_ptr.h"
28 #endif 28 #endif
29 29
30 struct NPObject; 30 struct NPObject;
31 struct PluginHostMsg_URLRequest_Params; 31 struct PluginHostMsg_URLRequest_Params;
32 class SkBitmap; 32 class SkBitmap;
33 33
34 namespace base { 34 namespace base {
35 class WaitableEvent; 35 class WaitableEvent;
36 } 36 }
37 37
38 namespace webkit { 38 namespace webkit {
39 namespace npapi { 39 namespace npapi {
40 class WebPlugin; 40 class WebPlugin;
41 } 41 }
42 } 42 }
43 43
44 namespace content { 44 namespace content {
45 class NPObjectStub; 45 class NPObjectStub;
46 class PluginChannelHost; 46 class PluginChannelHost;
47 class RenderViewImpl; 47 class RenderViewImpl;
48 48
49 // An implementation of WebPluginDelegate that proxies all calls to 49 // An implementation of WebPluginDelegate that proxies all calls to
50 // the plugin process. 50 // the plugin process.
51 class WebPluginDelegateProxy 51 class WebPluginDelegateProxy
52 : public webkit::npapi::WebPluginDelegate, 52 : public WebPluginDelegate,
53 public IPC::Listener, 53 public IPC::Listener,
54 public IPC::Sender, 54 public IPC::Sender,
55 public base::SupportsWeakPtr<WebPluginDelegateProxy> { 55 public base::SupportsWeakPtr<WebPluginDelegateProxy> {
56 public: 56 public:
57 WebPluginDelegateProxy(const std::string& mime_type, 57 WebPluginDelegateProxy(const std::string& mime_type,
58 const base::WeakPtr<RenderViewImpl>& render_view); 58 const base::WeakPtr<RenderViewImpl>& render_view);
59 59
60 // WebPluginDelegate implementation: 60 // WebPluginDelegate implementation:
61 virtual void PluginDestroyed() OVERRIDE; 61 virtual void PluginDestroyed() OVERRIDE;
62 virtual bool Initialize(const GURL& url, 62 virtual bool Initialize(const GURL& url,
63 const std::vector<std::string>& arg_names, 63 const std::vector<std::string>& arg_names,
64 const std::vector<std::string>& arg_values, 64 const std::vector<std::string>& arg_values,
65 webkit::npapi::WebPlugin* plugin, 65 WebPlugin* plugin,
66 bool load_manually) OVERRIDE; 66 bool load_manually) OVERRIDE;
67 virtual void UpdateGeometry(const gfx::Rect& window_rect, 67 virtual void UpdateGeometry(const gfx::Rect& window_rect,
68 const gfx::Rect& clip_rect) OVERRIDE; 68 const gfx::Rect& clip_rect) OVERRIDE;
69 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) OVERRIDE; 69 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) OVERRIDE;
70 virtual NPObject* GetPluginScriptableObject() OVERRIDE; 70 virtual NPObject* GetPluginScriptableObject() OVERRIDE;
71 virtual struct _NPP* GetPluginNPP() OVERRIDE; 71 virtual struct _NPP* GetPluginNPP() OVERRIDE;
72 virtual bool GetFormValue(string16* value) OVERRIDE; 72 virtual bool GetFormValue(string16* value) OVERRIDE;
73 virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, 73 virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason,
74 int notify_id) OVERRIDE; 74 int notify_id) OVERRIDE;
75 virtual void SetFocus(bool focused) OVERRIDE; 75 virtual void SetFocus(bool focused) OVERRIDE;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 int notify_id) OVERRIDE; 117 int notify_id) OVERRIDE;
118 118
119 virtual void DidReceiveManualResponse(const GURL& url, 119 virtual void DidReceiveManualResponse(const GURL& url,
120 const std::string& mime_type, 120 const std::string& mime_type,
121 const std::string& headers, 121 const std::string& headers,
122 uint32 expected_length, 122 uint32 expected_length,
123 uint32 last_modified) OVERRIDE; 123 uint32 last_modified) OVERRIDE;
124 virtual void DidReceiveManualData(const char* buffer, int length) OVERRIDE; 124 virtual void DidReceiveManualData(const char* buffer, int length) OVERRIDE;
125 virtual void DidFinishManualLoading() OVERRIDE; 125 virtual void DidFinishManualLoading() OVERRIDE;
126 virtual void DidManualLoadFail() OVERRIDE; 126 virtual void DidManualLoadFail() OVERRIDE;
127 virtual webkit::npapi::WebPluginResourceClient* CreateResourceClient( 127 virtual WebPluginResourceClient* CreateResourceClient(
128 unsigned long resource_id, const GURL& url, int notify_id) OVERRIDE; 128 unsigned long resource_id, const GURL& url, int notify_id) OVERRIDE;
129 virtual webkit::npapi::WebPluginResourceClient* CreateSeekableResourceClient( 129 virtual WebPluginResourceClient* CreateSeekableResourceClient(
130 unsigned long resource_id, int range_request_id) OVERRIDE; 130 unsigned long resource_id, int range_request_id) OVERRIDE;
131 131
132 gfx::PluginWindowHandle GetPluginWindowHandle(); 132 gfx::PluginWindowHandle GetPluginWindowHandle();
133 133
134 protected: 134 protected:
135 friend class base::DeleteHelper<WebPluginDelegateProxy>; 135 friend class base::DeleteHelper<WebPluginDelegateProxy>;
136 virtual ~WebPluginDelegateProxy(); 136 virtual ~WebPluginDelegateProxy();
137 137
138 private: 138 private:
139 struct SharedBitmap { 139 struct SharedBitmap {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // plugin window gets destroyed, or when the plugin has crashed (at which 240 // plugin window gets destroyed, or when the plugin has crashed (at which
241 // point the window has already been destroyed). 241 // point the window has already been destroyed).
242 void WillDestroyWindow(); 242 void WillDestroyWindow();
243 243
244 #if defined(OS_WIN) 244 #if defined(OS_WIN)
245 // Returns true if we should update the plugin geometry synchronously. 245 // Returns true if we should update the plugin geometry synchronously.
246 bool UseSynchronousGeometryUpdates(); 246 bool UseSynchronousGeometryUpdates();
247 #endif 247 #endif
248 248
249 base::WeakPtr<RenderViewImpl> render_view_; 249 base::WeakPtr<RenderViewImpl> render_view_;
250 webkit::npapi::WebPlugin* plugin_; 250 WebPlugin* plugin_;
251 bool uses_shared_bitmaps_; 251 bool uses_shared_bitmaps_;
252 #if defined(OS_MACOSX) 252 #if defined(OS_MACOSX)
253 bool uses_compositor_; 253 bool uses_compositor_;
254 #elif defined(OS_WIN) 254 #elif defined(OS_WIN)
255 // Used for windowless plugins so that keyboard activation works. 255 // Used for windowless plugins so that keyboard activation works.
256 gfx::NativeViewId dummy_activation_window_; 256 gfx::NativeViewId dummy_activation_window_;
257 #endif 257 #endif
258 gfx::PluginWindowHandle window_; 258 gfx::PluginWindowHandle window_;
259 scoped_refptr<PluginChannelHost> channel_host_; 259 scoped_refptr<PluginChannelHost> channel_host_;
260 std::string mime_type_; 260 std::string mime_type_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 // The url of the main frame hosting the plugin. 297 // The url of the main frame hosting the plugin.
298 GURL page_url_; 298 GURL page_url_;
299 299
300 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); 300 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy);
301 }; 301 };
302 302
303 } // namespace content 303 } // namespace content
304 304
305 #endif // CONTENT_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ 305 #endif // CONTENT_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698