#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"
#include "net/socket/unix_domain_socket_posix.h"
#include "ui/base/resource/resource_bundle.h"
-#include "webkit/common/user_agent/user_agent_util.h"
using content::DevToolsAgentHost;
using content::RenderViewHost;
virtual std::string GetTitle() const OVERRIDE { return title_; }
// TODO(hmin): Get the description about web contents view.
virtual std::string GetDescription() const OVERRIDE { return std::string(); }
- virtual GURL GetUrl() const OVERRIDE { return url_; }
- virtual GURL GetFaviconUrl() const OVERRIDE { return GURL(); }
+ virtual GURL GetURL() const OVERRIDE { return url_; }
+ virtual GURL GetFaviconURL() const OVERRIDE { return GURL(); }
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:
"", // fallback socket name
base::Bind(&XWalkDevToolsServer::CanUserConnectToDevTools,
base::Unretained(this))),
- base::StringPrintf(kFrontEndURL,
- webkit_glue::GetWebKitRevision().c_str()),
- new XWalkDevToolsServerDelegate());
+ base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()),
+ new XWalkDevToolsServerDelegate(), base::FilePath());
}
void XWalkDevToolsServer::Stop() {
return RegisterNativesImpl(env);
}
-static jint InitRemoteDebugging(JNIEnv* env,
+static jlong InitRemoteDebugging(JNIEnv* env,
jobject obj,
jstring socketName) {
XWalkDevToolsServer* server = new XWalkDevToolsServer(
base::android::ConvertJavaStringToUTF8(env, socketName));
- return reinterpret_cast<jint>(server);
+ return reinterpret_cast<intptr_t>(server);
}
-static void DestroyRemoteDebugging(JNIEnv* env, jobject obj, jint server) {
+static void DestroyRemoteDebugging(JNIEnv* env, jobject obj, jlong server) {
delete reinterpret_cast<XWalkDevToolsServer*>(server);
}
static jboolean IsRemoteDebuggingEnabled(JNIEnv* env,
jobject obj,
- jint server) {
+ jlong server) {
return reinterpret_cast<XWalkDevToolsServer*>(server)->IsStarted();
}
static void SetRemoteDebuggingEnabled(JNIEnv* env,
jobject obj,
- jint server,
+ jlong server,
jboolean enabled) {
XWalkDevToolsServer* devtools_server =
reinterpret_cast<XWalkDevToolsServer*>(server);
static void AllowConnectionFromUid(JNIEnv* env,
jobject obj,
- jint server,
+ jlong server,
jint uid) {
XWalkDevToolsServer* devtools_server =
reinterpret_cast<XWalkDevToolsServer*>(server);