Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / components / plugins / renderer / webview_plugin.cc
index dfee291..a9df13c 100644 (file)
@@ -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,