Index: content/renderer/npapi/webplugin_impl.cc |
=================================================================== |
--- content/renderer/npapi/webplugin_impl.cc (revision 223347) |
+++ content/renderer/npapi/webplugin_impl.cc (working copy) |
@@ -95,9 +95,7 @@ |
class MultiPartResponseClient : public WebURLLoaderClient { |
public: |
explicit MultiPartResponseClient(WebPluginResourceClient* resource_client) |
- : resource_client_(resource_client) { |
- Clear(); |
- } |
+ : byte_range_lower_bound_(0), resource_client_(resource_client) {} |
virtual void willSendRequest( |
WebURLLoader*, WebURLRequest&, const WebURLResponse&) {} |
@@ -108,17 +106,14 @@ |
// response. |
virtual void didReceiveResponse( |
WebURLLoader*, const WebURLResponse& response) { |
- int64 instance_size; |
+ int64 byte_range_upper_bound, instance_size; |
if (!MultipartResponseDelegate::ReadContentRanges( |
response, |
&byte_range_lower_bound_, |
- &byte_range_upper_bound_, |
+ &byte_range_upper_bound, |
&instance_size)) { |
NOTREACHED(); |
- return; |
} |
- |
- resource_response_ = response; |
} |
// Receives individual part data from a multipart response. |
@@ -137,18 +132,9 @@ |
virtual void didFinishLoading(WebURLLoader*, double finishTime) {} |
virtual void didFail(WebURLLoader*, const WebURLError&) {} |
- void Clear() { |
- resource_response_.reset(); |
- byte_range_lower_bound_ = 0; |
- byte_range_upper_bound_ = 0; |
- } |
- |
private: |
- WebURLResponse resource_response_; |
// The lower bound of the byte range. |
int64 byte_range_lower_bound_; |
- // The upper bound of the byte range. |
- int64 byte_range_upper_bound_; |
// The handler for the data. |
WebPluginResourceClient* resource_client_; |
}; |
@@ -946,6 +932,8 @@ |
void WebPluginImpl::didReceiveResponse(WebURLLoader* loader, |
const WebURLResponse& response) { |
+ // TODO(jam): THIS LOGIC IS COPIED IN PluginURLFetcher::OnReceivedResponse |
+ // until kDirectNPAPIRequests is the default and we can remove this old path. |
static const int kHttpPartialResponseStatusCode = 206; |
static const int kHttpResponseSuccessStatusCode = 200; |
@@ -1079,10 +1067,7 @@ |
if (index != multi_part_response_map_.end()) { |
delete (*index).second; |
multi_part_response_map_.erase(index); |
- if (render_view_.get()) { |
- // TODO(darin): Make is_loading_ be a counter! |
- render_view_->didStopLoading(); |
- } |
+ DidStopLoading(); |
} |
loader->setDefersLoading(true); |
WebPluginResourceClient* resource_client = client_info->client; |
@@ -1226,8 +1211,8 @@ |
GURL first_party_for_cookies = webframe_->document().firstPartyForCookies(); |
delegate_->FetchURL(resource_id, notify_id, complete_url, |
- first_party_for_cookies, method, std::string(buf, len), |
- referrer, notify_redirects, is_plugin_src_load, 0, |
+ first_party_for_cookies, method, buf, len, referrer, |
+ notify_redirects, is_plugin_src_load, 0, |
render_view_->routing_id()); |
} else { |
WebPluginResourceClient* resource_client = delegate_->CreateResourceClient( |
@@ -1331,6 +1316,20 @@ |
load_manually_ ? NO_REFERRER : PLUGIN_SRC, false, false); |
} |
+void WebPluginImpl::DidStartLoading() { |
+ if (render_view_.get()) { |
+ // TODO(darin): Make is_loading_ be a counter! |
+ render_view_->didStartLoading(); |
+ } |
+} |
+ |
+void WebPluginImpl::DidStopLoading() { |
+ if (render_view_.get()) { |
+ // TODO(darin): Make is_loading_ be a counter! |
+ render_view_->didStopLoading(); |
+ } |
+} |
+ |
void WebPluginImpl::SetDeferResourceLoading(unsigned long resource_id, |
bool defer) { |
std::vector<ClientInfo>::iterator client_index = clients_.begin(); |
@@ -1366,15 +1365,14 @@ |
bool WebPluginImpl::HandleHttpMultipartResponse( |
const WebURLResponse& response, WebPluginResourceClient* client) { |
std::string multipart_boundary; |
+ std::string content_type = |
ananta
2013/09/16 18:35:41
Remove?
jam
2013/09/16 19:31:34
Done, thanks. that was left over code from another
|
+ response.httpHeaderField(WebString::fromUTF8("Content-Type")).utf8(); |
if (!MultipartResponseDelegate::ReadMultipartBoundary( |
response, &multipart_boundary)) { |
return false; |
} |
- if (render_view_.get()) { |
- // TODO(darin): Make is_loading_ be a counter! |
- render_view_->didStartLoading(); |
- } |
+ DidStartLoading(); |
MultiPartResponseClient* multi_part_response_client = |
new MultiPartResponseClient(client); |