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

Side by Side Diff: content/public/browser/devtools_http_handler.h

Issue 12319114: Extract debugger target enumeration into a separate class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@debugger
Patch Set: Cleaner version ready for review Created 7 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_
6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 11
12 class GURL; 12 class GURL;
13 13
14 namespace net { 14 namespace net {
15 class StreamListenSocketFactory; 15 class StreamListenSocketFactory;
16 class URLRequestContextGetter; 16 class URLRequestContextGetter;
17 } 17 }
18 18
19 namespace content { 19 namespace content {
20 20
21 class DevToolsAgentHost; 21 class DevToolsAgentHost;
22 class DevToolsAgentHostBinding;
22 class DevToolsHttpHandlerDelegate; 23 class DevToolsHttpHandlerDelegate;
23 24
24 // This class is used for managing DevTools remote debugging server. 25 // This class is used for managing DevTools remote debugging server.
25 // Clients can connect to the specified ip:port and start debugging 26 // Clients can connect to the specified ip:port and start debugging
26 // this browser. 27 // this browser.
27 class DevToolsHttpHandler { 28 class DevToolsHttpHandler {
28 public: 29 public:
29 // Interface responsible for mapping DevToolsAgentHost instances to/from
30 // string identifiers.
31 class DevToolsAgentHostBinding {
32 public:
33 virtual ~DevToolsAgentHostBinding() {}
34
35 // Returns the mapping of DevToolsAgentHost to identifier.
36 virtual std::string GetIdentifier(DevToolsAgentHost* agent_host) = 0;
37
38 // Returns the mapping of identifier to DevToolsAgentHost.
39 virtual DevToolsAgentHost* ForIdentifier(const std::string& identifier) = 0;
40 };
41
42 // Returns frontend resource id for the given resource |name|. 30 // Returns frontend resource id for the given resource |name|.
43 CONTENT_EXPORT static int GetFrontendResourceId( 31 CONTENT_EXPORT static int GetFrontendResourceId(
44 const std::string& name); 32 const std::string& name);
45 33
46 // Takes ownership over |socket_factory| and |delegate|. 34 // Takes ownership over |socket_factory| and |delegate|.
47 CONTENT_EXPORT static DevToolsHttpHandler* Start( 35 CONTENT_EXPORT static DevToolsHttpHandler* Start(
48 const net::StreamListenSocketFactory* socket_factory, 36 const net::StreamListenSocketFactory* socket_factory,
49 const std::string& frontend_url, 37 const std::string& frontend_url,
50 DevToolsHttpHandlerDelegate* delegate); 38 DevToolsHttpHandlerDelegate* delegate);
51 39
52 // Called from the main thread in order to stop protocol handler. 40 // Called from the main thread in order to stop protocol handler.
53 // Automatically destroys the handler instance. 41 // Automatically destroys the handler instance.
54 virtual void Stop() = 0; 42 virtual void Stop() = 0;
55 43
56 // Set the DevToolsAgentHostBinding instance. If no instance is provided the 44 // Set the DevToolsAgentHostBinding instance. If no instance is provided the
57 // default implementation will be used. 45 // default implementation will be used.
58 virtual void SetDevToolsAgentHostBinding( 46 virtual void SetDevToolsAgentHostBinding(
59 DevToolsAgentHostBinding* binding) = 0; 47 DevToolsAgentHostBinding* binding) = 0;
60 48
61 // Returns the URL for the address to debug |render_view_host|. 49 // Returns the URL for the address to debug |render_view_host|.
62 virtual GURL GetFrontendURL(DevToolsAgentHost* agent_host) = 0; 50 virtual GURL GetFrontendURL(DevToolsAgentHost* agent_host) = 0;
63 51
64 protected: 52 protected:
65 virtual ~DevToolsHttpHandler() {} 53 virtual ~DevToolsHttpHandler() {}
66 }; 54 };
67 55
68 } // namespace content 56 } // namespace content
69 57
70 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ 58 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698