| 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 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/devtools/adb_client_socket.h" | 22 #include "chrome/browser/devtools/adb_client_socket.h" |
| 23 #include "chrome/browser/devtools/devtools_window.h" | 23 #include "chrome/browser/devtools/devtools_window.h" |
| 24 #include "chrome/browser/devtools/tethering_adb_filter.h" | 24 #include "chrome/browser/devtools/tethering_adb_filter.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/devtools_agent_host.h" | 27 #include "content/public/browser/devtools_agent_host.h" |
| 28 #include "content/public/browser/devtools_client_host.h" | 28 #include "content/public/browser/devtools_client_host.h" |
| 29 #include "content/public/browser/devtools_external_agent_proxy.h" | 29 #include "content/public/browser/devtools_external_agent_proxy.h" |
| 30 #include "content/public/browser/devtools_external_agent_proxy_delegate.h" | 30 #include "content/public/browser/devtools_external_agent_proxy_delegate.h" |
| 31 #include "content/public/browser/devtools_manager.h" | 31 #include "content/public/browser/devtools_manager.h" |
| 32 #include "content/public/browser/devtools_remote_frontend_util.h" |
| 32 #include "net/base/net_errors.h" | 33 #include "net/base/net_errors.h" |
| 33 #include "net/server/web_socket.h" | 34 #include "net/server/web_socket.h" |
| 34 | 35 |
| 35 using content::BrowserThread; | 36 using content::BrowserThread; |
| 36 using net::WebSocket; | 37 using net::WebSocket; |
| 37 | 38 |
| 38 namespace { | 39 namespace { |
| 39 | 40 |
| 40 static const char kDevToolsAdbBridgeThreadName[] = "Chrome_DevToolsADBThread"; | 41 static const char kDevToolsAdbBridgeThreadName[] = "Chrome_DevToolsADBThread"; |
| 41 static const char kDevToolsChannelPattern[] = "devtools_remote"; | 42 static const char kDevToolsChannelPattern[] = "devtools_remote"; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // 00000000: 00000002 00000000 00010000 0001 01 358606 @xxx_devtools_remote | 268 // 00000000: 00000002 00000000 00010000 0001 01 358606 @xxx_devtools_remote |
| 268 // 00000000: 00000002 00000000 00010000 0001 01 347300 @yyy_devtools_remote | 269 // 00000000: 00000002 00000000 00010000 0001 01 347300 @yyy_devtools_remote |
| 269 // | 270 // |
| 270 // We need to find records with paths starting from '@' (abstract socket) | 271 // We need to find records with paths starting from '@' (abstract socket) |
| 271 // and containing "devtools_remote". We have to extract the inode number | 272 // and containing "devtools_remote". We have to extract the inode number |
| 272 // in order to find the owning process name. | 273 // in order to find the owning process name. |
| 273 | 274 |
| 274 socket_to_package_.clear(); | 275 socket_to_package_.clear(); |
| 275 std::vector<std::string> entries; | 276 std::vector<std::string> entries; |
| 276 Tokenize(response, "\n", &entries); | 277 Tokenize(response, "\n", &entries); |
| 277 const std::string channel_pattern = kDevToolsChannelPattern; | 278 const std::string channel_pattern = |
| 279 content::GetDevToolsServerSocketSuffix(); |
| 278 for (size_t i = 1; i < entries.size(); ++i) { | 280 for (size_t i = 1; i < entries.size(); ++i) { |
| 279 std::vector<std::string> fields; | 281 std::vector<std::string> fields; |
| 280 Tokenize(entries[i], " ", &fields); | 282 Tokenize(entries[i], " ", &fields); |
| 281 if (fields.size() < 8) | 283 if (fields.size() < 8) |
| 282 continue; | 284 continue; |
| 283 if (fields[3] != "00010000" || fields[5] != "01") | 285 if (fields[3] != "00010000" || fields[5] != "01") |
| 284 continue; | 286 continue; |
| 285 std::string path_field = fields[7]; | 287 std::string path_field = fields[7]; |
| 286 if (path_field.size() < 1 || path_field[0] != '@') | 288 if (path_field.size() < 1 || path_field[0] != '@') |
| 287 continue; | 289 continue; |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 if (!has_message_loop_) | 654 if (!has_message_loop_) |
| 653 return; | 655 return; |
| 654 | 656 |
| 655 scoped_refptr<AdbAttachCommand> command( | 657 scoped_refptr<AdbAttachCommand> command( |
| 656 new AdbAttachCommand(weak_factory_.GetWeakPtr(), serial, socket, | 658 new AdbAttachCommand(weak_factory_.GetWeakPtr(), serial, socket, |
| 657 debug_url, frontend_url)); | 659 debug_url, frontend_url)); |
| 658 adb_thread_->message_loop()->PostTask( | 660 adb_thread_->message_loop()->PostTask( |
| 659 FROM_HERE, | 661 FROM_HERE, |
| 660 base::Bind(&AdbAttachCommand::Run, command)); | 662 base::Bind(&AdbAttachCommand::Run, command)); |
| 661 } | 663 } |
| OLD | NEW |