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 #include "content/browser/devtools/devtools_http_handler_impl.h" | 5 #include "content/browser/devtools/devtools_http_handler_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 MessageLoop* message_loop, | 105 MessageLoop* message_loop, |
106 net::HttpServer* server, | 106 net::HttpServer* server, |
107 int connection_id) | 107 int connection_id) |
108 : message_loop_(message_loop), | 108 : message_loop_(message_loop), |
109 server_(server), | 109 server_(server), |
110 connection_id_(connection_id), | 110 connection_id_(connection_id), |
111 is_closed_(false), | 111 is_closed_(false), |
112 detach_reason_("target_closed") { | 112 detach_reason_("target_closed") { |
113 } | 113 } |
114 | 114 |
115 ~DevToolsClientHostImpl() {} | 115 virtual ~DevToolsClientHostImpl() {} |
116 | 116 |
117 // DevToolsClientHost interface | 117 // DevToolsClientHost interface |
118 virtual void InspectedContentsClosing() { | 118 virtual void InspectedContentsClosing() OVERRIDE { |
119 if (is_closed_) | 119 if (is_closed_) |
120 return; | 120 return; |
121 is_closed_ = true; | 121 is_closed_ = true; |
122 | 122 |
123 std::string response = | 123 std::string response = |
124 WebKit::WebDevToolsAgent::inspectorDetachedEvent( | 124 WebKit::WebDevToolsAgent::inspectorDetachedEvent( |
125 WebKit::WebString::fromUTF8(detach_reason_)).utf8(); | 125 WebKit::WebString::fromUTF8(detach_reason_)).utf8(); |
126 message_loop_->PostTask( | 126 message_loop_->PostTask( |
127 FROM_HERE, | 127 FROM_HERE, |
128 base::Bind(&net::HttpServer::SendOverWebSocket, | 128 base::Bind(&net::HttpServer::SendOverWebSocket, |
129 server_, | 129 server_, |
130 connection_id_, | 130 connection_id_, |
131 response)); | 131 response)); |
132 | 132 |
133 message_loop_->PostTask( | 133 message_loop_->PostTask( |
134 FROM_HERE, | 134 FROM_HERE, |
135 base::Bind(&net::HttpServer::Close, server_, connection_id_)); | 135 base::Bind(&net::HttpServer::Close, server_, connection_id_)); |
136 } | 136 } |
137 | 137 |
138 virtual void DispatchOnInspectorFrontend(const std::string& data) { | 138 virtual void DispatchOnInspectorFrontend(const std::string& data) OVERRIDE { |
139 message_loop_->PostTask( | 139 message_loop_->PostTask( |
140 FROM_HERE, | 140 FROM_HERE, |
141 base::Bind(&net::HttpServer::SendOverWebSocket, | 141 base::Bind(&net::HttpServer::SendOverWebSocket, |
142 server_, | 142 server_, |
143 connection_id_, | 143 connection_id_, |
144 data)); | 144 data)); |
145 } | 145 } |
146 | 146 |
147 virtual void ReplacedWithAnotherClient() { | 147 virtual void ReplacedWithAnotherClient() OVERRIDE { |
148 detach_reason_ = "replaced_with_devtools"; | 148 detach_reason_ = "replaced_with_devtools"; |
149 } | 149 } |
150 | 150 |
151 private: | 151 private: |
152 MessageLoop* message_loop_; | 152 MessageLoop* message_loop_; |
153 net::HttpServer* server_; | 153 net::HttpServer* server_; |
154 int connection_id_; | 154 int connection_id_; |
155 bool is_closed_; | 155 bool is_closed_; |
156 std::string detach_reason_; | 156 std::string detach_reason_; |
157 }; | 157 }; |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 page_info.id.c_str())); | 889 page_info.id.c_str())); |
890 std::string devtools_frontend_url = GetFrontendURLInternal( | 890 std::string devtools_frontend_url = GetFrontendURLInternal( |
891 page_info.id.c_str(), | 891 page_info.id.c_str(), |
892 host); | 892 host); |
893 dictionary->SetString("devtoolsFrontendUrl", devtools_frontend_url); | 893 dictionary->SetString("devtoolsFrontendUrl", devtools_frontend_url); |
894 } | 894 } |
895 return dictionary; | 895 return dictionary; |
896 } | 896 } |
897 | 897 |
898 } // namespace content | 898 } // namespace content |
OLD | NEW |