| Index: android_webview/native/aw_dev_tools_server.cc
|
| diff --git a/android_webview/native/aw_dev_tools_server.cc b/android_webview/native/aw_dev_tools_server.cc
|
| index 01fc288595f3795a1acd5cd0ac68937aadb0f718..19599fa1329280b050efa545162ad491e2051310 100644
|
| --- a/android_webview/native/aw_dev_tools_server.cc
|
| +++ b/android_webview/native/aw_dev_tools_server.cc
|
| @@ -10,13 +10,19 @@
|
| #include "base/strings/stringprintf.h"
|
| #include "base/values.h"
|
| #include "content/public/browser/android/devtools_auth.h"
|
| +#include "content/public/browser/devtools_agent_host.h"
|
| #include "content/public/browser/devtools_http_handler.h"
|
| #include "content/public/browser/devtools_http_handler_delegate.h"
|
| +#include "content/public/browser/devtools_target_descriptor.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "jni/AwDevToolsServer_jni.h"
|
| #include "net/socket/unix_domain_socket_posix.h"
|
| #include "webkit/common/user_agent/user_agent_util.h"
|
|
|
| +using content::DevToolsAgentHost;
|
| +using content::RenderViewHost;
|
| +using content::WebContents;
|
| +
|
| namespace {
|
|
|
| const char kFrontEndURL[] =
|
| @@ -41,19 +47,48 @@ class AwDevToolsServerDelegate : public content::DevToolsHttpHandlerDelegate {
|
| return base::FilePath();
|
| }
|
|
|
| - virtual std::string GetPageThumbnailData(const GURL&) OVERRIDE {
|
| + virtual bool SupportsPageThumbnails() OVERRIDE {
|
| + return false;
|
| + }
|
| +
|
| + virtual std::string GetPageThumbnailData(const std::string&) OVERRIDE {
|
| return "";
|
| }
|
|
|
| - virtual content::RenderViewHost* CreateNewTarget() OVERRIDE {
|
| + virtual Target* CreateNewTarget() OVERRIDE {
|
| return NULL;
|
| }
|
|
|
| - virtual TargetType GetTargetType(content::RenderViewHost*) OVERRIDE {
|
| - return kTargetTypeTab;
|
| + std::string GetViewDescription(WebContents* web_contents);
|
| +
|
| + virtual bool ActivateTarget(const std::string& id) OVERRIDE {
|
| + return false;
|
| }
|
|
|
| - virtual std::string GetViewDescription(content::RenderViewHost*) OVERRIDE;
|
| + virtual bool CloseTarget(const std::string& id) OVERRIDE {
|
| + return false;
|
| + }
|
| +
|
| + virtual scoped_refptr<DevToolsAgentHost> GetAgentHost(
|
| + const std::string& id) OVERRIDE {
|
| + return DevToolsAgentHost::GetForId(id);
|
| + }
|
| +
|
| + virtual void RequestTargets(TargetCallback callback) OVERRIDE {
|
| + TargetList targets;
|
| + std::vector<RenderViewHost*> rvh_list =
|
| + DevToolsAgentHost::GetValidRenderViewHosts();
|
| + for (std::vector<RenderViewHost*>::iterator it = rvh_list.begin();
|
| + it != rvh_list.end(); ++it) {
|
| + WebContents* web_contents = WebContents::FromRenderViewHost(*it);
|
| + if (!web_contents)
|
| + continue;
|
| + Target* target = Target::FromWebContents(web_contents);
|
| + target->OverrideDescription(GetViewDescription(web_contents));
|
| + targets.push_back(target);
|
| + }
|
| + callback.Run(targets);
|
| + }
|
|
|
| virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering(
|
| net::StreamListenSocket::Delegate* delegate,
|
| @@ -77,11 +112,7 @@ std::string AwDevToolsServerDelegate::GetDiscoveryPageHTML() {
|
| }
|
|
|
| std::string AwDevToolsServerDelegate::GetViewDescription(
|
| - content::RenderViewHost* rvh) {
|
| - content::WebContents* web_contents =
|
| - content::WebContents::FromRenderViewHost(rvh);
|
| - if (!web_contents) return "";
|
| -
|
| + WebContents* web_contents) {
|
| android_webview::BrowserViewRenderer* bvr
|
| = android_webview::InProcessViewRenderer::FromWebContents(web_contents);
|
| if (!bvr) return "";
|
|
|