| 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 "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 12 | 13 |
| 13 class GURL; | 14 class GURL; |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 class StreamListenSocketFactory; | 17 class ServerSocketFactory; |
| 17 class URLRequestContextGetter; | 18 class URLRequestContextGetter; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| 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 // Returns true if the given protocol version is supported. | 30 // Returns true if the given protocol version is supported. |
| 30 CONTENT_EXPORT static bool IsSupportedProtocolVersion( | 31 CONTENT_EXPORT static bool IsSupportedProtocolVersion( |
| 31 const std::string& version); | 32 const std::string& version); |
| 32 | 33 |
| 33 // Returns frontend resource id for the given resource |name|. | 34 // Returns frontend resource id for the given resource |name|. |
| 34 CONTENT_EXPORT static int GetFrontendResourceId( | 35 CONTENT_EXPORT static int GetFrontendResourceId( |
| 35 const std::string& name); | 36 const std::string& name); |
| 36 | 37 |
| 37 // Takes ownership over |socket_factory| and |delegate|. | 38 // Takes ownership over |socket_factory| and |delegate|. |
| 38 // If |active_port_output_directory| is non-empty, it is assumed the | 39 // If |active_port_output_directory| is non-empty, it is assumed the |
| 39 // socket_factory was initialized with an ephemeral port (0). The | 40 // socket_factory was initialized with an ephemeral port (0). The |
| 40 // port selected by the OS will be written to a well-known file in | 41 // port selected by the OS will be written to a well-known file in |
| 41 // the output directory. | 42 // the output directory. |
| 42 CONTENT_EXPORT static DevToolsHttpHandler* Start( | 43 CONTENT_EXPORT static DevToolsHttpHandler* Start( |
| 43 const net::StreamListenSocketFactory* socket_factory, | 44 scoped_ptr<net::ServerSocketFactory> server_socket_factory, |
| 44 const std::string& frontend_url, | 45 const std::string& frontend_url, |
| 45 DevToolsHttpHandlerDelegate* delegate, | 46 DevToolsHttpHandlerDelegate* delegate, |
| 46 const base::FilePath& active_port_output_directory); | 47 const base::FilePath& active_port_output_directory); |
| 47 | 48 |
| 48 // Called from the main thread in order to stop protocol handler. | 49 // Called from the main thread in order to stop protocol handler. |
| 49 // Automatically destroys the handler instance. | 50 // Automatically destroys the handler instance. |
| 50 virtual void Stop() = 0; | 51 virtual void Stop() = 0; |
| 51 | 52 |
| 52 // Returns the URL for the address to debug |agent_host|. | 53 // Returns the URL for the address to debug |agent_host|. |
| 53 virtual GURL GetFrontendURL() = 0; | 54 virtual GURL GetFrontendURL() = 0; |
| 54 | 55 |
| 55 protected: | 56 protected: |
| 56 virtual ~DevToolsHttpHandler() {} | 57 virtual ~DevToolsHttpHandler() {} |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 } // namespace content | 60 } // namespace content |
| 60 | 61 |
| 61 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ | 62 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ |
| OLD | NEW |