| OLD | NEW |
| 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; | |
| 22 class DevToolsHttpHandlerDelegate; | 21 class DevToolsHttpHandlerDelegate; |
| 23 | 22 |
| 24 // This class is used for managing DevTools remote debugging server. | 23 // This class is used for managing DevTools remote debugging server. |
| 25 // Clients can connect to the specified ip:port and start debugging | 24 // Clients can connect to the specified ip:port and start debugging |
| 26 // this browser. | 25 // this browser. |
| 27 class DevToolsHttpHandler { | 26 class DevToolsHttpHandler { |
| 28 public: | 27 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 true if the given protocol version is supported. | 28 // Returns true if the given protocol version is supported. |
| 43 CONTENT_EXPORT static bool IsSupportedProtocolVersion( | 29 CONTENT_EXPORT static bool IsSupportedProtocolVersion( |
| 44 const std::string& version); | 30 const std::string& version); |
| 45 | 31 |
| 46 // Returns frontend resource id for the given resource |name|. | 32 // Returns frontend resource id for the given resource |name|. |
| 47 CONTENT_EXPORT static int GetFrontendResourceId( | 33 CONTENT_EXPORT static int GetFrontendResourceId( |
| 48 const std::string& name); | 34 const std::string& name); |
| 49 | 35 |
| 50 // Takes ownership over |socket_factory| and |delegate|. | 36 // Takes ownership over |socket_factory| and |delegate|. |
| 51 CONTENT_EXPORT static DevToolsHttpHandler* Start( | 37 CONTENT_EXPORT static DevToolsHttpHandler* Start( |
| 52 const net::StreamListenSocketFactory* socket_factory, | 38 const net::StreamListenSocketFactory* socket_factory, |
| 53 const std::string& frontend_url, | 39 const std::string& frontend_url, |
| 54 DevToolsHttpHandlerDelegate* delegate); | 40 DevToolsHttpHandlerDelegate* delegate); |
| 55 | 41 |
| 56 // Called from the main thread in order to stop protocol handler. | 42 // Called from the main thread in order to stop protocol handler. |
| 57 // Automatically destroys the handler instance. | 43 // Automatically destroys the handler instance. |
| 58 virtual void Stop() = 0; | 44 virtual void Stop() = 0; |
| 59 | 45 |
| 60 // Set the DevToolsAgentHostBinding instance. If no instance is provided the | 46 // Returns the URL for the address to debug |agent_host|. |
| 61 // default implementation will be used. | 47 virtual GURL GetFrontendURL() = 0; |
| 62 virtual void SetDevToolsAgentHostBinding( | |
| 63 DevToolsAgentHostBinding* binding) = 0; | |
| 64 | |
| 65 // Returns the URL for the address to debug |render_view_host|. | |
| 66 virtual GURL GetFrontendURL(DevToolsAgentHost* agent_host) = 0; | |
| 67 | 48 |
| 68 protected: | 49 protected: |
| 69 virtual ~DevToolsHttpHandler() {} | 50 virtual ~DevToolsHttpHandler() {} |
| 70 }; | 51 }; |
| 71 | 52 |
| 72 } // namespace content | 53 } // namespace content |
| 73 | 54 |
| 74 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ | 55 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ |
| OLD | NEW |