OLD | NEW |
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 #include "content/renderer/npapi/webplugin_impl.h" | 5 #include "content/renderer/npapi/webplugin_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "cc/layers/io_surface_layer.h" | 16 #include "cc/layers/io_surface_layer.h" |
17 #include "content/child/appcache/web_application_cache_host_impl.h" | 17 #include "content/child/appcache/web_application_cache_host_impl.h" |
18 #include "content/child/npapi/plugin_host.h" | 18 #include "content/child/npapi/plugin_host.h" |
19 #include "content/child/npapi/plugin_instance.h" | 19 #include "content/child/npapi/plugin_instance.h" |
20 #include "content/child/npapi/webplugin_delegate_impl.h" | 20 #include "content/child/npapi/webplugin_delegate_impl.h" |
21 #include "content/child/npapi/webplugin_resource_client.h" | 21 #include "content/child/npapi/webplugin_resource_client.h" |
22 #include "content/common/view_messages.h" | 22 #include "content/common/view_messages.h" |
23 #include "content/public/common/content_constants.h" | 23 #include "content/public/common/content_constants.h" |
24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
25 #include "content/public/renderer/content_renderer_client.h" | 25 #include "content/public/renderer/content_renderer_client.h" |
26 #include "content/renderer/npapi/webplugin_delegate_proxy.h" | 26 #include "content/renderer/npapi/webplugin_delegate_proxy.h" |
27 #include "content/renderer/render_process.h" | 27 #include "content/renderer/render_process.h" |
| 28 #include "content/renderer/render_thread_impl.h" |
28 #include "content/renderer/render_view_impl.h" | 29 #include "content/renderer/render_view_impl.h" |
29 #include "net/base/escape.h" | 30 #include "net/base/escape.h" |
30 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
31 #include "net/http/http_response_headers.h" | 32 #include "net/http/http_response_headers.h" |
32 #include "skia/ext/platform_canvas.h" | 33 #include "skia/ext/platform_canvas.h" |
33 #include "third_party/WebKit/public/platform/WebCString.h" | 34 #include "third_party/WebKit/public/platform/WebCString.h" |
34 #include "third_party/WebKit/public/platform/WebCookieJar.h" | 35 #include "third_party/WebKit/public/platform/WebCookieJar.h" |
35 #include "third_party/WebKit/public/platform/WebData.h" | 36 #include "third_party/WebKit/public/platform/WebData.h" |
36 #include "third_party/WebKit/public/platform/WebHTTPBody.h" | 37 #include "third_party/WebKit/public/platform/WebHTTPBody.h" |
37 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" | 38 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 return; | 973 return; |
973 } | 974 } |
974 int64 upper_bound = 0, instance_size = 0; | 975 int64 upper_bound = 0, instance_size = 0; |
975 // Single range requested - go through original processing for | 976 // Single range requested - go through original processing for |
976 // non-multipart requests, but update data offset. | 977 // non-multipart requests, but update data offset. |
977 MultipartResponseDelegate::ReadContentRanges(response, | 978 MultipartResponseDelegate::ReadContentRanges(response, |
978 &client_info->data_offset, | 979 &client_info->data_offset, |
979 &upper_bound, | 980 &upper_bound, |
980 &instance_size); | 981 &instance_size); |
981 } else if (response.httpStatusCode() == kHttpResponseSuccessStatusCode) { | 982 } else if (response.httpStatusCode() == kHttpResponseSuccessStatusCode) { |
| 983 RenderThreadImpl::current()->RecordUserMetrics("Plugin_200ForByteRange"); |
982 // If the client issued a byte range request and the server responds with | 984 // If the client issued a byte range request and the server responds with |
983 // HTTP 200 OK, it indicates that the server does not support byte range | 985 // HTTP 200 OK, it indicates that the server does not support byte range |
984 // requests. | 986 // requests. |
985 // We need to emulate Firefox behavior by doing the following:- | 987 // We need to emulate Firefox behavior by doing the following:- |
986 // 1. Destroy the plugin instance in the plugin process. Ensure that | 988 // 1. Destroy the plugin instance in the plugin process. Ensure that |
987 // existing resource requests initiated for the plugin instance | 989 // existing resource requests initiated for the plugin instance |
988 // continue to remain valid. | 990 // continue to remain valid. |
989 // 2. Create a new plugin instance and notify it about the response | 991 // 2. Create a new plugin instance and notify it about the response |
990 // received here. | 992 // received here. |
991 if (!ReinitializePluginForResponse(loader)) { | 993 if (!ReinitializePluginForResponse(loader)) { |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 case PLUGIN_SRC: | 1501 case PLUGIN_SRC: |
1500 webframe_->setReferrerForRequest(*request, plugin_url_); | 1502 webframe_->setReferrerForRequest(*request, plugin_url_); |
1501 break; | 1503 break; |
1502 | 1504 |
1503 default: | 1505 default: |
1504 break; | 1506 break; |
1505 } | 1507 } |
1506 } | 1508 } |
1507 | 1509 |
1508 } // namespace content | 1510 } // namespace content |
OLD | NEW |