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

Side by Side Diff: webkit/glue/plugins/plugin_stream.cc

Issue 14122: Handle HTTP 200 responses received in response to byte range requests issued... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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/glue/plugins/plugin_stream.h ('k') | webkit/glue/plugins/plugin_stream_url.h » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 : Support NP_ASFILEONLY mode 5 // TODO : Support NP_ASFILEONLY mode
6 // TODO : Support NP_SEEK mode 6 // TODO : Support NP_SEEK mode
7 // TODO : Support SEEKABLE=true in NewStream 7 // TODO : Support SEEKABLE=true in NewStream
8 8
9 #include "webkit/glue/plugins/plugin_stream.h" 9 #include "webkit/glue/plugins/plugin_stream.h"
10 10
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "webkit/glue/plugins/plugin_instance.h" 13 #include "webkit/glue/plugins/plugin_instance.h"
14 #include "webkit/glue/webkit_glue.h" 14 #include "webkit/glue/webkit_glue.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 16
17 namespace NPAPI { 17 namespace NPAPI {
18 18
19 PluginStream::~PluginStream() { 19 PluginStream::~PluginStream() {
20 // always close our temporary files. 20 // always close our temporary files.
21 CloseTempFile(); 21 CloseTempFile();
22 free(const_cast<char*>(stream_.url)); 22 free(const_cast<char*>(stream_.url));
23 } 23 }
24 24
25 bool PluginStream::Open(const std::string &mime_type, 25 bool PluginStream::Open(const std::string &mime_type,
26 const std::string &headers, 26 const std::string &headers,
27 uint32 length, 27 uint32 length,
28 uint32 last_modified) { 28 uint32 last_modified,
29 bool request_is_seekable) {
29 headers_ = headers; 30 headers_ = headers;
30 NPP id = instance_->npp(); 31 NPP id = instance_->npp();
31 stream_.end = length; 32 stream_.end = length;
32 stream_.lastmodified = last_modified; 33 stream_.lastmodified = last_modified;
33 stream_.pdata = 0; 34 stream_.pdata = 0;
34 stream_.ndata = id->ndata; 35 stream_.ndata = id->ndata;
35 stream_.notifyData = notify_data_; 36 stream_.notifyData = notify_data_;
36 37
37 bool seekable_stream = false; 38 bool seekable_stream = false;
38 if (!headers_.empty()) { 39 if (request_is_seekable && !headers_.empty()) {
39 stream_.headers = headers_.c_str(); 40 stream_.headers = headers_.c_str();
40 if (headers_.find("Accept-Ranges: bytes") != std::string::npos) { 41 if (headers_.find("Accept-Ranges: bytes") != std::string::npos) {
41 seekable_stream = true; 42 seekable_stream = true;
42 } 43 }
43 } 44 }
44 45
45 const char *char_mime_type = "application/x-unknown-content-type"; 46 const char *char_mime_type = "application/x-unknown-content-type";
46 std::string temp_mime_type; 47 std::string temp_mime_type;
47 if (!mime_type.empty()) { 48 if (!mime_type.empty()) {
48 char_mime_type = mime_type.c_str(); 49 char_mime_type = mime_type.c_str();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 237
237 void PluginStream::Notify(NPReason reason) { 238 void PluginStream::Notify(NPReason reason) {
238 if (notify_needed_) { 239 if (notify_needed_) {
239 instance_->NPP_URLNotify(stream_.url, reason, notify_data_); 240 instance_->NPP_URLNotify(stream_.url, reason, notify_data_);
240 notify_needed_ = false; 241 notify_needed_ = false;
241 } 242 }
242 } 243 }
243 244
244 } // namespace NPAPI 245 } // namespace NPAPI
245 246
OLDNEW
« no previous file with comments | « webkit/glue/plugins/plugin_stream.h ('k') | webkit/glue/plugins/plugin_stream_url.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698