| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PLUGINS_NPAPI_PLUGIN_INSTANCE_H_ | 8 #ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_INSTANCE_H_ |
| 9 #define WEBKIT_PLUGINS_NPAPI_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/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 21 #include "third_party/npapi/bindings/npapi.h" | 21 #include "third_party/npapi/bindings/npapi.h" |
| 22 #include "third_party/npapi/bindings/nphostapi.h" | 22 #include "third_party/npapi/bindings/nphostapi.h" |
| 23 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
| 24 #include "ui/gfx/point.h" | 24 #include "ui/gfx/point.h" |
| 25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
| 26 #include "webkit/plugins/npapi/plugin_lib.h" |
| 26 | 27 |
| 27 class MessageLoop; | 28 class MessageLoop; |
| 28 | 29 |
| 29 namespace webkit { | 30 namespace webkit { |
| 30 namespace npapi { | 31 namespace npapi { |
| 31 | 32 |
| 32 class PluginLib; | 33 class PluginLib; |
| 33 class PluginHost; | 34 class PluginHost; |
| 34 class PluginStream; | 35 class PluginStream; |
| 35 class PluginStreamUrl; | 36 class PluginStreamUrl; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 96 |
| 96 // Get/Set the WebPlugin associated with this instance | 97 // Get/Set the WebPlugin associated with this instance |
| 97 WebPlugin* webplugin() { return webplugin_; } | 98 WebPlugin* webplugin() { return webplugin_; } |
| 98 void set_web_plugin(WebPlugin* webplugin) { | 99 void set_web_plugin(WebPlugin* webplugin) { |
| 99 webplugin_ = webplugin; | 100 webplugin_ = webplugin; |
| 100 } | 101 } |
| 101 | 102 |
| 102 // Get the mimeType for this plugin stream | 103 // Get the mimeType for this plugin stream |
| 103 const std::string &mime_type() { return mime_type_; } | 104 const std::string &mime_type() { return mime_type_; } |
| 104 | 105 |
| 105 PluginLib* plugin_lib() { return plugin_; } | 106 scoped_refptr<PluginLib> plugin_lib() { return plugin_; } |
| 106 | 107 |
| 107 #if defined(OS_MACOSX) | 108 #if defined(OS_MACOSX) |
| 108 // Get/Set the Mac NPAPI drawing and event models | 109 // Get/Set the Mac NPAPI drawing and event models |
| 109 NPDrawingModel drawing_model() { return drawing_model_; } | 110 NPDrawingModel drawing_model() { return drawing_model_; } |
| 110 void set_drawing_model(NPDrawingModel value) { drawing_model_ = value; } | 111 void set_drawing_model(NPDrawingModel value) { drawing_model_ = value; } |
| 111 NPEventModel event_model() { return event_model_; } | 112 NPEventModel event_model() { return event_model_; } |
| 112 void set_event_model(NPEventModel value) { event_model_ = value; } | 113 void set_event_model(NPEventModel value) { event_model_ = value; } |
| 113 // 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 |
| 114 // relative to the upper left of the screen. | 115 // relative to the upper left of the screen. |
| 115 void set_plugin_origin(const gfx::Point& origin) { plugin_origin_ = origin; } | 116 void set_plugin_origin(const gfx::Point& origin) { plugin_origin_ = origin; } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 132 | 133 |
| 133 // For each instance, we track all streams. When the | 134 // For each instance, we track all streams. When the |
| 134 // instance closes, all remaining streams are also | 135 // instance closes, all remaining streams are also |
| 135 // closed. All streams associated with this instance | 136 // closed. All streams associated with this instance |
| 136 // should call AddStream so that they can be cleaned | 137 // should call AddStream so that they can be cleaned |
| 137 // up when the instance shuts down. | 138 // up when the instance shuts down. |
| 138 void AddStream(PluginStream* stream); | 139 void AddStream(PluginStream* stream); |
| 139 | 140 |
| 140 // 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 |
| 141 // list, which releases the reference maintained to the stream. | 142 // list, which releases the reference maintained to the stream. |
| 142 void RemoveStream(PluginStream* stream); | 143 void RemoveStream(scoped_refptr<PluginStream> stream); |
| 143 | 144 |
| 144 // Closes all open streams on this instance. | 145 // Closes all open streams on this instance. |
| 145 void CloseStreams(); | 146 void CloseStreams(); |
| 146 | 147 |
| 147 // Returns the WebPluginResourceClient object for a stream that has become | 148 // Returns the WebPluginResourceClient object for a stream that has become |
| 148 // seekable. | 149 // seekable. |
| 149 WebPluginResourceClient* GetRangeRequest(int id); | 150 WebPluginResourceClient* GetRangeRequest(int id); |
| 150 | 151 |
| 151 // Have the plugin create it's script object. | 152 // Have the plugin create it's script object. |
| 152 NPObject* GetPluginScriptableObject(); | 153 NPObject* GetPluginScriptableObject(); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 private: | 364 private: |
| 364 scoped_refptr<PluginInstance> instance_; | 365 scoped_refptr<PluginInstance> instance_; |
| 365 DISALLOW_COPY_AND_ASSIGN(ScopedCurrentPluginEvent); | 366 DISALLOW_COPY_AND_ASSIGN(ScopedCurrentPluginEvent); |
| 366 }; | 367 }; |
| 367 #endif | 368 #endif |
| 368 | 369 |
| 369 } // namespace npapi | 370 } // namespace npapi |
| 370 } // namespace webkit | 371 } // namespace webkit |
| 371 | 372 |
| 372 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_INSTANCE_H_ | 373 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |