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

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

Issue 296053012: Replace StreamListenSocket with StreamSocket in HttpServer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unittest errors. Created 6 years, 4 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 "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 ServerSocket;
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:
30
31 // Factory of net::ServerSocket. This is to separate instantiating dev tools
32 // and instantiating server socket.
33 class CONTENT_EXPORT ServerSocketFactory {
pfeldman 2014/08/18 15:18:00 - content API suggests that all interfaces are def
byungchul 2014/08/19 22:26:10 This factory is used only by devtools to give dela
mmenke 2014/08/19 22:43:55 This doesn't really seem to belong in net/. It's
34 public:
35 ServerSocketFactory(const std::string& address, int port, int backlog);
36 virtual ~ServerSocketFactory();
37
38 // Returns a new instance of ServerSocket or NULL if an error occurred.
39 // It calls ServerSocket::ListenWithAddressAndPort() with address, port and
40 // backlog passed to constructor.
41 virtual scoped_ptr<net::ServerSocket> CreateAndListen() const;
42
43 protected:
44 // Creates a server socket. ServerSocket::Listen() will be called soon
45 // unless it returns NULL.
46 virtual scoped_ptr<net::ServerSocket> Create() const = 0;
47
48 const std::string address_;
49 const int port_;
50 const int backlog_;
51
52 private:
53 DISALLOW_COPY_AND_ASSIGN(ServerSocketFactory);
54 };
55
29 // Returns true if the given protocol version is supported. 56 // Returns true if the given protocol version is supported.
30 CONTENT_EXPORT static bool IsSupportedProtocolVersion( 57 CONTENT_EXPORT static bool IsSupportedProtocolVersion(
31 const std::string& version); 58 const std::string& version);
32 59
33 // Returns frontend resource id for the given resource |name|. 60 // Returns frontend resource id for the given resource |name|.
34 CONTENT_EXPORT static int GetFrontendResourceId( 61 CONTENT_EXPORT static int GetFrontendResourceId(
35 const std::string& name); 62 const std::string& name);
36 63
37 // Takes ownership over |socket_factory| and |delegate|. 64 // Takes ownership over |socket_factory| and |delegate|.
38 // If |active_port_output_directory| is non-empty, it is assumed the 65 // If |active_port_output_directory| is non-empty, it is assumed the
39 // socket_factory was initialized with an ephemeral port (0). The 66 // 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 67 // port selected by the OS will be written to a well-known file in
41 // the output directory. 68 // the output directory.
42 CONTENT_EXPORT static DevToolsHttpHandler* Start( 69 CONTENT_EXPORT static DevToolsHttpHandler* Start(
43 const net::StreamListenSocketFactory* socket_factory, 70 scoped_ptr<ServerSocketFactory> server_socket_factory,
44 const std::string& frontend_url, 71 const std::string& frontend_url,
45 DevToolsHttpHandlerDelegate* delegate, 72 DevToolsHttpHandlerDelegate* delegate,
46 const base::FilePath& active_port_output_directory); 73 const base::FilePath& active_port_output_directory);
47 74
48 // Called from the main thread in order to stop protocol handler. 75 // Called from the main thread in order to stop protocol handler.
49 // Automatically destroys the handler instance. 76 // Automatically destroys the handler instance.
50 virtual void Stop() = 0; 77 virtual void Stop() = 0;
51 78
52 // Returns the URL for the address to debug |agent_host|. 79 // Returns the URL for the address to debug |agent_host|.
53 virtual GURL GetFrontendURL() = 0; 80 virtual GURL GetFrontendURL() = 0;
54 81
55 protected: 82 protected:
56 virtual ~DevToolsHttpHandler() {} 83 virtual ~DevToolsHttpHandler() {}
57 }; 84 };
58 85
59 } // namespace content 86 } // namespace content
60 87
61 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_ 88 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_HTTP_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_http_handler_unittest.cc ('k') | content/shell/browser/shell_devtools_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698