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. 4 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ 7 8 #include <string> 9 10 #include "content/common/content_export.h" 11 12 class GURL; 13 14 namespace net { 15 class StreamListenSocketFactory; 16 class URLRequestContextGetter; 17 } 18 19 namespace content { 20 21 class DevToolsHttpHandlerDelegate; 22 23 // This class is used for managing DevTools remote debugging server. 24 // Clients can connect to the specified ip:port and start debugging 25 // this browser. 26 class DevToolsHttpHandler { 27 public: 28 // Returns true if the given protocol version is supported. 29 CONTENT_EXPORT static bool IsSupportedProtocolVersion( 30 const std::string& version); 31 32 // Returns frontend resource id for the given resource |name|. 33 CONTENT_EXPORT static int GetFrontendResourceId( 34 const std::string& name); 35 36 // Takes ownership over |socket_factory| and |delegate|. 37 CONTENT_EXPORT static DevToolsHttpHandler* Start( 38 const net::StreamListenSocketFactory* socket_factory, 39 const std::string& frontend_url, 40 DevToolsHttpHandlerDelegate* delegate); 41 42 // Called from the main thread in order to stop protocol handler. 43 // Automatically destroys the handler instance. 44 virtual void Stop() = 0; 45 46 // Returns the URL for the address to debug |agent_host|. 47 virtual GURL GetFrontendURL() = 0; 48 49 protected: 50 virtual ~DevToolsHttpHandler() {} 51 }; 52 53 } // namespace content 54 55 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ 56