OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/plugins/renderer/webview_plugin.h" | 5 #include "components/plugins/renderer/webview_plugin.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/safe_numerics.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "content/public/renderer/web_preferences.h" | 10 #include "content/public/renderer/web_preferences.h" |
11 #include "skia/ext/platform_canvas.h" | 11 #include "skia/ext/platform_canvas.h" |
12 #include "third_party/WebKit/public/platform/WebSize.h" | 12 #include "third_party/WebKit/public/platform/WebSize.h" |
13 #include "third_party/WebKit/public/platform/WebURL.h" | 13 #include "third_party/WebKit/public/platform/WebURL.h" |
14 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 14 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
15 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 15 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
16 #include "third_party/WebKit/public/web/WebDocument.h" | 16 #include "third_party/WebKit/public/web/WebDocument.h" |
17 #include "third_party/WebKit/public/web/WebElement.h" | 17 #include "third_party/WebKit/public/web/WebElement.h" |
18 #include "third_party/WebKit/public/web/WebFrame.h" | 18 #include "third_party/WebKit/public/web/WebFrame.h" |
19 #include "third_party/WebKit/public/web/WebInputEvent.h" | 19 #include "third_party/WebKit/public/web/WebInputEvent.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 web_frame_->close(); | 67 web_frame_->close(); |
68 } | 68 } |
69 | 69 |
70 void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) { | 70 void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) { |
71 if (!response_.isNull()) { | 71 if (!response_.isNull()) { |
72 plugin->didReceiveResponse(response_); | 72 plugin->didReceiveResponse(response_); |
73 size_t total_bytes = 0; | 73 size_t total_bytes = 0; |
74 for (std::list<std::string>::iterator it = data_.begin(); it != data_.end(); | 74 for (std::list<std::string>::iterator it = data_.begin(); it != data_.end(); |
75 ++it) { | 75 ++it) { |
76 plugin->didReceiveData( | 76 plugin->didReceiveData( |
77 it->c_str(), base::checked_numeric_cast<int, size_t>(it->length())); | 77 it->c_str(), base::checked_cast<int, size_t>(it->length())); |
78 total_bytes += it->length(); | 78 total_bytes += it->length(); |
79 } | 79 } |
80 UMA_HISTOGRAM_MEMORY_KB( | 80 UMA_HISTOGRAM_MEMORY_KB( |
81 "PluginDocument.Memory", | 81 "PluginDocument.Memory", |
82 (base::checked_numeric_cast<int, size_t>(total_bytes / 1024))); | 82 (base::checked_cast<int, size_t>(total_bytes / 1024))); |
83 UMA_HISTOGRAM_COUNTS( | 83 UMA_HISTOGRAM_COUNTS( |
84 "PluginDocument.NumChunks", | 84 "PluginDocument.NumChunks", |
85 (base::checked_numeric_cast<int, size_t>(data_.size()))); | 85 (base::checked_cast<int, size_t>(data_.size()))); |
86 } | 86 } |
87 if (finished_loading_) { | 87 if (finished_loading_) { |
88 plugin->didFinishLoading(); | 88 plugin->didFinishLoading(); |
89 } | 89 } |
90 if (error_) { | 90 if (error_) { |
91 plugin->didFailLoading(*error_); | 91 plugin->didFailLoading(*error_); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 void WebViewPlugin::RestoreTitleText() { | 95 void WebViewPlugin::RestoreTitleText() { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 void WebViewPlugin::didClearWindowObject(WebFrame* frame, int world_id) { | 222 void WebViewPlugin::didClearWindowObject(WebFrame* frame, int world_id) { |
223 if (delegate_) | 223 if (delegate_) |
224 delegate_->BindWebFrame(frame); | 224 delegate_->BindWebFrame(frame); |
225 } | 225 } |
226 | 226 |
227 void WebViewPlugin::didReceiveResponse(WebFrame* frame, | 227 void WebViewPlugin::didReceiveResponse(WebFrame* frame, |
228 unsigned identifier, | 228 unsigned identifier, |
229 const WebURLResponse& response) { | 229 const WebURLResponse& response) { |
230 WebFrameClient::didReceiveResponse(frame, identifier, response); | 230 WebFrameClient::didReceiveResponse(frame, identifier, response); |
231 } | 231 } |
OLD | NEW |