| 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> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 const net::HttpServerRequestInfo& info); | 73 const net::HttpServerRequestInfo& info); |
| 74 void OnWebSocketMessageUI(int connection_id, const std::string& data); | 74 void OnWebSocketMessageUI(int connection_id, const std::string& data); |
| 75 void OnCloseUI(int connection_id); | 75 void OnCloseUI(int connection_id); |
| 76 | 76 |
| 77 void ResetHandlerThread(); | 77 void ResetHandlerThread(); |
| 78 void ResetHandlerThreadAndRelease(); | 78 void ResetHandlerThreadAndRelease(); |
| 79 | 79 |
| 80 void OnTargetListReceived( | 80 void OnTargetListReceived( |
| 81 int connection_id, | 81 int connection_id, |
| 82 const std::string& host, | 82 const std::string& host, |
| 83 const GURL& aux_url, |
| 83 const DevToolsHttpHandlerDelegate::TargetList& targets); | 84 const DevToolsHttpHandlerDelegate::TargetList& targets); |
| 84 | 85 |
| 85 DevToolsTarget* GetTarget(const std::string& id); | 86 DevToolsTarget* GetTarget(const std::string& id); |
| 86 | 87 |
| 87 void Init(); | 88 void Init(); |
| 88 void Teardown(); | 89 void Teardown(); |
| 89 | 90 |
| 90 void StartHandlerThread(); | 91 void StartHandlerThread(); |
| 91 void StopHandlerThread(); | 92 void StopHandlerThread(); |
| 92 | 93 |
| 93 void SendJson(int connection_id, | 94 void SendJson(int connection_id, |
| 94 net::HttpStatusCode status_code, | 95 net::HttpStatusCode status_code, |
| 95 base::Value* value, | 96 base::Value* value, |
| 96 const std::string& message); | 97 const std::string& message); |
| 97 void Send200(int connection_id, | 98 void Send200(int connection_id, |
| 98 const std::string& data, | 99 const std::string& data, |
| 99 const std::string& mime_type); | 100 const std::string& mime_type); |
| 100 void Send404(int connection_id); | 101 void Send404(int connection_id); |
| 101 void Send500(int connection_id, | 102 void Send500(int connection_id, |
| 102 const std::string& message); | 103 const std::string& message); |
| 103 void AcceptWebSocket(int connection_id, | 104 void AcceptWebSocket(int connection_id, |
| 104 const net::HttpServerRequestInfo& request); | 105 const net::HttpServerRequestInfo& request); |
| 105 | 106 |
| 106 // Returns the front end url without the host at the beginning. | 107 // Returns the front end url without the host at the beginning. |
| 107 std::string GetFrontendURLInternal(const std::string target_id, | 108 std::string GetFrontendURLInternal(const std::string target_id, |
| 108 const std::string& host); | 109 const std::string& host, |
| 110 const std::string& frontend_url); |
| 109 | 111 |
| 110 base::DictionaryValue* SerializeTarget(const DevToolsTarget& target, | 112 base::DictionaryValue* SerializeTarget( |
| 111 const std::string& host); | 113 const DevToolsTarget& target, |
| 114 const std::string& host, |
| 115 const GURL& aux_url); |
| 112 | 116 |
| 113 // The thread used by the devtools handler to run server socket. | 117 // The thread used by the devtools handler to run server socket. |
| 114 scoped_ptr<base::Thread> thread_; | 118 scoped_ptr<base::Thread> thread_; |
| 115 | 119 |
| 116 std::string overridden_frontend_url_; | 120 std::string frontend_url_; |
| 117 scoped_ptr<const net::StreamListenSocketFactory> socket_factory_; | 121 scoped_ptr<const net::StreamListenSocketFactory> socket_factory_; |
| 118 scoped_refptr<net::HttpServer> server_; | 122 scoped_refptr<net::HttpServer> server_; |
| 119 typedef std::map<int, DevToolsClientHost*> ConnectionToClientHostMap; | 123 typedef std::map<int, DevToolsClientHost*> ConnectionToClientHostMap; |
| 120 ConnectionToClientHostMap connection_to_client_host_ui_; | 124 ConnectionToClientHostMap connection_to_client_host_ui_; |
| 121 scoped_ptr<DevToolsHttpHandlerDelegate> delegate_; | 125 scoped_ptr<DevToolsHttpHandlerDelegate> delegate_; |
| 122 typedef std::map<std::string, DevToolsTarget*> TargetMap; | 126 typedef std::map<std::string, DevToolsTarget*> TargetMap; |
| 123 TargetMap target_map_; | 127 TargetMap target_map_; |
| 124 scoped_refptr<DevToolsBrowserTarget> browser_target_; | 128 scoped_refptr<DevToolsBrowserTarget> browser_target_; |
| 125 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpHandlerImpl); | 129 DISALLOW_COPY_AND_ASSIGN(DevToolsHttpHandlerImpl); |
| 126 }; | 130 }; |
| 127 | 131 |
| 128 } // namespace content | 132 } // namespace content |
| 129 | 133 |
| 130 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_HTTP_HANDLER_IMPL_H_ | 134 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_HTTP_HANDLER_IMPL_H_ |
| OLD | NEW |