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

Side by Side Diff: content/child/npapi/plugin_stream.h

Issue 23503043: Load NPAPI plugin resources through the browser process directly instead of going through the render (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 3 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_ 5 #ifndef CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_
6 #define CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_ 6 #define CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 11 matching lines...) Expand all
22 // of a stream for NPAPI notifications and stream position. 22 // of a stream for NPAPI notifications and stream position.
23 class PluginStream : public base::RefCounted<PluginStream> { 23 class PluginStream : public base::RefCounted<PluginStream> {
24 public: 24 public:
25 // Create a new PluginStream object. If needNotify is true, then the 25 // Create a new PluginStream object. If needNotify is true, then the
26 // plugin will be notified when the stream has been fully sent. 26 // plugin will be notified when the stream has been fully sent.
27 PluginStream(PluginInstance* instance, 27 PluginStream(PluginInstance* instance,
28 const char* url, 28 const char* url,
29 bool need_notify, 29 bool need_notify,
30 void* notify_data); 30 void* notify_data);
31 31
32 // In case of a redirect, this can be called to update the url. But it must
33 // be called before Open().
34 void UpdateUrl(const char* url);
35
36 // Opens the stream to the Plugin. 32 // Opens the stream to the Plugin.
37 // If the mime-type is not specified, we'll try to find one based on the 33 // If the mime-type is not specified, we'll try to find one based on the
38 // mime-types table and the extension (if any) in the URL. 34 // mime-types table and the extension (if any) in the URL.
39 // If the size of the stream is known, use length to set the size. If 35 // If the size of the stream is known, use length to set the size. If
40 // not known, set length to 0. 36 // not known, set length to 0.
41 // The request_is_seekable parameter indicates whether byte range requests 37 // The request_is_seekable parameter indicates whether byte range requests
42 // can be issued on the stream. 38 // can be issued on the stream.
43 bool Open(const std::string &mime_type, 39 bool Open(const std::string &mime_type,
44 const std::string &headers, 40 const std::string &headers,
45 uint32 length, 41 uint32 length,
(...skipping 10 matching lines...) Expand all
56 void Notify(NPReason reason); 52 void Notify(NPReason reason);
57 53
58 // Close the stream. 54 // Close the stream.
59 virtual bool Close(NPReason reason); 55 virtual bool Close(NPReason reason);
60 56
61 virtual WebPluginResourceClient* AsResourceClient(); 57 virtual WebPluginResourceClient* AsResourceClient();
62 58
63 // Cancels any HTTP requests initiated by the stream. 59 // Cancels any HTTP requests initiated by the stream.
64 virtual void CancelRequest() {} 60 virtual void CancelRequest() {}
65 61
66 const NPStream* stream() const { return &stream_; } 62 NPStream* stream() { return &stream_; }
63
64 PluginInstance* instance() { return instance_.get(); }
67 65
68 // setter/getter for the seekable attribute on the stream. 66 // setter/getter for the seekable attribute on the stream.
69 bool seekable() const { return seekable_stream_; } 67 bool seekable() const { return seekable_stream_; }
70 68
71 void set_seekable(bool seekable) { seekable_stream_ = seekable; } 69 void set_seekable(bool seekable) { seekable_stream_ = seekable; }
72 70
73 // getters for reading the notification related attributes on the stream. 71 // getters for reading the notification related attributes on the stream.
74 bool notify_needed() const { return notify_needed_; } 72 bool notify_needed() const { return notify_needed_; }
75 73
76 void* notify_data() const { return notify_data_; } 74 void* notify_data() const { return notify_data_; }
77 75
78 std::string pending_redirect_url() const { return pending_redirect_url_; }
79
80 protected: 76 protected:
81 friend class base::RefCounted<PluginStream>; 77 friend class base::RefCounted<PluginStream>;
82 78
83 virtual ~PluginStream(); 79 virtual ~PluginStream();
84 80
85 PluginInstance* instance() { return instance_.get(); }
86
87 // Check if the stream is open. 81 // Check if the stream is open.
88 bool open() { return opened_; } 82 bool open() { return opened_; }
89 83
90 // If the plugin participates in HTTP URL redirect handling then this member
91 // holds the url being redirected to while we wait for the plugin to make a
92 // decision on whether to allow or deny the redirect.
93 std::string pending_redirect_url_;
94
95 private: 84 private:
96 // Per platform method to reset the temporary file handle. 85 // Per platform method to reset the temporary file handle.
97 void ResetTempFileHandle(); 86 void ResetTempFileHandle();
98 87
99 // Per platform method to reset the temporary file name. 88 // Per platform method to reset the temporary file name.
100 void ResetTempFileName(); 89 void ResetTempFileName();
101 90
102 // Open a temporary file for this stream. 91 // Open a temporary file for this stream.
103 // If successful, will set temp_file_name_, temp_file_handle_, and 92 // If successful, will set temp_file_name_, temp_file_handle_, and
104 // return true. 93 // return true.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 std::vector<char> delivery_data_; 139 std::vector<char> delivery_data_;
151 int data_offset_; 140 int data_offset_;
152 bool seekable_stream_; 141 bool seekable_stream_;
153 std::string mime_type_; 142 std::string mime_type_;
154 DISALLOW_COPY_AND_ASSIGN(PluginStream); 143 DISALLOW_COPY_AND_ASSIGN(PluginStream);
155 }; 144 };
156 145
157 } // namespace content 146 } // namespace content
158 147
159 #endif // CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_ 148 #endif // CONTENT_CHILD_NPAPI_PLUGIN_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698