Upstream version 9.37.193.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / android / xwalk_dev_tools_server.cc
index af2956a..a592db3 100644 (file)
@@ -26,6 +26,7 @@
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/render_view_host.h"
 #include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_delegate.h"
 #include "content/public/common/user_agent.h"
 #include "grit/xwalk_resources.h"
 #include "jni/XWalkDevToolsServer_jni.h"
@@ -59,13 +60,25 @@ class Target : public content::DevToolsTarget {
   virtual base::TimeTicks GetLastActivityTime() const OVERRIDE {
     return last_activity_time_;
   }
+  virtual std::string GetParentId() const OVERRIDE { return std::string(); }
   virtual bool IsAttached() const OVERRIDE {
     return agent_host_->IsAttached();
   }
   virtual scoped_refptr<DevToolsAgentHost> GetAgentHost() const OVERRIDE {
     return agent_host_;
   }
-  virtual bool Activate() const OVERRIDE { return false; }
+
+  virtual bool Activate() const OVERRIDE {
+    RenderViewHost* rvh = agent_host_->GetRenderViewHost();
+    if (!rvh)
+      return false;
+    WebContents* web_contents = WebContents::FromRenderViewHost(rvh);
+    if (!web_contents)
+      return false;
+    web_contents->GetDelegate()->ActivateContents(web_contents);
+    return true;
+  }
+
   virtual bool Close() const OVERRIDE { return false; }
 
  private:
@@ -173,7 +186,7 @@ void XWalkDevToolsServer::Start() {
           base::Bind(&XWalkDevToolsServer::CanUserConnectToDevTools,
               base::Unretained(this))),
       base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()),
-      new XWalkDevToolsServerDelegate());
+      new XWalkDevToolsServerDelegate(), base::FilePath());
 }
 
 void XWalkDevToolsServer::Stop() {