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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/metrics/user_metrics.h" |
9 #include "chrome/browser/devtools/devtools_targets_ui.h" | 10 #include "chrome/browser/devtools/devtools_targets_ui.h" |
10 #include "chrome/browser/devtools/devtools_ui_bindings.h" | 11 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
11 #include "chrome/browser/devtools/devtools_window.h" | 12 #include "chrome/browser/devtools/devtools_window.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser_navigator_params.h" | 14 #include "chrome/browser/ui/browser_navigator_params.h" |
14 #include "chrome/browser/ui/singleton_tabs.h" | 15 #include "chrome/browser/ui/singleton_tabs.h" |
15 #include "chrome/browser/ui/webui/theme_source.h" | 16 #include "chrome/browser/ui/webui/theme_source.h" |
16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
18 #include "chrome/grit/browser_resources.h" | 19 #include "chrome/grit/browser_resources.h" |
19 #include "components/prefs/pref_service.h" | 20 #include "components/prefs/pref_service.h" |
20 #include "components/ui_devtools/devtools_server.h" | 21 #include "components/ui_devtools/devtools_server.h" |
21 #include "content/public/browser/devtools_agent_host.h" | 22 #include "content/public/browser/devtools_agent_host.h" |
22 #include "content/public/browser/navigation_entry.h" | 23 #include "content/public/browser/navigation_entry.h" |
23 #include "content/public/browser/navigation_handle.h" | 24 #include "content/public/browser/navigation_handle.h" |
24 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
26 #include "content/public/browser/notification_types.h" | 27 #include "content/public/browser/notification_types.h" |
27 #include "content/public/browser/user_metrics.h" | |
28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
29 #include "content/public/browser/web_contents_delegate.h" | 29 #include "content/public/browser/web_contents_delegate.h" |
30 #include "content/public/browser/web_contents_observer.h" | 30 #include "content/public/browser/web_contents_observer.h" |
31 #include "content/public/browser/web_ui.h" | 31 #include "content/public/browser/web_ui.h" |
32 #include "content/public/browser/web_ui_data_source.h" | 32 #include "content/public/browser/web_ui_data_source.h" |
33 #include "content/public/browser/web_ui_message_handler.h" | 33 #include "content/public/browser/web_ui_message_handler.h" |
34 #include "content/public/common/frame_navigate_params.h" | 34 #include "content/public/common/frame_navigate_params.h" |
35 | 35 |
36 using content::DevToolsAgentHost; | 36 using content::DevToolsAgentHost; |
37 using content::WebContents; | 37 using content::WebContents; |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 427 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
428 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false)); | 428 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false)); |
429 | 429 |
430 // Install devtools bindings. | 430 // Install devtools bindings. |
431 DevToolsUIBindingsEnabler* bindings_enabler = | 431 DevToolsUIBindingsEnabler* bindings_enabler = |
432 new DevToolsUIBindingsEnabler(front_end, frontend_url); | 432 new DevToolsUIBindingsEnabler(front_end, frontend_url); |
433 bindings_enabler->GetBindings()->AttachTo(agent_host); | 433 bindings_enabler->GetBindings()->AttachTo(agent_host); |
434 } | 434 } |
435 | 435 |
436 void InspectUI::InspectDevices(Browser* browser) { | 436 void InspectUI::InspectDevices(Browser* browser) { |
437 content::RecordAction(base::UserMetricsAction("InspectDevices")); | 437 base::RecordAction(base::UserMetricsAction("InspectDevices")); |
438 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( | 438 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
439 browser, GURL(chrome::kChromeUIInspectURL))); | 439 browser, GURL(chrome::kChromeUIInspectURL))); |
440 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 440 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
441 ShowSingletonTabOverwritingNTP(browser, params); | 441 ShowSingletonTabOverwritingNTP(browser, params); |
442 } | 442 } |
443 | 443 |
444 void InspectUI::Observe(int type, | 444 void InspectUI::Observe(int type, |
445 const content::NotificationSource& source, | 445 const content::NotificationSource& source, |
446 const content::NotificationDetails& details) { | 446 const content::NotificationDetails& details) { |
447 if (source == content::Source<WebContents>(web_ui()->GetWebContents())) | 447 if (source == content::Source<WebContents>(web_ui()->GetWebContents())) |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 handler->ForceUpdate(); | 626 handler->ForceUpdate(); |
627 } | 627 } |
628 | 628 |
629 void InspectUI::PopulatePortStatus(const base::Value& status) { | 629 void InspectUI::PopulatePortStatus(const base::Value& status) { |
630 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); | 630 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); |
631 } | 631 } |
632 | 632 |
633 void InspectUI::ShowIncognitoWarning() { | 633 void InspectUI::ShowIncognitoWarning() { |
634 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); | 634 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); |
635 } | 635 } |
OLD | NEW |