Fix issue that IME can't be enabled when set Plugin mode to "Click to play".

In normal mode, the plugin is created at the moment the page is loaded. Then when the first time the plugin is clicked. It will set the flag "has_webkit_focus_" true in real plugin instance. Then, send out the focus change notification in PepperPluginInstanceImpl::SetWebKitFocus, which will finally affect the IME stuff.

However, at "Click to play" mode, WebViewPlugin is created at first, which will be replaced by real plugin. When the first time we click, the real plugin is created, loaded. But no focus is set in real plugin, which cause the IME stuff can't be enabled. 

In solution, we transfer the |focused_| in WebViewPlugin to new plugin after it loaded.

BUG=336740

Review URL: https://codereview.chromium.org/144803003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251303 0039d316-1c4b-4281-b951-d872f2087c98
parent c0bbb533
...@@ -271,6 +271,7 @@ Rosen Dash <nqk836@motorola.com> ...@@ -271,6 +271,7 @@ Rosen Dash <nqk836@motorola.com>
Rosen Dash <rosen.dash@gmail.com> Rosen Dash <rosen.dash@gmail.com>
ruben <chromium@hybridsource.org> ruben <chromium@hybridsource.org>
Ruben Terrazas <rubentopo@gmail.com> Ruben Terrazas <rubentopo@gmail.com>
Ruiyi Luo <luoruiyi2008@gmail.com>
Ryan Norton <rnorton10@gmail.com> Ryan Norton <rnorton10@gmail.com>
Ryan Sleevi <ryan-chromium-dev@sleevi.com> Ryan Sleevi <ryan-chromium-dev@sleevi.com>
Ryuan Choi <ryuan.choi@samsung.com> Ryuan Choi <ryuan.choi@samsung.com>
......
...@@ -46,7 +46,8 @@ WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate) ...@@ -46,7 +46,8 @@ WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate)
container_(NULL), container_(NULL),
web_view_(WebView::create(this)), web_view_(WebView::create(this)),
web_frame_(WebFrame::create(this)), web_frame_(WebFrame::create(this)),
finished_loading_(false) { finished_loading_(false),
focused_(false) {
web_view_->setMainFrame(web_frame_); web_view_->setMainFrame(web_frame_);
} }
...@@ -84,6 +85,10 @@ void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) { ...@@ -84,6 +85,10 @@ void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) {
"PluginDocument.NumChunks", "PluginDocument.NumChunks",
(base::checked_cast<int, size_t>(data_.size()))); (base::checked_cast<int, size_t>(data_.size())));
} }
// We need to transfer the |focused_| to new plugin after it loaded.
if (focused_) {
plugin->updateFocus(true);
}
if (finished_loading_) { if (finished_loading_) {
plugin->didFinishLoading(); plugin->didFinishLoading();
} }
...@@ -150,6 +155,10 @@ void WebViewPlugin::updateGeometry(const WebRect& frame_rect, ...@@ -150,6 +155,10 @@ void WebViewPlugin::updateGeometry(const WebRect& frame_rect,
} }
} }
void WebViewPlugin::updateFocus(bool focused) {
focused_ = focused;
}
bool WebViewPlugin::acceptsInputEvents() { return true; } bool WebViewPlugin::acceptsInputEvents() { return true; }
bool WebViewPlugin::handleInputEvent(const WebInputEvent& event, bool WebViewPlugin::handleInputEvent(const WebInputEvent& event,
......
...@@ -85,7 +85,7 @@ class WebViewPlugin : public blink::WebPlugin, ...@@ -85,7 +85,7 @@ class WebViewPlugin : public blink::WebPlugin,
const blink::WebVector<blink::WebRect>& cut_out_rects, const blink::WebVector<blink::WebRect>& cut_out_rects,
bool is_visible); bool is_visible);
virtual void updateFocus(bool) {} virtual void updateFocus(bool);
virtual void updateVisibility(bool) {} virtual void updateVisibility(bool) {}
virtual bool acceptsInputEvents(); virtual bool acceptsInputEvents();
...@@ -155,6 +155,7 @@ class WebViewPlugin : public blink::WebPlugin, ...@@ -155,6 +155,7 @@ class WebViewPlugin : public blink::WebPlugin,
bool finished_loading_; bool finished_loading_;
scoped_ptr<blink::WebURLError> error_; scoped_ptr<blink::WebURLError> error_;
blink::WebString old_title_; blink::WebString old_title_;
bool focused_;
}; };
#endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment