diff options
author | luoruiyi2008@gmail.com <luoruiyi2008@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-14 14:09:42 +0000 |
---|---|---|
committer | luoruiyi2008@gmail.com <luoruiyi2008@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-14 14:09:42 +0000 |
commit | 580ff65da4b02ccc5e5b2afcf77e66f17d515d27 (patch) | |
tree | 3f4afa3ad2e2367f400561d3f69d60dd7097bb83 /components/plugins | |
parent | c0bbb533cb570ee90c93b131cf3762baf4b8d535 (diff) | |
download | chromium_src-580ff65da4b02ccc5e5b2afcf77e66f17d515d27.zip chromium_src-580ff65da4b02ccc5e5b2afcf77e66f17d515d27.tar.gz chromium_src-580ff65da4b02ccc5e5b2afcf77e66f17d515d27.tar.bz2 |
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
Diffstat (limited to 'components/plugins')
-rw-r--r-- | components/plugins/renderer/webview_plugin.cc | 11 | ||||
-rw-r--r-- | components/plugins/renderer/webview_plugin.h | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/components/plugins/renderer/webview_plugin.cc b/components/plugins/renderer/webview_plugin.cc index dfee291..a9df13c 100644 --- a/components/plugins/renderer/webview_plugin.cc +++ b/components/plugins/renderer/webview_plugin.cc @@ -46,7 +46,8 @@ WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate) container_(NULL), web_view_(WebView::create(this)), web_frame_(WebFrame::create(this)), - finished_loading_(false) { + finished_loading_(false), + focused_(false) { web_view_->setMainFrame(web_frame_); } @@ -84,6 +85,10 @@ void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) { "PluginDocument.NumChunks", (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_) { plugin->didFinishLoading(); } @@ -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::handleInputEvent(const WebInputEvent& event, diff --git a/components/plugins/renderer/webview_plugin.h b/components/plugins/renderer/webview_plugin.h index 6a4f1f3..4b87205 100644 --- a/components/plugins/renderer/webview_plugin.h +++ b/components/plugins/renderer/webview_plugin.h @@ -85,7 +85,7 @@ class WebViewPlugin : public blink::WebPlugin, const blink::WebVector<blink::WebRect>& cut_out_rects, bool is_visible); - virtual void updateFocus(bool) {} + virtual void updateFocus(bool); virtual void updateVisibility(bool) {} virtual bool acceptsInputEvents(); @@ -155,6 +155,7 @@ class WebViewPlugin : public blink::WebPlugin, bool finished_loading_; scoped_ptr<blink::WebURLError> error_; blink::WebString old_title_; + bool focused_; }; #endif // COMPONENTS_PLUGINS_RENDERER_WEBVIEW_PLUGIN_H_ |