OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/devtools/devtools_adb_bridge.h" | 5 #include "chrome/browser/devtools/devtools_adb_bridge.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 return; | 322 return; |
323 CloseConnection(result, true); | 323 CloseConnection(result, true); |
324 } | 324 } |
325 | 325 |
326 void OnFrameRead(const std::string& message) { | 326 void OnFrameRead(const std::string& message) { |
327 scoped_ptr<base::Value> value(base::JSONReader::Read(message)); | 327 scoped_ptr<base::Value> value(base::JSONReader::Read(message)); |
328 DictionaryValue* dvalue; | 328 DictionaryValue* dvalue; |
329 if (!value || !value->GetAsDictionary(&dvalue)) | 329 if (!value || !value->GetAsDictionary(&dvalue)) |
330 return; | 330 return; |
331 | 331 |
332 content::DevToolsManager* manager = content::DevToolsManager::GetInstance(); | 332 proxy_->DispatchOnClientHost(message); |
333 content::DevToolsClientHost* client_host = | |
334 manager->GetDevToolsClientHostFor(proxy_->GetAgentHost()); | |
335 if (client_host) | |
336 client_host->DispatchOnInspectorFrontend(message); | |
337 } | 333 } |
338 | 334 |
339 void OnSocketClosed(int result) { | 335 void OnSocketClosed(int result) { |
340 proxy_->ConnectionClosed(); | 336 proxy_->ConnectionClosed(); |
341 } | 337 } |
342 | 338 |
343 std::string id_; | 339 std::string id_; |
344 scoped_refptr<DevToolsAdbBridge::RefCountedAdbThread> adb_thread_; | 340 scoped_refptr<DevToolsAdbBridge::RefCountedAdbThread> adb_thread_; |
345 scoped_ptr<net::TCPClientSocket> socket_; | 341 scoped_ptr<net::TCPClientSocket> socket_; |
346 scoped_ptr<content::DevToolsExternalAgentProxy> proxy_; | 342 scoped_ptr<content::DevToolsExternalAgentProxy> proxy_; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 if (!has_message_loop_) | 516 if (!has_message_loop_) |
521 return; | 517 return; |
522 | 518 |
523 scoped_refptr<AdbAttachCommand> command( | 519 scoped_refptr<AdbAttachCommand> command( |
524 new AdbAttachCommand(weak_factory_.GetWeakPtr(), serial, debug_url, | 520 new AdbAttachCommand(weak_factory_.GetWeakPtr(), serial, debug_url, |
525 frontend_url)); | 521 frontend_url)); |
526 adb_thread_->message_loop()->PostTask( | 522 adb_thread_->message_loop()->PostTask( |
527 FROM_HERE, | 523 FROM_HERE, |
528 base::Bind(&AdbAttachCommand::Run, command)); | 524 base::Bind(&AdbAttachCommand::Run, command)); |
529 } | 525 } |
OLD | NEW |