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

Side by Side Diff: chrome/renderer/webplugin_delegate_proxy.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 | « chrome/plugin/webplugin_delegate_stub.cc ('k') | webkit/glue/plugins/plugin_instance.cc » ('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 #include "chrome/renderer/webplugin_delegate_proxy.h" 5 #include "chrome/renderer/webplugin_delegate_proxy.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 8
9 #include "generated_resources.h" 9 #include "generated_resources.h"
10 10
(...skipping 19 matching lines...) Expand all
30 #include "webkit/glue/webkit_glue.h" 30 #include "webkit/glue/webkit_glue.h"
31 #include "webkit/glue/webplugin.h" 31 #include "webkit/glue/webplugin.h"
32 #include "webkit/glue/webview.h" 32 #include "webkit/glue/webview.h"
33 33
34 // Proxy for WebPluginResourceClient. The object owns itself after creation, 34 // Proxy for WebPluginResourceClient. The object owns itself after creation,
35 // deleting itself after its callback has been called. 35 // deleting itself after its callback has been called.
36 class ResourceClientProxy : public WebPluginResourceClient { 36 class ResourceClientProxy : public WebPluginResourceClient {
37 public: 37 public:
38 ResourceClientProxy(PluginChannelHost* channel, int instance_id) 38 ResourceClientProxy(PluginChannelHost* channel, int instance_id)
39 : channel_(channel), instance_id_(instance_id), resource_id_(0), 39 : channel_(channel), instance_id_(instance_id), resource_id_(0),
40 notify_needed_(false), notify_data_(NULL) { 40 notify_needed_(false), notify_data_(NULL),
41 multibyte_response_expected_(false) {
41 } 42 }
42 43
43 ~ResourceClientProxy() { 44 ~ResourceClientProxy() {
44 } 45 }
45 46
46 void Initialize(int resource_id, const std::string &url, bool notify_needed, 47 void Initialize(int resource_id, const std::string &url, bool notify_needed,
47 void *notify_data, void* existing_stream) { 48 void *notify_data, void* existing_stream) {
48 resource_id_ = resource_id; 49 resource_id_ = resource_id;
49 url_ = url; 50 url_ = url;
50 notify_needed_ = notify_needed; 51 notify_needed_ = notify_needed;
51 notify_data_ = notify_data; 52 notify_data_ = notify_data;
52 53
53 PluginMsg_URLRequestReply_Params params; 54 PluginMsg_URLRequestReply_Params params;
54 params.resource_id = resource_id; 55 params.resource_id = resource_id;
55 params.url = url_; 56 params.url = url_;
56 params.notify_needed = notify_needed_; 57 params.notify_needed = notify_needed_;
57 params.notify_data = notify_data_; 58 params.notify_data = notify_data_;
58 params.stream = existing_stream; 59 params.stream = existing_stream;
59 60
61 multibyte_response_expected_ = (existing_stream != NULL);
62
60 channel_->Send(new PluginMsg_HandleURLRequestReply(instance_id_, params)); 63 channel_->Send(new PluginMsg_HandleURLRequestReply(instance_id_, params));
61 } 64 }
62 65
63 // PluginResourceClient implementation: 66 // PluginResourceClient implementation:
64 void WillSendRequest(const GURL& url) { 67 void WillSendRequest(const GURL& url) {
65 DCHECK(channel_ != NULL); 68 DCHECK(channel_ != NULL);
66 channel_->Send(new PluginMsg_WillSendRequest(instance_id_, resource_id_, 69 channel_->Send(new PluginMsg_WillSendRequest(instance_id_, resource_id_,
67 url)); 70 url));
68 } 71 }
69 72
70 void DidReceiveResponse(const std::string& mime_type, 73 void DidReceiveResponse(const std::string& mime_type,
71 const std::string& headers, 74 const std::string& headers,
72 uint32 expected_length, 75 uint32 expected_length,
73 uint32 last_modified, 76 uint32 last_modified,
77 bool request_is_seekable,
74 bool* cancel) { 78 bool* cancel) {
75 DCHECK(channel_ != NULL); 79 DCHECK(channel_ != NULL);
76 PluginMsg_DidReceiveResponseParams params; 80 PluginMsg_DidReceiveResponseParams params;
77 params.id = resource_id_; 81 params.id = resource_id_;
78 params.mime_type = mime_type; 82 params.mime_type = mime_type;
79 params.headers = headers; 83 params.headers = headers;
80 params.expected_length = expected_length; 84 params.expected_length = expected_length;
81 params.last_modified = last_modified; 85 params.last_modified = last_modified;
86 params.request_is_seekable = request_is_seekable;
82 // Grab a reference on the underlying channel so it does not get 87 // Grab a reference on the underlying channel so it does not get
83 // deleted from under us. 88 // deleted from under us.
84 scoped_refptr<PluginChannelHost> channel_ref(channel_); 89 scoped_refptr<PluginChannelHost> channel_ref(channel_);
85 channel_->Send(new PluginMsg_DidReceiveResponse(instance_id_, params, 90 channel_->Send(new PluginMsg_DidReceiveResponse(instance_id_, params,
86 cancel)); 91 cancel));
87 } 92 }
88 93
89 void DidReceiveData(const char* buffer, int length, int data_offset) { 94 void DidReceiveData(const char* buffer, int length, int data_offset) {
90 DCHECK(channel_ != NULL); 95 DCHECK(channel_ != NULL);
91 DCHECK(length > 0); 96 DCHECK(length > 0);
(...skipping 14 matching lines...) Expand all
106 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 111 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
107 } 112 }
108 113
109 void DidFail() { 114 void DidFail() {
110 DCHECK(channel_ != NULL); 115 DCHECK(channel_ != NULL);
111 channel_->Send(new PluginMsg_DidFail(instance_id_, resource_id_)); 116 channel_->Send(new PluginMsg_DidFail(instance_id_, resource_id_));
112 channel_ = NULL; 117 channel_ = NULL;
113 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 118 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
114 } 119 }
115 120
121 bool IsMultiByteResponseExpected() {
122 return multibyte_response_expected_;
123 }
124
116 private: 125 private:
117 int resource_id_; 126 int resource_id_;
118 int instance_id_; 127 int instance_id_;
119 scoped_refptr<PluginChannelHost> channel_; 128 scoped_refptr<PluginChannelHost> channel_;
120 std::string url_; 129 std::string url_;
121 bool notify_needed_; 130 bool notify_needed_;
122 void* notify_data_; 131 void* notify_data_;
132 // Set to true if the response expected is a multibyte response.
133 // For e.g. response for a HTTP byte range request.
134 bool multibyte_response_expected_;
123 }; 135 };
124 136
125 WebPluginDelegateProxy* WebPluginDelegateProxy::Create( 137 WebPluginDelegateProxy* WebPluginDelegateProxy::Create(
126 const GURL& url, 138 const GURL& url,
127 const std::string& mime_type, 139 const std::string& mime_type,
128 const std::string& clsid, 140 const std::string& clsid,
129 RenderView* render_view) { 141 RenderView* render_view) {
130 return new WebPluginDelegateProxy(mime_type, clsid, render_view); 142 return new WebPluginDelegateProxy(mime_type, clsid, render_view);
131 } 143 }
132 144
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 plugin_->CancelDocumentLoad(); 751 plugin_->CancelDocumentLoad();
740 } 752 }
741 753
742 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( 754 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest(
743 const std::string& url, const std::string& range_info, 755 const std::string& url, const std::string& range_info,
744 HANDLE existing_stream, bool notify_needed, HANDLE notify_data) { 756 HANDLE existing_stream, bool notify_needed, HANDLE notify_data) {
745 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), 757 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(),
746 existing_stream, notify_needed, 758 existing_stream, notify_needed,
747 notify_data); 759 notify_data);
748 } 760 }
OLDNEW
« no previous file with comments | « chrome/plugin/webplugin_delegate_stub.cc ('k') | webkit/glue/plugins/plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698