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

Unified Diff: content/public/browser/devtools_http_handler_delegate.h

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: content/public/browser/devtools_http_handler_delegate.h
diff --git a/content/public/browser/devtools_http_handler_delegate.h b/content/public/browser/devtools_http_handler_delegate.h
index 3e1d6412820eb17923b1b366d2b8eb33d1b42c1c..fbd16056e20feef120a90a68ae26c488dd611698 100644
--- a/content/public/browser/devtools_http_handler_delegate.h
+++ b/content/public/browser/devtools_http_handler_delegate.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/files/file_path.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "net/socket/stream_listen_socket.h"
@@ -16,16 +17,15 @@ class GURL;
namespace content {
-class RenderViewHost;
+class DevToolsAgentHost;
+class DevToolsTargetDescriptor;
-class DevToolsHttpHandlerDelegate {
+class DevToolsHttpHandlerDelegate
+ : public base::RefCountedThreadSafe<DevToolsHttpHandlerDelegate> {
public:
- enum TargetType {
- kTargetTypeTab = 0,
- kTargetTypeOther,
- };
-
- virtual ~DevToolsHttpHandlerDelegate() {}
+ typedef DevToolsTargetDescriptor Target;
+ typedef std::vector<Target*> TargetList;
+ typedef base::Callback<void(const TargetList&)> TargetCallback;
// Should return discovery page HTML that should list available tabs
// and provide attach links.
@@ -37,24 +37,39 @@ class DevToolsHttpHandlerDelegate {
// Returns path to the front-end files on the local filesystem for debugging.
virtual base::FilePath GetDebugFrontendDir() = 0;
+ // Returns true if this delegate supports page thumbnails.
pfeldman 2013/09/30 12:25:46 Can we assume this is always the case?
+ virtual bool SupportsPageThumbnails() = 0;
+
// Get a thumbnail for a given page. Returns non-empty string iff we have the
// thumbnail.
- virtual std::string GetPageThumbnailData(const GURL& url) = 0;
+ virtual std::string GetPageThumbnailData(const std::string& id) = 0;
pfeldman 2013/09/30 12:25:46 Should this refer to targets using const Target& i
+
+ // Creates new inspectable target and returns its descriptor.
+ virtual Target* CreateNewTarget() = 0;
pfeldman 2013/09/30 12:25:46 I'd rather use value type for the target.
- // Creates new inspectable target and returns its render view host.
- virtual RenderViewHost* CreateNewTarget() = 0;
+ // Activates the target.
+ virtual bool ActivateTarget(const std::string& id) = 0;
- // Returns the type of the target.
- virtual TargetType GetTargetType(RenderViewHost*) = 0;
+ // Closes the target.
+ virtual bool CloseTarget(const std::string& id) = 0;
- // Provides the delegate with an ability to supply a description for views.
- virtual std::string GetViewDescription(content::RenderViewHost*) = 0;
+ // Returns DevToolsAgentHost for the target.
+ virtual scoped_refptr<DevToolsAgentHost> GetAgentHost(
+ const std::string& id) = 0;
+
+ // Requests the list of all available targets.
+ virtual void RequestTargets(TargetCallback callback) = 0;
// Creates named socket for reversed tethering implementation (used with
// remote debugging, primarily for mobile).
virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering(
net::StreamListenSocket::Delegate* delegate,
std::string* name) = 0;
+
+ protected:
+ friend class base::RefCountedThreadSafe<DevToolsHttpHandlerDelegate>;
+
+ virtual ~DevToolsHttpHandlerDelegate() {}
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698