| 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/devtools/devtools_window.h" | 5 #include "chrome/browser/devtools/devtools_window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/prefs/scoped_user_pref_update.h" | 12 #include "base/prefs/scoped_user_pref_update.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/certificate_viewer.h" |
| 15 #include "chrome/browser/file_select_helper.h" | 16 #include "chrome/browser/file_select_helper.h" |
| 16 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
| 17 #include "chrome/browser/prefs/pref_service_syncable.h" | 18 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/sessions/session_tab_helper.h" | 20 #include "chrome/browser/sessions/session_tab_helper.h" |
| 20 #include "chrome/browser/task_management/web_contents_tags.h" | 21 #include "chrome/browser/task_management/web_contents_tags.h" |
| 21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_dialogs.h" | 23 #include "chrome/browser/ui/browser_dialogs.h" |
| 23 #include "chrome/browser/ui/browser_iterator.h" | 24 #include "chrome/browser/ui/browser_iterator.h" |
| 24 #include "chrome/browser/ui/browser_list.h" | 25 #include "chrome/browser/ui/browser_list.h" |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 inspected_web_contents->OpenURL(params) : NULL; | 838 inspected_web_contents->OpenURL(params) : NULL; |
| 838 } | 839 } |
| 839 | 840 |
| 840 bindings_->Reattach(); | 841 bindings_->Reattach(); |
| 841 | 842 |
| 842 content::NavigationController::LoadURLParams load_url_params(params.url); | 843 content::NavigationController::LoadURLParams load_url_params(params.url); |
| 843 main_web_contents_->GetController().LoadURLWithParams(load_url_params); | 844 main_web_contents_->GetController().LoadURLWithParams(load_url_params); |
| 844 return main_web_contents_; | 845 return main_web_contents_; |
| 845 } | 846 } |
| 846 | 847 |
| 848 void DevToolsWindow::ShowCertificateViewer(int certificate_id) { |
| 849 ::ShowCertificateViewerByID( |
| 850 is_docked_ ? GetInspectedWebContents() : main_web_contents_, |
| 851 nullptr, certificate_id); |
| 852 } |
| 853 |
| 847 void DevToolsWindow::ActivateContents(WebContents* contents) { | 854 void DevToolsWindow::ActivateContents(WebContents* contents) { |
| 848 if (is_docked_) { | 855 if (is_docked_) { |
| 849 WebContents* inspected_tab = GetInspectedWebContents(); | 856 WebContents* inspected_tab = GetInspectedWebContents(); |
| 850 if (inspected_tab) | 857 if (inspected_tab) |
| 851 inspected_tab->GetDelegate()->ActivateContents(inspected_tab); | 858 inspected_tab->GetDelegate()->ActivateContents(inspected_tab); |
| 852 } else if (browser_) { | 859 } else if (browser_) { |
| 853 browser_->window()->Activate(); | 860 browser_->window()->Activate(); |
| 854 } | 861 } |
| 855 } | 862 } |
| 856 | 863 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 bool DevToolsWindow::ForwardKeyboardEvent( | 1245 bool DevToolsWindow::ForwardKeyboardEvent( |
| 1239 const content::NativeWebKeyboardEvent& event) { | 1246 const content::NativeWebKeyboardEvent& event) { |
| 1240 return event_forwarder_->ForwardEvent(event); | 1247 return event_forwarder_->ForwardEvent(event); |
| 1241 } | 1248 } |
| 1242 | 1249 |
| 1243 void DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) { | 1250 void DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) { |
| 1244 base::FundamentalValue ignore_cache_value(ignore_cache); | 1251 base::FundamentalValue ignore_cache_value(ignore_cache); |
| 1245 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1252 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
| 1246 &ignore_cache_value, nullptr, nullptr); | 1253 &ignore_cache_value, nullptr, nullptr); |
| 1247 } | 1254 } |
| OLD | NEW |