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

Side by Side Diff: content/browser/devtools/devtools_http_handler_impl.h

Issue 296053012: Replace StreamListenSocket with StreamSocket in HttpServer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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_BROWSER_DEVTOOLS_DEVTOOLS_HTTP_HANDLER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_HTTP_HANDLER_IMPL_H_
6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_HTTP_HANDLER_IMPL_H_ 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_HTTP_HANDLER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/public/browser/devtools_http_handler.h" 16 #include "content/public/browser/devtools_http_handler.h"
17 #include "content/public/browser/devtools_http_handler_delegate.h" 17 #include "content/public/browser/devtools_http_handler_delegate.h"
18 #include "net/http/http_status_code.h" 18 #include "net/http/http_status_code.h"
19 #include "net/server/http_server.h" 19 #include "net/server/http_server.h"
20 20
21 namespace base { 21 namespace base {
22 class DictionaryValue; 22 class DictionaryValue;
23 class ListValue; 23 class ListValue;
24 class Thread; 24 class Thread;
25 class Value; 25 class Value;
26 } 26 }
27 27
28 namespace net { 28 namespace net {
29 class StreamListenSocketFactory; 29 class ServerSocket;
30 class URLRequestContextGetter; 30 class URLRequestContextGetter;
31 } 31 }
32 32
33 namespace content { 33 namespace content {
34 34
35 class DevToolsBrowserTarget; 35 class DevToolsBrowserTarget;
36 class DevToolsClientHost; 36 class DevToolsClientHost;
37 37
38 class DevToolsHttpHandlerImpl 38 class DevToolsHttpHandlerImpl
39 : public DevToolsHttpHandler, 39 : public DevToolsHttpHandler,
40 public base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>, 40 public base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>,
41 public net::HttpServer::Delegate { 41 public net::HttpServer::Delegate {
42 private: 42 private:
43 friend class base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>; 43 friend class base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>;
44 friend class DevToolsHttpHandler; 44 friend class DevToolsHttpHandler;
45 45
46 // Takes ownership over |socket_factory|. 46 // Takes ownership over |socket_factory|.
47 DevToolsHttpHandlerImpl(const net::StreamListenSocketFactory* socket_factory, 47 DevToolsHttpHandlerImpl(scoped_ptr<net::ServerSocket> server_socket,
48 const std::string& frontend_url, 48 const std::string& frontend_url,
49 DevToolsHttpHandlerDelegate* delegate); 49 DevToolsHttpHandlerDelegate* delegate);
50 virtual ~DevToolsHttpHandlerImpl(); 50 virtual ~DevToolsHttpHandlerImpl();
51 void Start(); 51 void Start();
52 52
53 // DevToolsHttpHandler implementation. 53 // DevToolsHttpHandler implementation.
54 virtual void Stop() OVERRIDE; 54 virtual void Stop() OVERRIDE;
55 virtual GURL GetFrontendURL() OVERRIDE; 55 virtual GURL GetFrontendURL() OVERRIDE;
56 56
57 // net::HttpServer::Delegate implementation. 57 // net::HttpServer::Delegate implementation.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 std::string GetFrontendURLInternal(const std::string target_id, 107 std::string GetFrontendURLInternal(const std::string target_id,
108 const std::string& host); 108 const std::string& host);
109 109
110 base::DictionaryValue* SerializeTarget(const DevToolsTarget& target, 110 base::DictionaryValue* SerializeTarget(const DevToolsTarget& target,
111 const std::string& host); 111 const std::string& host);
112 112
113 // The thread used by the devtools handler to run server socket. 113 // The thread used by the devtools handler to run server socket.
114 scoped_ptr<base::Thread> thread_; 114 scoped_ptr<base::Thread> thread_;
115 115
116 std::string frontend_url_; 116 std::string frontend_url_;
117 scoped_ptr<const net::StreamListenSocketFactory> socket_factory_; 117 scoped_ptr<net::ServerSocket> server_socket_;
118 scoped_refptr<net::HttpServer> server_; 118 scoped_ptr<net::HttpServer> server_;
119 typedef std::map<int, DevToolsClientHost*> ConnectionToClientHostMap; 119 typedef std::map<int, DevToolsClientHost*> ConnectionToClientHostMap;
120 ConnectionToClientHostMap connection_to_client_host_ui_; 120 ConnectionToClientHostMap connection_to_client_host_ui_;
121 scoped_ptr<DevToolsHttpHandlerDelegate> delegate_; 121 scoped_ptr<DevToolsHttpHandlerDelegate> delegate_;
122 typedef std::map<std::string, DevToolsTarget*> TargetMap; 122 typedef std::map<std::string, DevToolsTarget*> TargetMap;
123 TargetMap target_map_; 123 TargetMap target_map_;
124 scoped_refptr<DevToolsBrowserTarget> browser_target_; 124 scoped_refptr<DevToolsBrowserTarget> browser_target_;
125 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpHandlerImpl); 125 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpHandlerImpl);
126 }; 126 };
127 127
128 } // namespace content 128 } // namespace content
129 129
130 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_HTTP_HANDLER_IMPL_H_ 130 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_HTTP_HANDLER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698