Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2337)

Unified Diff: android_webview/native/aw_dev_tools_server.cc

Issue 24995003: DevTools: Extract target discovery and manipulation from DevToolsHttpHandlerImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added Android implementations Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 "";
« no previous file with comments | « no previous file | chrome/browser/android/dev_tools_server.cc » ('j') | content/public/browser/devtools_http_handler_delegate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698