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