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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/devtools/devtools_target_impl.h" | 9 #include "chrome/browser/devtools/devtools_target_impl.h" |
10 #include "chrome/browser/devtools/devtools_targets_ui.h" | 10 #include "chrome/browser/devtools/devtools_targets_ui.h" |
11 #include "chrome/browser/devtools/devtools_ui_bindings.h" | 11 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser_navigator.h" | 13 #include "chrome/browser/ui/browser_navigator.h" |
14 #include "chrome/browser/ui/singleton_tabs.h" | 14 #include "chrome/browser/ui/singleton_tabs.h" |
15 #include "chrome/browser/ui/webui/theme_source.h" | 15 #include "chrome/browser/ui/webui/theme_source.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
18 #include "content/public/browser/devtools_agent_host.h" | 18 #include "content/public/browser/devtools_agent_host.h" |
| 19 #include "content/public/browser/devtools_manager.h" |
19 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
20 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.h" |
21 #include "content/public/browser/notification_types.h" | 22 #include "content/public/browser/notification_types.h" |
22 #include "content/public/browser/user_metrics.h" | 23 #include "content/public/browser/user_metrics.h" |
23 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
24 #include "content/public/browser/web_contents_delegate.h" | 25 #include "content/public/browser/web_contents_delegate.h" |
25 #include "content/public/browser/web_ui.h" | 26 #include "content/public/browser/web_ui.h" |
26 #include "content/public/browser/web_ui_data_source.h" | 27 #include "content/public/browser/web_ui_data_source.h" |
27 #include "content/public/browser/web_ui_message_handler.h" | 28 #include "content/public/browser/web_ui_message_handler.h" |
28 #include "grit/browser_resources.h" | 29 #include "grit/browser_resources.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 inspect_ui, | 285 inspect_ui, |
285 content::OpenURLParams(GURL(url::kAboutBlankURL), | 286 content::OpenURLParams(GURL(url::kAboutBlankURL), |
286 content::Referrer(), | 287 content::Referrer(), |
287 NEW_FOREGROUND_TAB, | 288 NEW_FOREGROUND_TAB, |
288 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 289 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
289 false)); | 290 false)); |
290 | 291 |
291 // Install devtools bindings. | 292 // Install devtools bindings. |
292 DevToolsUIBindings* bindings = new DevToolsUIBindings(front_end, | 293 DevToolsUIBindings* bindings = new DevToolsUIBindings(front_end, |
293 frontend_url); | 294 frontend_url); |
294 bindings->AttachTo(agent_host.get()); | 295 |
| 296 // Engage remote debugging between front-end and agent host. |
| 297 content::DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor( |
| 298 agent_host, bindings); |
295 } | 299 } |
296 | 300 |
297 void InspectUI::InspectDevices(Browser* browser) { | 301 void InspectUI::InspectDevices(Browser* browser) { |
298 content::RecordAction(base::UserMetricsAction("InspectDevices")); | 302 content::RecordAction(base::UserMetricsAction("InspectDevices")); |
299 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( | 303 chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( |
300 browser, GURL(chrome::kChromeUIInspectURL))); | 304 browser, GURL(chrome::kChromeUIInspectURL))); |
301 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; | 305 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; |
302 ShowSingletonTabOverwritingNTP(browser, params); | 306 ShowSingletonTabOverwritingNTP(browser, params); |
303 } | 307 } |
304 | 308 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 targets); | 482 targets); |
479 } | 483 } |
480 | 484 |
481 void InspectUI::PopulatePortStatus(const base::Value& status) { | 485 void InspectUI::PopulatePortStatus(const base::Value& status) { |
482 web_ui()->CallJavascriptFunction("populatePortStatus", status); | 486 web_ui()->CallJavascriptFunction("populatePortStatus", status); |
483 } | 487 } |
484 | 488 |
485 void InspectUI::ShowIncognitoWarning() { | 489 void InspectUI::ShowIncognitoWarning() { |
486 web_ui()->CallJavascriptFunction("showIncognitoWarning"); | 490 web_ui()->CallJavascriptFunction("showIncognitoWarning"); |
487 } | 491 } |
OLD | NEW |