| 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_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 "content/public/browser/notification_observer.h" | |
| 19 #include "content/public/browser/notification_registrar.h" | |
| 20 #include "content/public/browser/worker_service.h" | 18 #include "content/public/browser/worker_service.h" |
| 21 #include "net/server/http_server.h" | 19 #include "net/server/http_server.h" |
| 22 | 20 |
| 23 namespace base { | 21 namespace base { |
| 24 class DictionaryValue; | 22 class DictionaryValue; |
| 25 class ListValue; | 23 class ListValue; |
| 26 class Thread; | 24 class Thread; |
| 27 class Value; | 25 class Value; |
| 28 } | 26 } |
| 29 | 27 |
| 30 namespace net { | 28 namespace net { |
| 31 class StreamListenSocketFactory; | 29 class StreamListenSocketFactory; |
| 32 class URLRequestContextGetter; | 30 class URLRequestContextGetter; |
| 33 } | 31 } |
| 34 | 32 |
| 35 namespace content { | 33 namespace content { |
| 36 | 34 |
| 37 class DevToolsBrowserTarget; | 35 class DevToolsBrowserTarget; |
| 38 class DevToolsClientHost; | 36 class DevToolsClientHost; |
| 39 | 37 |
| 40 class DevToolsHttpHandlerImpl | 38 class DevToolsHttpHandlerImpl |
| 41 : public DevToolsHttpHandler, | 39 : public DevToolsHttpHandler, |
| 42 public NotificationObserver, | |
| 43 public base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>, | 40 public base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>, |
| 44 public net::HttpServer::Delegate { | 41 public net::HttpServer::Delegate { |
| 45 private: | 42 private: |
| 46 friend class base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>; | 43 friend class base::RefCountedThreadSafe<DevToolsHttpHandlerImpl>; |
| 47 friend class DevToolsHttpHandler; | 44 friend class DevToolsHttpHandler; |
| 48 | 45 |
| 49 // Takes ownership over |socket_factory|. | 46 // Takes ownership over |socket_factory|. |
| 50 DevToolsHttpHandlerImpl(const net::StreamListenSocketFactory* socket_factory, | 47 DevToolsHttpHandlerImpl(const net::StreamListenSocketFactory* socket_factory, |
| 51 const std::string& frontend_url, | 48 const std::string& frontend_url, |
| 52 DevToolsHttpHandlerDelegate* delegate); | 49 DevToolsHttpHandlerDelegate* delegate); |
| 53 virtual ~DevToolsHttpHandlerImpl(); | 50 virtual ~DevToolsHttpHandlerImpl(); |
| 54 void Start(); | 51 void Start(); |
| 55 | 52 |
| 56 // DevToolsHttpHandler implementation. | 53 // DevToolsHttpHandler implementation. |
| 57 virtual void Stop() OVERRIDE; | 54 virtual void Stop() OVERRIDE; |
| 58 virtual void SetDevToolsAgentHostBinding( | 55 virtual void SetDevToolsAgentHostBinding( |
| 59 DevToolsAgentHostBinding* binding) OVERRIDE; | 56 DevToolsAgentHostBinding* binding) OVERRIDE; |
| 60 virtual GURL GetFrontendURL(DevToolsAgentHost* agent_host) OVERRIDE; | 57 virtual GURL GetFrontendURL(DevToolsAgentHost* agent_host) OVERRIDE; |
| 61 | 58 |
| 62 // NotificationObserver implementation. | |
| 63 virtual void Observe(int type, | |
| 64 const NotificationSource& source, | |
| 65 const NotificationDetails& details) OVERRIDE; | |
| 66 | |
| 67 // net::HttpServer::Delegate implementation. | 59 // net::HttpServer::Delegate implementation. |
| 68 virtual void OnHttpRequest(int connection_id, | 60 virtual void OnHttpRequest(int connection_id, |
| 69 const net::HttpServerRequestInfo& info) OVERRIDE; | 61 const net::HttpServerRequestInfo& info) OVERRIDE; |
| 70 virtual void OnWebSocketRequest( | 62 virtual void OnWebSocketRequest( |
| 71 int connection_id, | 63 int connection_id, |
| 72 const net::HttpServerRequestInfo& info) OVERRIDE; | 64 const net::HttpServerRequestInfo& info) OVERRIDE; |
| 73 virtual void OnWebSocketMessage(int connection_id, | 65 virtual void OnWebSocketMessage(int connection_id, |
| 74 const std::string& data) OVERRIDE; | 66 const std::string& data) OVERRIDE; |
| 75 virtual void OnClose(int connection_id) OVERRIDE; | 67 virtual void OnClose(int connection_id) OVERRIDE; |
| 76 | 68 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 scoped_ptr<base::Thread> thread_; | 120 scoped_ptr<base::Thread> thread_; |
| 129 | 121 |
| 130 std::string overridden_frontend_url_; | 122 std::string overridden_frontend_url_; |
| 131 scoped_ptr<const net::StreamListenSocketFactory> socket_factory_; | 123 scoped_ptr<const net::StreamListenSocketFactory> socket_factory_; |
| 132 scoped_refptr<net::HttpServer> server_; | 124 scoped_refptr<net::HttpServer> server_; |
| 133 typedef std::map<int, DevToolsClientHost*> ConnectionToClientHostMap; | 125 typedef std::map<int, DevToolsClientHost*> ConnectionToClientHostMap; |
| 134 ConnectionToClientHostMap connection_to_client_host_ui_; | 126 ConnectionToClientHostMap connection_to_client_host_ui_; |
| 135 scoped_ptr<DevToolsHttpHandlerDelegate> delegate_; | 127 scoped_ptr<DevToolsHttpHandlerDelegate> delegate_; |
| 136 DevToolsAgentHostBinding* binding_; | 128 DevToolsAgentHostBinding* binding_; |
| 137 scoped_ptr<DevToolsAgentHostBinding> default_binding_; | 129 scoped_ptr<DevToolsAgentHostBinding> default_binding_; |
| 138 NotificationRegistrar registrar_; | |
| 139 scoped_ptr<DevToolsBrowserTarget> browser_target_; | 130 scoped_ptr<DevToolsBrowserTarget> browser_target_; |
| 140 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpHandlerImpl); | 131 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpHandlerImpl); |
| 141 }; | 132 }; |
| 142 | 133 |
| 143 } // namespace content | 134 } // namespace content |
| 144 | 135 |
| 145 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_HTTP_HANDLER_IMPL_H_ | 136 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_HTTP_HANDLER_IMPL_H_ |
| OLD | NEW |