OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/npapi/webplugin_impl.h" | 5 #include "webkit/plugins/npapi/webplugin_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 &instance_size)) { | 104 &instance_size)) { |
105 NOTREACHED(); | 105 NOTREACHED(); |
106 return; | 106 return; |
107 } | 107 } |
108 | 108 |
109 resource_response_ = response; | 109 resource_response_ = response; |
110 } | 110 } |
111 | 111 |
112 // Receives individual part data from a multipart response. | 112 // Receives individual part data from a multipart response. |
113 virtual void didReceiveData( | 113 virtual void didReceiveData( |
114 WebURLLoader*, const char* data, int data_length, int length_received) { | 114 WebURLLoader*, const char* data, int data_length, int raw_data_length) { |
115 // TODO(ananta) | 115 // TODO(ananta) |
116 // We should defer further loads on multipart resources on the same lines | 116 // We should defer further loads on multipart resources on the same lines |
117 // as regular resources requested by plugins to prevent reentrancy. | 117 // as regular resources requested by plugins to prevent reentrancy. |
118 resource_client_->DidReceiveData( | 118 resource_client_->DidReceiveData( |
119 data, data_length, byte_range_lower_bound_); | 119 data, data_length, byte_range_lower_bound_); |
120 byte_range_lower_bound_ += data_length; | 120 byte_range_lower_bound_ += data_length; |
121 } | 121 } |
122 | 122 |
123 virtual void didFinishLoading(WebURLLoader*, double finishTime) {} | 123 virtual void didFinishLoading(WebURLLoader*, double finishTime) {} |
124 virtual void didFail(WebURLLoader*, const WebURLError&) {} | 124 virtual void didFail(WebURLLoader*, const WebURLError&) {} |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 if (client_info) { | 945 if (client_info) { |
946 client_info->pending_failure_notification = true; | 946 client_info->pending_failure_notification = true; |
947 } | 947 } |
948 } | 948 } |
949 } | 949 } |
950 } | 950 } |
951 | 951 |
952 void WebPluginImpl::didReceiveData(WebURLLoader* loader, | 952 void WebPluginImpl::didReceiveData(WebURLLoader* loader, |
953 const char *buffer, | 953 const char *buffer, |
954 int data_length, | 954 int data_length, |
955 int length_received) { | 955 int raw_data_length) { |
956 WebPluginResourceClient* client = GetClientFromLoader(loader); | 956 WebPluginResourceClient* client = GetClientFromLoader(loader); |
957 if (!client) | 957 if (!client) |
958 return; | 958 return; |
959 | 959 |
960 MultiPartResponseHandlerMap::iterator index = | 960 MultiPartResponseHandlerMap::iterator index = |
961 multi_part_response_map_.find(client); | 961 multi_part_response_map_.find(client); |
962 if (index != multi_part_response_map_.end()) { | 962 if (index != multi_part_response_map_.end()) { |
963 MultipartResponseDelegate* multi_part_handler = (*index).second; | 963 MultipartResponseDelegate* multi_part_handler = (*index).second; |
964 DCHECK(multi_part_handler != NULL); | 964 DCHECK(multi_part_handler != NULL); |
965 multi_part_handler->OnReceivedData(buffer, data_length); | 965 multi_part_handler->OnReceivedData(buffer, data_length, raw_data_length); |
966 } else { | 966 } else { |
967 loader->setDefersLoading(true); | 967 loader->setDefersLoading(true); |
968 client->DidReceiveData(buffer, data_length, 0); | 968 client->DidReceiveData(buffer, data_length, 0); |
969 } | 969 } |
970 } | 970 } |
971 | 971 |
972 void WebPluginImpl::didFinishLoading(WebURLLoader* loader, double finishTime) { | 972 void WebPluginImpl::didFinishLoading(WebURLLoader* loader, double finishTime) { |
973 ClientInfo* client_info = GetClientInfoFromLoader(loader); | 973 ClientInfo* client_info = GetClientInfoFromLoader(loader); |
974 if (client_info && client_info->client) { | 974 if (client_info && client_info->client) { |
975 MultiPartResponseHandlerMap::iterator index = | 975 MultiPartResponseHandlerMap::iterator index = |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 webframe_->setReferrerForRequest(*request, plugin_url_); | 1335 webframe_->setReferrerForRequest(*request, plugin_url_); |
1336 break; | 1336 break; |
1337 | 1337 |
1338 default: | 1338 default: |
1339 break; | 1339 break; |
1340 } | 1340 } |
1341 } | 1341 } |
1342 | 1342 |
1343 } // namespace npapi | 1343 } // namespace npapi |
1344 } // namespace webkit | 1344 } // namespace webkit |
OLD | NEW |