| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // Fetch agent host from remote browser. | 363 // Fetch agent host from remote browser. |
| 364 scoped_refptr<content::DevToolsAgentHost> agent_host = | 364 scoped_refptr<content::DevToolsAgentHost> agent_host = |
| 365 handler->GetBrowserAgentHost(browser_id); | 365 handler->GetBrowserAgentHost(browser_id); |
| 366 if (agent_host->IsAttached()) | 366 if (agent_host->IsAttached()) |
| 367 return; | 367 return; |
| 368 | 368 |
| 369 // Create web contents for the front-end. | 369 // Create web contents for the front-end. |
| 370 WebContents* inspect_ui = web_ui()->GetWebContents(); | 370 WebContents* inspect_ui = web_ui()->GetWebContents(); |
| 371 WebContents* front_end = inspect_ui->GetDelegate()->OpenURLFromTab( | 371 WebContents* front_end = inspect_ui->GetDelegate()->OpenURLFromTab( |
| 372 inspect_ui, | 372 inspect_ui, |
| 373 content::OpenURLParams(frontend_url, | 373 content::OpenURLParams(frontend_url, content::Referrer(), |
| 374 content::Referrer(), | 374 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 375 NEW_FOREGROUND_TAB, | 375 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false)); |
| 376 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | |
| 377 false)); | |
| 378 | 376 |
| 379 // Install devtools bindings. | 377 // Install devtools bindings. |
| 380 DevToolsUIBindingsEnabler* bindings_enabler = | 378 DevToolsUIBindingsEnabler* bindings_enabler = |
| 381 new DevToolsUIBindingsEnabler(front_end, frontend_url); | 379 new DevToolsUIBindingsEnabler(front_end, frontend_url); |
| 382 bindings_enabler->GetBindings()->AttachTo(agent_host); | 380 bindings_enabler->GetBindings()->AttachTo(agent_host); |
| 383 } | 381 } |
| 384 | 382 |
| 385 void InspectUI::InspectDevices(Browser* browser) { | 383 void InspectUI::InspectDevices(Browser* browser) { |
| 386 content::RecordAction(base::UserMetricsAction("InspectDevices")); | 384 content::RecordAction(base::UserMetricsAction("InspectDevices")); |
| 387 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( | 385 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 handler->ForceUpdate(); | 565 handler->ForceUpdate(); |
| 568 } | 566 } |
| 569 | 567 |
| 570 void InspectUI::PopulatePortStatus(const base::Value& status) { | 568 void InspectUI::PopulatePortStatus(const base::Value& status) { |
| 571 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); | 569 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); |
| 572 } | 570 } |
| 573 | 571 |
| 574 void InspectUI::ShowIncognitoWarning() { | 572 void InspectUI::ShowIncognitoWarning() { |
| 575 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); | 573 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); |
| 576 } | 574 } |
| OLD | NEW |