| 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 "chrome/browser/ui/webui/devtools_ui.h" | 5 #include "chrome/browser/ui/webui/devtools_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); | 184 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); |
| 185 bundled_path_prefix += "/"; | 185 bundled_path_prefix += "/"; |
| 186 if (StartsWithASCII(path, bundled_path_prefix, false)) { | 186 if (StartsWithASCII(path, bundled_path_prefix, false)) { |
| 187 StartBundledDataRequest(path.substr(bundled_path_prefix.length()), | 187 StartBundledDataRequest(path.substr(bundled_path_prefix.length()), |
| 188 render_process_id, render_frame_id, callback); | 188 render_process_id, render_frame_id, callback); |
| 189 return; | 189 return; |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Serve static response while connecting to the remote device. | 192 // Serve static response while connecting to the remote device. |
| 193 if (StartsWithASCII(path, kRemoteOpenPrefix, false)) { | 193 if (StartsWithASCII(path, kRemoteOpenPrefix, false)) { |
| 194 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 194 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 195 switches::kEnableDevToolsExperiments)) { | 195 switches::kEnableDevToolsExperiments)) { |
| 196 callback.Run(NULL); | 196 callback.Run(NULL); |
| 197 return; | 197 return; |
| 198 } | 198 } |
| 199 std::string response = "Connecting to the device..."; | 199 std::string response = "Connecting to the device..."; |
| 200 callback.Run(base::RefCountedString::TakeString(&response)); | 200 callback.Run(base::RefCountedString::TakeString(&response)); |
| 201 return; | 201 return; |
| 202 } | 202 } |
| 203 | 203 |
| 204 // Serve request from remote location. | 204 // Serve request from remote location. |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 profile, | 370 profile, |
| 371 new DevToolsDataSource(profile->GetRequestContext())); | 371 new DevToolsDataSource(profile->GetRequestContext())); |
| 372 } | 372 } |
| 373 | 373 |
| 374 DevToolsUI::~DevToolsUI() { | 374 DevToolsUI::~DevToolsUI() { |
| 375 } | 375 } |
| 376 | 376 |
| 377 void DevToolsUI::NavigationEntryCommitted( | 377 void DevToolsUI::NavigationEntryCommitted( |
| 378 const content::LoadCommittedDetails& load_details) { | 378 const content::LoadCommittedDetails& load_details) { |
| 379 content::NavigationEntry* entry = load_details.entry; | 379 content::NavigationEntry* entry = load_details.entry; |
| 380 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 380 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 381 switches::kEnableDevToolsExperiments)) { | 381 switches::kEnableDevToolsExperiments)) { |
| 382 return; | 382 return; |
| 383 } | 383 } |
| 384 | 384 |
| 385 if (entry->GetVirtualURL() == remote_frontend_loading_url_) { | 385 if (entry->GetVirtualURL() == remote_frontend_loading_url_) { |
| 386 remote_frontend_loading_url_ = GURL(); | 386 remote_frontend_loading_url_ = GURL(); |
| 387 return; | 387 return; |
| 388 } | 388 } |
| 389 | 389 |
| 390 std::string path = entry->GetVirtualURL().path().substr(1); | 390 std::string path = entry->GetVirtualURL().path().substr(1); |
| 391 if (!StartsWithASCII(path, kRemoteOpenPrefix, false)) | 391 if (!StartsWithASCII(path, kRemoteOpenPrefix, false)) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 419 params.should_replace_current_entry = true; | 419 params.should_replace_current_entry = true; |
| 420 remote_frontend_loading_url_ = virtual_url; | 420 remote_frontend_loading_url_ = virtual_url; |
| 421 navigation_controller.LoadURLWithParams(params); | 421 navigation_controller.LoadURLWithParams(params); |
| 422 navigation_controller.GetPendingEntry()->SetVirtualURL(virtual_url); | 422 navigation_controller.GetPendingEntry()->SetVirtualURL(virtual_url); |
| 423 | 423 |
| 424 DevToolsAndroidBridge* bridge = | 424 DevToolsAndroidBridge* bridge = |
| 425 DevToolsAndroidBridge::Factory::GetForProfile(profile); | 425 DevToolsAndroidBridge::Factory::GetForProfile(profile); |
| 426 scoped_ptr<DevToolsTargetImpl> target(bridge->CreatePageTarget(page)); | 426 scoped_ptr<DevToolsTargetImpl> target(bridge->CreatePageTarget(page)); |
| 427 bindings_.AttachTo(target->GetAgentHost()); | 427 bindings_.AttachTo(target->GetAgentHost()); |
| 428 } | 428 } |
| OLD | NEW |