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

Side by Side Diff: webkit/plugins/npapi/plugin_instance.h

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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
« no previous file with comments | « webkit/plugins/npapi/plugin_host.cc ('k') | webkit/plugins/npapi/plugin_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // TODO: Need to deal with NPAPI's NPSavedData. 5 // TODO: Need to deal with NPAPI's NPSavedData.
6 // I haven't seen plugins use it yet. 6 // I haven't seen plugins use it yet.
7 7
8 #ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_INSTANCE_H__ 8 #ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_INSTANCE_H_
9 #define WEBKIT_GLUE_PLUGIN_PLUGIN_INSTANCE_H__ 9 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_INSTANCE_H_
10 10
11 #include <map> 11 #include <map>
12 #include <stack> 12 #include <stack>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/file_path.h" 17 #include "base/file_path.h"
18 #include "base/ref_counted.h" 18 #include "base/ref_counted.h"
19 #include "base/scoped_ptr.h" 19 #include "base/scoped_ptr.h"
20 #include "gfx/native_widget_types.h" 20 #include "gfx/native_widget_types.h"
21 #include "gfx/point.h" 21 #include "gfx/point.h"
22 #include "gfx/rect.h" 22 #include "gfx/rect.h"
23 #include "googleurl/src/gurl.h" 23 #include "googleurl/src/gurl.h"
24 #include "third_party/npapi/bindings/npapi.h" 24 #include "third_party/npapi/bindings/npapi.h"
25 #include "third_party/npapi/bindings/nphostapi.h" 25 #include "third_party/npapi/bindings/nphostapi.h"
26 26
27 class MessageLoop; 27 class MessageLoop;
28 28
29 namespace webkit_glue { 29 namespace webkit {
30 class WebPlugin; 30 namespace npapi {
31 class WebPluginResourceClient;
32 }
33 31
34 namespace NPAPI
35 {
36 class PluginLib; 32 class PluginLib;
37 class PluginHost; 33 class PluginHost;
38 class PluginStream; 34 class PluginStream;
39 class PluginStreamUrl; 35 class PluginStreamUrl;
40 class PluginDataStream; 36 class PluginDataStream;
37 class WebPlugin;
38 class WebPluginResourceClient;
39
41 #if defined(OS_MACOSX) 40 #if defined(OS_MACOSX)
42 class ScopedCurrentPluginEvent; 41 class ScopedCurrentPluginEvent;
43 #endif 42 #endif
44 43
45 // A PluginInstance is an active, running instance of a Plugin. 44 // A PluginInstance is an active, running instance of a Plugin.
46 // A single plugin may have many PluginInstances. 45 // A single plugin may have many PluginInstances.
47 class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> { 46 class PluginInstance : public base::RefCountedThreadSafe<PluginInstance> {
48 public: 47 public:
49 // Create a new instance of a plugin. The PluginInstance 48 // Create a new instance of a plugin. The PluginInstance
50 // will hold a reference to the plugin. 49 // will hold a reference to the plugin.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void set_windowless(bool value) { windowless_ = value; } 88 void set_windowless(bool value) { windowless_ = value; }
90 89
91 // Get/Set whether this instance is transparent. 90 // Get/Set whether this instance is transparent.
92 // This only applies to windowless plugins. Transparent 91 // This only applies to windowless plugins. Transparent
93 // plugins require that webkit paint the background. 92 // plugins require that webkit paint the background.
94 // Default is true. 93 // Default is true.
95 bool transparent() { return transparent_; } 94 bool transparent() { return transparent_; }
96 void set_transparent(bool value) { transparent_ = value; } 95 void set_transparent(bool value) { transparent_ = value; }
97 96
98 // Get/Set the WebPlugin associated with this instance 97 // Get/Set the WebPlugin associated with this instance
99 webkit_glue::WebPlugin* webplugin() { return webplugin_; } 98 WebPlugin* webplugin() { return webplugin_; }
100 void set_web_plugin(webkit_glue::WebPlugin* webplugin) { 99 void set_web_plugin(WebPlugin* webplugin) {
101 webplugin_ = webplugin; 100 webplugin_ = webplugin;
102 } 101 }
103 102
104 // Get the mimeType for this plugin stream 103 // Get the mimeType for this plugin stream
105 const std::string &mime_type() { return mime_type_; } 104 const std::string &mime_type() { return mime_type_; }
106 105
107 NPAPI::PluginLib* plugin_lib() { return plugin_; } 106 PluginLib* plugin_lib() { return plugin_; }
108 107
109 #if defined(OS_MACOSX) 108 #if defined(OS_MACOSX)
110 // Get/Set the Mac NPAPI drawing and event models 109 // Get/Set the Mac NPAPI drawing and event models
111 NPDrawingModel drawing_model() { return drawing_model_; } 110 NPDrawingModel drawing_model() { return drawing_model_; }
112 void set_drawing_model(NPDrawingModel value) { drawing_model_ = value; } 111 void set_drawing_model(NPDrawingModel value) { drawing_model_ = value; }
113 NPEventModel event_model() { return event_model_; } 112 NPEventModel event_model() { return event_model_; }
114 void set_event_model(NPEventModel value) { event_model_ = value; } 113 void set_event_model(NPEventModel value) { event_model_ = value; }
115 // Updates the instance's tracking of the location of the plugin location 114 // Updates the instance's tracking of the location of the plugin location
116 // relative to the upper left of the screen. 115 // relative to the upper left of the screen.
117 void set_plugin_origin(const gfx::Point& origin) { plugin_origin_ = origin; } 116 void set_plugin_origin(const gfx::Point& origin) { plugin_origin_ = origin; }
(...skipping 23 matching lines...) Expand all
141 140
142 // This is called when a stream is closed. We remove the stream from the 141 // This is called when a stream is closed. We remove the stream from the
143 // list, which releases the reference maintained to the stream. 142 // list, which releases the reference maintained to the stream.
144 void RemoveStream(PluginStream* stream); 143 void RemoveStream(PluginStream* stream);
145 144
146 // Closes all open streams on this instance. 145 // Closes all open streams on this instance.
147 void CloseStreams(); 146 void CloseStreams();
148 147
149 // Returns the WebPluginResourceClient object for a stream that has become 148 // Returns the WebPluginResourceClient object for a stream that has become
150 // seekable. 149 // seekable.
151 webkit_glue::WebPluginResourceClient* GetRangeRequest(int id); 150 WebPluginResourceClient* GetRangeRequest(int id);
152 151
153 // Have the plugin create it's script object. 152 // Have the plugin create it's script object.
154 NPObject *GetPluginScriptableObject(); 153 NPObject *GetPluginScriptableObject();
155 154
156 // WebViewDelegate methods that we implement. This is for handling 155 // WebViewDelegate methods that we implement. This is for handling
157 // callbacks during getURLNotify. 156 // callbacks during getURLNotify.
158 void DidFinishLoadWithReason(const GURL& url, NPReason reason, int notify_id); 157 void DidFinishLoadWithReason(const GURL& url, NPReason reason, int notify_id);
159 158
160 // If true, send the Mozilla user agent instead of Chrome's to the plugin. 159 // If true, send the Mozilla user agent instead of Chrome's to the plugin.
161 bool use_mozilla_user_agent() { return use_mozilla_user_agent_; } 160 bool use_mozilla_user_agent() { return use_mozilla_user_agent_; }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // player checks:(. They crash with version 6.0.11.3088 as well. The 276 // player checks:(. They crash with version 6.0.11.3088 as well. The
278 // following member just adds a 96 byte padding to our PluginInstance class 277 // following member just adds a 96 byte padding to our PluginInstance class
279 // which is passed in the ndata member. This magic number works correctly on 278 // which is passed in the ndata member. This magic number works correctly on
280 // Vista with UAC on or off :(. 279 // Vista with UAC on or off :(.
281 // NOTE: Please dont change the ordering of the member variables 280 // NOTE: Please dont change the ordering of the member variables
282 // New members should be added after this padding array. 281 // New members should be added after this padding array.
283 // TODO(iyengar) : Disassemble the Realplayer ndata structure and look into 282 // TODO(iyengar) : Disassemble the Realplayer ndata structure and look into
284 // the possiblity of conforming to it (http://b/issue?id=936667). We 283 // the possiblity of conforming to it (http://b/issue?id=936667). We
285 // could also log a bug with Real, which would save the effort. 284 // could also log a bug with Real, which would save the effort.
286 uint8 zero_padding_[96]; 285 uint8 zero_padding_[96];
287 scoped_refptr<NPAPI::PluginLib> plugin_; 286 scoped_refptr<PluginLib> plugin_;
288 NPP npp_; 287 NPP npp_;
289 scoped_refptr<PluginHost> host_; 288 scoped_refptr<PluginHost> host_;
290 NPPluginFuncs* npp_functions_; 289 NPPluginFuncs* npp_functions_;
291 std::vector<scoped_refptr<PluginStream> > open_streams_; 290 std::vector<scoped_refptr<PluginStream> > open_streams_;
292 gfx::PluginWindowHandle window_handle_; 291 gfx::PluginWindowHandle window_handle_;
293 bool windowless_; 292 bool windowless_;
294 bool transparent_; 293 bool transparent_;
295 webkit_glue::WebPlugin* webplugin_; 294 WebPlugin* webplugin_;
296 std::string mime_type_; 295 std::string mime_type_;
297 GURL get_url_; 296 GURL get_url_;
298 intptr_t get_notify_data_; 297 intptr_t get_notify_data_;
299 bool use_mozilla_user_agent_; 298 bool use_mozilla_user_agent_;
300 #if defined(OS_MACOSX) 299 #if defined(OS_MACOSX)
301 NPDrawingModel drawing_model_; 300 NPDrawingModel drawing_model_;
302 NPEventModel event_model_; 301 NPEventModel event_model_;
303 gfx::Point plugin_origin_; 302 gfx::Point plugin_origin_;
304 gfx::Rect containing_window_frame_; 303 gfx::Rect containing_window_frame_;
305 NPCocoaEvent* currently_handled_event_; // weak 304 NPCocoaEvent* currently_handled_event_; // weak
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 362 }
364 ~ScopedCurrentPluginEvent() { 363 ~ScopedCurrentPluginEvent() {
365 instance_->set_currently_handled_event(NULL); 364 instance_->set_currently_handled_event(NULL);
366 } 365 }
367 private: 366 private:
368 scoped_refptr<PluginInstance> instance_; 367 scoped_refptr<PluginInstance> instance_;
369 DISALLOW_COPY_AND_ASSIGN(ScopedCurrentPluginEvent); 368 DISALLOW_COPY_AND_ASSIGN(ScopedCurrentPluginEvent);
370 }; 369 };
371 #endif 370 #endif
372 371
373 } // namespace NPAPI 372 } // namespace npapi
373 } // namespace webkit
374 374
375 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_INSTANCE_H__ 375 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_INSTANCE_H_
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_host.cc ('k') | webkit/plugins/npapi/plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698