OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ | 5 #ifndef CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ |
6 #define CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ | 6 #define CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/id_map.h" | 14 #include "base/id_map.h" |
15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
16 #include "base/weak_ptr.h" | 16 #include "base/weak_ptr.h" |
17 #include "base/task.h" | 17 #include "base/task.h" |
18 #include "chrome/renderer/pepper_devices.h" | 18 #include "chrome/renderer/pepper_devices.h" |
19 #include "chrome/renderer/command_buffer_proxy.h" | 19 #include "chrome/renderer/command_buffer_proxy.h" |
20 #include "gfx/native_widget_types.h" | 20 #include "gfx/native_widget_types.h" |
21 #include "gfx/rect.h" | 21 #include "gfx/rect.h" |
22 #include "third_party/npapi/bindings/npapi.h" | 22 #include "third_party/npapi/bindings/npapi.h" |
23 #include "third_party/skia/include/core/SkBitmap.h" | 23 #include "third_party/skia/include/core/SkBitmap.h" |
24 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h" |
25 #include "webkit/glue/plugins/webplugin_delegate.h" | 25 #include "webkit/plugins/npapi/webplugin_delegate.h" |
26 | 26 |
27 class FilePath; | 27 class FilePath; |
28 class RenderView; | 28 class RenderView; |
29 class WebCursor; | 29 class WebCursor; |
30 class WebPluginDelegateProxy; | 30 class WebPluginDelegateProxy; |
31 | 31 |
32 namespace NPAPI { | 32 namespace webkit { |
| 33 namespace npapi { |
33 class PluginInstance; | 34 class PluginInstance; |
34 } | 35 } |
| 36 } |
35 | 37 |
36 // An implementation of WebPluginDelegate for Pepper in-process plugins. | 38 // An implementation of WebPluginDelegate for Pepper in-process plugins. |
37 class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate, | 39 class WebPluginDelegatePepper : public webkit::npapi::WebPluginDelegate, |
38 public WebKit::WebFileChooserCompletion { | 40 public WebKit::WebFileChooserCompletion { |
39 public: | 41 public: |
40 static WebPluginDelegatePepper* Create( | 42 static WebPluginDelegatePepper* Create( |
41 const FilePath& filename, | 43 const FilePath& filename, |
42 const std::string& mime_type, | 44 const std::string& mime_type, |
43 const base::WeakPtr<RenderView>& render_view); | 45 const base::WeakPtr<RenderView>& render_view); |
44 | 46 |
45 NPAPI::PluginInstance* instance() { return instance_.get(); } | 47 webkit::npapi::PluginInstance* instance() { return instance_.get(); } |
46 | 48 |
47 // WebKit::WebFileChooserCompletion implementation. | 49 // WebKit::WebFileChooserCompletion implementation. |
48 virtual void didChooseFile( | 50 virtual void didChooseFile( |
49 const WebKit::WebVector<WebKit::WebString>& file_names); | 51 const WebKit::WebVector<WebKit::WebString>& file_names); |
50 | 52 |
51 // WebPluginDelegate implementation | 53 // WebPluginDelegate implementation |
52 virtual bool Initialize(const GURL& url, | 54 virtual bool Initialize(const GURL& url, |
53 const std::vector<std::string>& arg_names, | 55 const std::vector<std::string>& arg_names, |
54 const std::vector<std::string>& arg_values, | 56 const std::vector<std::string>& arg_values, |
55 webkit_glue::WebPlugin* plugin, | 57 webkit::npapi::WebPlugin* plugin, |
56 bool load_manually); | 58 bool load_manually); |
57 virtual void PluginDestroyed(); | 59 virtual void PluginDestroyed(); |
58 virtual void UpdateGeometry(const gfx::Rect& window_rect, | 60 virtual void UpdateGeometry(const gfx::Rect& window_rect, |
59 const gfx::Rect& clip_rect); | 61 const gfx::Rect& clip_rect); |
60 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect); | 62 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect); |
61 virtual void Print(gfx::NativeDrawingContext context); | 63 virtual void Print(gfx::NativeDrawingContext context); |
62 virtual void SetFocus(bool focused); | 64 virtual void SetFocus(bool focused); |
63 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, | 65 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, |
64 WebKit::WebCursorInfo* cursor); | 66 WebKit::WebCursorInfo* cursor); |
65 virtual NPObject* GetPluginScriptableObject(); | 67 virtual NPObject* GetPluginScriptableObject(); |
66 virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, | 68 virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, |
67 int notify_id); | 69 int notify_id); |
68 virtual int GetProcessId(); | 70 virtual int GetProcessId(); |
69 virtual void SendJavaScriptStream(const GURL& url, | 71 virtual void SendJavaScriptStream(const GURL& url, |
70 const std::string& result, | 72 const std::string& result, |
71 bool success, | 73 bool success, |
72 int notify_id); | 74 int notify_id); |
73 virtual void DidReceiveManualResponse(const GURL& url, | 75 virtual void DidReceiveManualResponse(const GURL& url, |
74 const std::string& mime_type, | 76 const std::string& mime_type, |
75 const std::string& headers, | 77 const std::string& headers, |
76 uint32 expected_length, | 78 uint32 expected_length, |
77 uint32 last_modified); | 79 uint32 last_modified); |
78 virtual void DidReceiveManualData(const char* buffer, int length); | 80 virtual void DidReceiveManualData(const char* buffer, int length); |
79 virtual void DidFinishManualLoading(); | 81 virtual void DidFinishManualLoading(); |
80 virtual void DidManualLoadFail(); | 82 virtual void DidManualLoadFail(); |
81 virtual void InstallMissingPlugin(); | 83 virtual void InstallMissingPlugin(); |
82 virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( | 84 virtual webkit::npapi::WebPluginResourceClient* CreateResourceClient( |
83 unsigned long resource_id, const GURL& url, int notify_id); | 85 unsigned long resource_id, const GURL& url, int notify_id); |
84 virtual webkit_glue::WebPluginResourceClient* CreateSeekableResourceClient( | 86 virtual webkit::npapi::WebPluginResourceClient* CreateSeekableResourceClient( |
85 unsigned long resource_id, int range_request_id); | 87 unsigned long resource_id, int range_request_id); |
86 virtual bool StartFind(const string16& search_text, | 88 virtual bool StartFind(const string16& search_text, |
87 bool case_sensitive, | 89 bool case_sensitive, |
88 int identifier); | 90 int identifier); |
89 virtual void SelectFindResult(bool forward); | 91 virtual void SelectFindResult(bool forward); |
90 virtual void StopFind(); | 92 virtual void StopFind(); |
91 virtual void NumberOfFindResultsChanged(int total, bool final_result); | 93 virtual void NumberOfFindResultsChanged(int total, bool final_result); |
92 virtual void SelectedFindResultChanged(int index); | 94 virtual void SelectedFindResultChanged(int index); |
93 virtual bool ChooseFile(const char* mime_types, | 95 virtual bool ChooseFile(const char* mime_types, |
94 int mode, | 96 int mode, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // when an ack was received that the browser copied it to the screen | 203 // when an ack was received that the browser copied it to the screen |
202 // (FlushedPaint). | 204 // (FlushedPaint). |
203 void RenderViewInitiatedPaint(); | 205 void RenderViewInitiatedPaint(); |
204 void RenderViewFlushedPaint(); | 206 void RenderViewFlushedPaint(); |
205 | 207 |
206 Graphics2DDeviceContext* GetGraphicsContext(NPDeviceContext2D* context); | 208 Graphics2DDeviceContext* GetGraphicsContext(NPDeviceContext2D* context); |
207 | 209 |
208 private: | 210 private: |
209 WebPluginDelegatePepper( | 211 WebPluginDelegatePepper( |
210 const base::WeakPtr<RenderView>& render_view, | 212 const base::WeakPtr<RenderView>& render_view, |
211 NPAPI::PluginInstance *instance); | 213 webkit::npapi::PluginInstance *instance); |
212 ~WebPluginDelegatePepper(); | 214 ~WebPluginDelegatePepper(); |
213 | 215 |
214 // Set a task that calls the repaint callback the next time the window | 216 // Set a task that calls the repaint callback the next time the window |
215 // is invalid and needs to be repainted. | 217 // is invalid and needs to be repainted. |
216 void ScheduleHandleRepaint(NPP npp, NPDeviceContext3D* context); | 218 void ScheduleHandleRepaint(NPP npp, NPDeviceContext3D* context); |
217 | 219 |
218 //----------------------------------------- | 220 //----------------------------------------- |
219 // used for windowed and windowless plugins | 221 // used for windowed and windowless plugins |
220 | 222 |
221 // Closes down and destroys our plugin instance. | 223 // Closes down and destroys our plugin instance. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // the page. | 270 // the page. |
269 void SendNestedDelegateGeometryToBrowser(const gfx::Rect& window_rect, | 271 void SendNestedDelegateGeometryToBrowser(const gfx::Rect& window_rect, |
270 const gfx::Rect& clip_rect); | 272 const gfx::Rect& clip_rect); |
271 | 273 |
272 // Returns the selection. If nothing is selected, returns an empty string. | 274 // Returns the selection. If nothing is selected, returns an empty string. |
273 // If html is true, it will return a string only if html data is available. | 275 // If html is true, it will return a string only if html data is available. |
274 string16 GetSelectedText(bool html) const; | 276 string16 GetSelectedText(bool html) const; |
275 | 277 |
276 base::WeakPtr<RenderView> render_view_; | 278 base::WeakPtr<RenderView> render_view_; |
277 | 279 |
278 webkit_glue::WebPlugin* plugin_; | 280 webkit::npapi::WebPlugin* plugin_; |
279 scoped_refptr<NPAPI::PluginInstance> instance_; | 281 scoped_refptr<webkit::npapi::PluginInstance> instance_; |
280 | 282 |
281 NPWindow window_; | 283 NPWindow window_; |
282 gfx::Rect window_rect_; | 284 gfx::Rect window_rect_; |
283 gfx::Rect clip_rect_; | 285 gfx::Rect clip_rect_; |
284 std::vector<gfx::Rect> cutout_rects_; | 286 std::vector<gfx::Rect> cutout_rects_; |
285 | 287 |
286 // Open device contexts | 288 // Open device contexts |
287 typedef IDMap<Graphics2DDeviceContext, IDMapOwnPointer> Graphics2DMap; | 289 typedef IDMap<Graphics2DDeviceContext, IDMapOwnPointer> Graphics2DMap; |
288 Graphics2DMap graphic2d_contexts_; | 290 Graphics2DMap graphic2d_contexts_; |
289 IDMap<AudioDeviceContext, IDMapOwnPointer> audio_contexts_; | 291 IDMap<AudioDeviceContext, IDMapOwnPointer> audio_contexts_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // pointer to the callback specified by the plugin. Will be NULL otherwise. | 338 // pointer to the callback specified by the plugin. Will be NULL otherwise. |
337 NPChooseFileCallback current_choose_file_callback_; | 339 NPChooseFileCallback current_choose_file_callback_; |
338 void* current_choose_file_user_data_; | 340 void* current_choose_file_user_data_; |
339 | 341 |
340 scoped_ptr<WebKit::WebCursorInfo> cursor_; | 342 scoped_ptr<WebKit::WebCursorInfo> cursor_; |
341 | 343 |
342 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegatePepper); | 344 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegatePepper); |
343 }; | 345 }; |
344 | 346 |
345 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ | 347 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ |
OLD | NEW |