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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_
6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_
10 #include "content/common/content_export.h"
15 class StreamListenSocketFactory
;
16 class URLRequestContextGetter
;
21 class DevToolsAgentHost
;
22 class DevToolsHttpHandlerDelegate
;
24 // This class is used for managing DevTools remote debugging server.
25 // Clients can connect to the specified ip:port and start debugging
27 class DevToolsHttpHandler
{
29 // Interface responsible for mapping DevToolsAgentHost instances to/from
30 // string identifiers.
31 class DevToolsAgentHostBinding
{
33 virtual ~DevToolsAgentHostBinding() {}
35 // Returns the mapping of DevToolsAgentHost to identifier.
36 virtual std::string
GetIdentifier(DevToolsAgentHost
* agent_host
) = 0;
38 // Returns the mapping of identifier to DevToolsAgentHost.
39 virtual DevToolsAgentHost
* ForIdentifier(const std::string
& identifier
) = 0;
42 // Returns frontend resource id for the given resource |name|.
43 CONTENT_EXPORT
static int GetFrontendResourceId(
44 const std::string
& name
);
46 // Takes ownership over |socket_factory| and |delegate|.
47 CONTENT_EXPORT
static DevToolsHttpHandler
* Start(
48 const net::StreamListenSocketFactory
* socket_factory
,
49 const std::string
& frontend_url
,
50 DevToolsHttpHandlerDelegate
* delegate
);
52 // Called from the main thread in order to stop protocol handler.
53 // Automatically destroys the handler instance.
54 virtual void Stop() = 0;
56 // Set the DevToolsAgentHostBinding instance. If no instance is provided the
57 // default implementation will be used.
58 virtual void SetDevToolsAgentHostBinding(
59 DevToolsAgentHostBinding
* binding
) = 0;
61 // Returns the URL for the address to debug |render_view_host|.
62 virtual GURL
GetFrontendURL(DevToolsAgentHost
* agent_host
) = 0;
65 virtual ~DevToolsHttpHandler() {}
68 } // namespace content
70 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_