| 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/inspect_ui.h" | 5 #include "chrome/browser/ui/webui/inspect_ui.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/devtools/devtools_targets_ui.h" | 9 #include "chrome/browser/devtools/devtools_targets_ui.h" |
| 10 #include "chrome/browser/devtools/devtools_ui_bindings.h" | 10 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 // Fetch agent host from remote browser. | 339 // Fetch agent host from remote browser. |
| 340 scoped_refptr<content::DevToolsAgentHost> agent_host = | 340 scoped_refptr<content::DevToolsAgentHost> agent_host = |
| 341 handler->GetBrowserAgentHost(browser_id); | 341 handler->GetBrowserAgentHost(browser_id); |
| 342 if (agent_host->IsAttached()) | 342 if (agent_host->IsAttached()) |
| 343 return; | 343 return; |
| 344 | 344 |
| 345 // Create web contents for the front-end. | 345 // Create web contents for the front-end. |
| 346 WebContents* inspect_ui = web_ui()->GetWebContents(); | 346 WebContents* inspect_ui = web_ui()->GetWebContents(); |
| 347 WebContents* front_end = inspect_ui->GetDelegate()->OpenURLFromTab( | 347 WebContents* front_end = inspect_ui->GetDelegate()->OpenURLFromTab( |
| 348 inspect_ui, | 348 inspect_ui, |
| 349 content::OpenURLParams(frontend_url, | 349 content::OpenURLParams(frontend_url, content::Referrer(), |
| 350 content::Referrer(), | 350 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 351 NEW_FOREGROUND_TAB, | 351 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false)); |
| 352 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | |
| 353 false)); | |
| 354 | 352 |
| 355 // Install devtools bindings. | 353 // Install devtools bindings. |
| 356 DevToolsUIBindingsEnabler* bindings_enabler = | 354 DevToolsUIBindingsEnabler* bindings_enabler = |
| 357 new DevToolsUIBindingsEnabler(front_end, frontend_url); | 355 new DevToolsUIBindingsEnabler(front_end, frontend_url); |
| 358 bindings_enabler->GetBindings()->AttachTo(agent_host); | 356 bindings_enabler->GetBindings()->AttachTo(agent_host); |
| 359 } | 357 } |
| 360 | 358 |
| 361 void InspectUI::InspectDevices(Browser* browser) { | 359 void InspectUI::InspectDevices(Browser* browser) { |
| 362 content::RecordAction(base::UserMetricsAction("InspectDevices")); | 360 content::RecordAction(base::UserMetricsAction("InspectDevices")); |
| 363 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( | 361 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 handler->ForceUpdate(); | 523 handler->ForceUpdate(); |
| 526 } | 524 } |
| 527 | 525 |
| 528 void InspectUI::PopulatePortStatus(const base::Value& status) { | 526 void InspectUI::PopulatePortStatus(const base::Value& status) { |
| 529 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); | 527 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); |
| 530 } | 528 } |
| 531 | 529 |
| 532 void InspectUI::ShowIncognitoWarning() { | 530 void InspectUI::ShowIncognitoWarning() { |
| 533 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); | 531 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); |
| 534 } | 532 } |
| OLD | NEW |