Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: components/plugins/renderer/webview_plugin.cc

Issue 144803003: Fix issue that IME can't be enabled when set Plugin mode to "Click to play". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating the fixing with merging into ReplayReceivedData. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/plugins/renderer/webview_plugin.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/safe_numerics.h"
10 #include "content/public/renderer/web_preferences.h" 10 #include "content/public/renderer/web_preferences.h"
(...skipping 28 matching lines...) Expand all
39 using blink::WebURLRequest; 39 using blink::WebURLRequest;
40 using blink::WebURLResponse; 40 using blink::WebURLResponse;
41 using blink::WebVector; 41 using blink::WebVector;
42 using blink::WebView; 42 using blink::WebView;
43 43
44 WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate) 44 WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate)
45 : delegate_(delegate), 45 : delegate_(delegate),
46 container_(NULL), 46 container_(NULL),
47 web_view_(WebView::create(this)), 47 web_view_(WebView::create(this)),
48 web_frame_(WebFrame::create(this)), 48 web_frame_(WebFrame::create(this)),
49 finished_loading_(false) { 49 finished_loading_(false),
50 focused_(false) {
50 web_view_->setMainFrame(web_frame_); 51 web_view_->setMainFrame(web_frame_);
51 } 52 }
52 53
53 // static 54 // static
54 WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate, 55 WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate,
55 const WebPreferences& preferences, 56 const WebPreferences& preferences,
56 const std::string& html_data, 57 const std::string& html_data,
57 const GURL& url) { 58 const GURL& url) {
58 WebViewPlugin* plugin = new WebViewPlugin(delegate); 59 WebViewPlugin* plugin = new WebViewPlugin(delegate);
59 WebView* web_view = plugin->web_view(); 60 WebView* web_view = plugin->web_view();
(...skipping 17 matching lines...) Expand all
77 it->c_str(), base::checked_numeric_cast<int, size_t>(it->length())); 78 it->c_str(), base::checked_numeric_cast<int, size_t>(it->length()));
78 total_bytes += it->length(); 79 total_bytes += it->length();
79 } 80 }
80 UMA_HISTOGRAM_MEMORY_KB( 81 UMA_HISTOGRAM_MEMORY_KB(
81 "PluginDocument.Memory", 82 "PluginDocument.Memory",
82 (base::checked_numeric_cast<int, size_t>(total_bytes / 1024))); 83 (base::checked_numeric_cast<int, size_t>(total_bytes / 1024)));
83 UMA_HISTOGRAM_COUNTS( 84 UMA_HISTOGRAM_COUNTS(
84 "PluginDocument.NumChunks", 85 "PluginDocument.NumChunks",
85 (base::checked_numeric_cast<int, size_t>(data_.size()))); 86 (base::checked_numeric_cast<int, size_t>(data_.size())));
86 } 87 }
88 // We need to transfer the |focused_| to new plugin after it loaded.
89 if (focused_) {
90 plugin->updateFocus(true);
91 }
87 if (finished_loading_) { 92 if (finished_loading_) {
88 plugin->didFinishLoading(); 93 plugin->didFinishLoading();
89 } 94 }
90 if (error_) { 95 if (error_) {
91 plugin->didFailLoading(*error_); 96 plugin->didFailLoading(*error_);
92 } 97 }
93 } 98 }
94 99
95 void WebViewPlugin::RestoreTitleText() { 100 void WebViewPlugin::RestoreTitleText() {
96 if (container_) 101 if (container_)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const WebVector<WebRect>& cut_out_rects, 148 const WebVector<WebRect>& cut_out_rects,
144 bool is_visible) { 149 bool is_visible) {
145 if (static_cast<gfx::Rect>(frame_rect) != rect_) { 150 if (static_cast<gfx::Rect>(frame_rect) != rect_) {
146 rect_ = frame_rect; 151 rect_ = frame_rect;
147 WebSize newSize(frame_rect.width, frame_rect.height); 152 WebSize newSize(frame_rect.width, frame_rect.height);
148 web_view_->setFixedLayoutSize(newSize); 153 web_view_->setFixedLayoutSize(newSize);
149 web_view_->resize(newSize); 154 web_view_->resize(newSize);
150 } 155 }
151 } 156 }
152 157
158 void WebViewPlugin::updateFocus(bool focused) {
159 focused_ = focused;
160 }
161
153 bool WebViewPlugin::acceptsInputEvents() { return true; } 162 bool WebViewPlugin::acceptsInputEvents() { return true; }
154 163
155 bool WebViewPlugin::handleInputEvent(const WebInputEvent& event, 164 bool WebViewPlugin::handleInputEvent(const WebInputEvent& event,
156 WebCursorInfo& cursor) { 165 WebCursorInfo& cursor) {
157 // For tap events, don't handle them. They will be converted to 166 // For tap events, don't handle them. They will be converted to
158 // mouse events later and passed to here. 167 // mouse events later and passed to here.
159 if (event.type == WebInputEvent::GestureTap) 168 if (event.type == WebInputEvent::GestureTap)
160 return false; 169 return false;
161 170
162 if (event.type == WebInputEvent::ContextMenu) { 171 if (event.type == WebInputEvent::ContextMenu) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 void WebViewPlugin::didClearWindowObject(WebFrame* frame, int world_id) { 231 void WebViewPlugin::didClearWindowObject(WebFrame* frame, int world_id) {
223 if (delegate_) 232 if (delegate_)
224 delegate_->BindWebFrame(frame); 233 delegate_->BindWebFrame(frame);
225 } 234 }
226 235
227 void WebViewPlugin::didReceiveResponse(WebFrame* frame, 236 void WebViewPlugin::didReceiveResponse(WebFrame* frame,
228 unsigned identifier, 237 unsigned identifier,
229 const WebURLResponse& response) { 238 const WebURLResponse& response) {
230 WebFrameClient::didReceiveResponse(frame, identifier, response); 239 WebFrameClient::didReceiveResponse(frame, identifier, response);
231 } 240 }
OLDNEW
« no previous file with comments | « components/plugins/renderer/webview_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698