| 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/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 10 #include "content/public/common/web_preferences.h" | 10 #include "content/public/common/web_preferences.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 UMA_HISTOGRAM_MEMORY_KB( | 84 UMA_HISTOGRAM_MEMORY_KB( |
| 85 "PluginDocument.Memory", | 85 "PluginDocument.Memory", |
| 86 (base::checked_cast<int, size_t>(total_bytes / 1024))); | 86 (base::checked_cast<int, size_t>(total_bytes / 1024))); |
| 87 UMA_HISTOGRAM_COUNTS( | 87 UMA_HISTOGRAM_COUNTS( |
| 88 "PluginDocument.NumChunks", | 88 "PluginDocument.NumChunks", |
| 89 (base::checked_cast<int, size_t>(data_.size()))); | 89 (base::checked_cast<int, size_t>(data_.size()))); |
| 90 } | 90 } |
| 91 // We need to transfer the |focused_| to new plugin after it loaded. | 91 // We need to transfer the |focused_| to new plugin after it loaded. |
| 92 if (focused_) { | 92 if (focused_) { |
| 93 plugin->updateFocus(true); | 93 plugin->updateFocus(true, blink::WebFocusTypeNone); |
| 94 } | 94 } |
| 95 if (finished_loading_) { | 95 if (finished_loading_) { |
| 96 plugin->didFinishLoading(); | 96 plugin->didFinishLoading(); |
| 97 } | 97 } |
| 98 if (error_) { | 98 if (error_) { |
| 99 plugin->didFailLoading(*error_); | 99 plugin->didFailLoading(*error_); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 void WebViewPlugin::RestoreTitleText() { | 103 void WebViewPlugin::RestoreTitleText() { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 const WebRect& clip_rect, | 150 const WebRect& clip_rect, |
| 151 const WebVector<WebRect>& cut_out_rects, | 151 const WebVector<WebRect>& cut_out_rects, |
| 152 bool is_visible) { | 152 bool is_visible) { |
| 153 if (static_cast<gfx::Rect>(frame_rect) != rect_) { | 153 if (static_cast<gfx::Rect>(frame_rect) != rect_) { |
| 154 rect_ = frame_rect; | 154 rect_ = frame_rect; |
| 155 WebSize newSize(frame_rect.width, frame_rect.height); | 155 WebSize newSize(frame_rect.width, frame_rect.height); |
| 156 web_view_->resize(newSize); | 156 web_view_->resize(newSize); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 void WebViewPlugin::updateFocus(bool focused) { | 160 void WebViewPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) { |
| 161 focused_ = focused; | 161 focused_ = focused; |
| 162 } | 162 } |
| 163 | 163 |
| 164 bool WebViewPlugin::acceptsInputEvents() { return true; } | 164 bool WebViewPlugin::acceptsInputEvents() { return true; } |
| 165 | 165 |
| 166 bool WebViewPlugin::handleInputEvent(const WebInputEvent& event, | 166 bool WebViewPlugin::handleInputEvent(const WebInputEvent& event, |
| 167 WebCursorInfo& cursor) { | 167 WebCursorInfo& cursor) { |
| 168 // For tap events, don't handle them. They will be converted to | 168 // For tap events, don't handle them. They will be converted to |
| 169 // mouse events later and passed to here. | 169 // mouse events later and passed to here. |
| 170 if (event.type == WebInputEvent::GestureTap) | 170 if (event.type == WebInputEvent::GestureTap) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) { | 242 void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) { |
| 243 if (delegate_) | 243 if (delegate_) |
| 244 delegate_->BindWebFrame(frame); | 244 delegate_->BindWebFrame(frame); |
| 245 } | 245 } |
| 246 | 246 |
| 247 void WebViewPlugin::didReceiveResponse(WebLocalFrame* frame, | 247 void WebViewPlugin::didReceiveResponse(WebLocalFrame* frame, |
| 248 unsigned identifier, | 248 unsigned identifier, |
| 249 const WebURLResponse& response) { | 249 const WebURLResponse& response) { |
| 250 WebFrameClient::didReceiveResponse(frame, identifier, response); | 250 WebFrameClient::didReceiveResponse(frame, identifier, response); |
| 251 } | 251 } |
| OLD | NEW |