| 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 WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PLUGIN_STREAM_H_ |
| 6 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PLUGIN_STREAM_H_ |
| 7 |
| 8 #include "build/build_config.h" |
| 7 | 9 |
| 8 #include <string> | 10 #include <string> |
| 9 #include <vector> | 11 #include <vector> |
| 10 | 12 |
| 13 #if defined(OS_POSIX) |
| 11 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #endif |
| 12 #include "base/ref_counted.h" | 16 #include "base/ref_counted.h" |
| 13 #include "build/build_config.h" | |
| 14 #include "third_party/npapi/bindings/npapi.h" | 17 #include "third_party/npapi/bindings/npapi.h" |
| 15 | 18 |
| 16 namespace webkit { | 19 namespace webkit_glue { |
| 17 namespace npapi { | 20 class WebPluginResourceClient; |
| 21 } |
| 22 |
| 23 namespace NPAPI { |
| 18 | 24 |
| 19 class PluginInstance; | 25 class PluginInstance; |
| 20 class WebPluginResourceClient; | |
| 21 | 26 |
| 22 // Base class for a NPAPI stream. Tracks basic elements | 27 // Base class for a NPAPI stream. Tracks basic elements |
| 23 // of a stream for NPAPI notifications and stream position. | 28 // of a stream for NPAPI notifications and stream position. |
| 24 class PluginStream : public base::RefCounted<PluginStream> { | 29 class PluginStream : public base::RefCounted<PluginStream> { |
| 25 public: | 30 public: |
| 26 // Create a new PluginStream object. If needNotify is true, then the | 31 // Create a new PluginStream object. If needNotify is true, then the |
| 27 // plugin will be notified when the stream has been fully sent. | 32 // plugin will be notified when the stream has been fully sent. |
| 28 PluginStream(PluginInstance *instance, | 33 PluginStream(PluginInstance *instance, |
| 29 const char *url, | 34 const char *url, |
| 30 bool need_notify, | 35 bool need_notify, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 52 | 57 |
| 53 // Write the result as a file. | 58 // Write the result as a file. |
| 54 void WriteAsFile(); | 59 void WriteAsFile(); |
| 55 | 60 |
| 56 // Notify the plugin that a stream is complete. | 61 // Notify the plugin that a stream is complete. |
| 57 void Notify(NPReason reason); | 62 void Notify(NPReason reason); |
| 58 | 63 |
| 59 // Close the stream. | 64 // Close the stream. |
| 60 virtual bool Close(NPReason reason); | 65 virtual bool Close(NPReason reason); |
| 61 | 66 |
| 62 virtual WebPluginResourceClient* AsResourceClient(); | 67 virtual webkit_glue::WebPluginResourceClient* AsResourceClient(); |
| 63 | 68 |
| 64 // Cancels any HTTP requests initiated by the stream. | 69 // Cancels any HTTP requests initiated by the stream. |
| 65 virtual void CancelRequest() {} | 70 virtual void CancelRequest() {} |
| 66 | 71 |
| 67 const NPStream* stream() const { return &stream_; } | 72 const NPStream* stream() const { return &stream_; } |
| 68 | 73 |
| 69 // setter/getter for the seekable attribute on the stream. | 74 // setter/getter for the seekable attribute on the stream. |
| 70 bool seekable() const { return seekable_stream_; } | 75 bool seekable() const { return seekable_stream_; } |
| 71 | 76 |
| 72 void set_seekable(bool seekable) { seekable_stream_ = seekable; } | 77 void set_seekable(bool seekable) { seekable_stream_ = seekable; } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 FILE* temp_file_; | 144 FILE* temp_file_; |
| 140 FilePath temp_file_path_; | 145 FilePath temp_file_path_; |
| 141 #endif | 146 #endif |
| 142 std::vector<char> delivery_data_; | 147 std::vector<char> delivery_data_; |
| 143 int data_offset_; | 148 int data_offset_; |
| 144 bool seekable_stream_; | 149 bool seekable_stream_; |
| 145 std::string mime_type_; | 150 std::string mime_type_; |
| 146 DISALLOW_COPY_AND_ASSIGN(PluginStream); | 151 DISALLOW_COPY_AND_ASSIGN(PluginStream); |
| 147 }; | 152 }; |
| 148 | 153 |
| 149 } // namespace npapi | 154 } // namespace NPAPI |
| 150 } // namespace webkit | |
| 151 | 155 |
| 152 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_STREAM_H_ | 156 #endif // WEBKIT_GLUE_PLUGINS_PLUGIN_STREAM_H_ |
| OLD | NEW |