| 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" |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 inspected_web_contents->OpenURL(params) : NULL; | 898 inspected_web_contents->OpenURL(params) : NULL; |
| 899 } | 899 } |
| 900 | 900 |
| 901 bindings_->Reattach(); | 901 bindings_->Reattach(); |
| 902 | 902 |
| 903 content::NavigationController::LoadURLParams load_url_params(params.url); | 903 content::NavigationController::LoadURLParams load_url_params(params.url); |
| 904 main_web_contents_->GetController().LoadURLWithParams(load_url_params); | 904 main_web_contents_->GetController().LoadURLWithParams(load_url_params); |
| 905 return main_web_contents_; | 905 return main_web_contents_; |
| 906 } | 906 } |
| 907 | 907 |
| 908 void DevToolsWindow::ShowCertificateViewer(int certificate_id) { | 908 void DevToolsWindow::ShowCertificateViewer( |
| 909 scoped_refptr<net::X509Certificate> certificate) { |
| 909 WebContents* inspected_contents = is_docked_ ? | 910 WebContents* inspected_contents = is_docked_ ? |
| 910 GetInspectedWebContents() : main_web_contents_; | 911 GetInspectedWebContents() : main_web_contents_; |
| 911 Browser* browser = NULL; | 912 Browser* browser = NULL; |
| 912 int tab = 0; | 913 int tab = 0; |
| 913 if (!FindInspectedBrowserAndTabIndex(inspected_contents, &browser, &tab)) | 914 if (!FindInspectedBrowserAndTabIndex(inspected_contents, &browser, &tab)) |
| 914 return; | 915 return; |
| 915 gfx::NativeWindow parent = browser->window()->GetNativeWindow(); | 916 gfx::NativeWindow parent = browser->window()->GetNativeWindow(); |
| 916 ::ShowCertificateViewerByID(inspected_contents, parent, certificate_id); | 917 ::ShowCertificateViewer(inspected_contents, parent, certificate.get()); |
| 917 } | 918 } |
| 918 | 919 |
| 919 void DevToolsWindow::ActivateContents(WebContents* contents) { | 920 void DevToolsWindow::ActivateContents(WebContents* contents) { |
| 920 if (is_docked_) { | 921 if (is_docked_) { |
| 921 WebContents* inspected_tab = GetInspectedWebContents(); | 922 WebContents* inspected_tab = GetInspectedWebContents(); |
| 922 if (inspected_tab) | 923 if (inspected_tab) |
| 923 inspected_tab->GetDelegate()->ActivateContents(inspected_tab); | 924 inspected_tab->GetDelegate()->ActivateContents(inspected_tab); |
| 924 } else if (browser_) { | 925 } else if (browser_) { |
| 925 browser_->window()->Activate(); | 926 browser_->window()->Activate(); |
| 926 } | 927 } |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { | 1321 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { |
| 1321 // Only route reload via front-end if the agent is attached. | 1322 // Only route reload via front-end if the agent is attached. |
| 1322 WebContents* wc = GetInspectedWebContents(); | 1323 WebContents* wc = GetInspectedWebContents(); |
| 1323 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1324 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
| 1324 return false; | 1325 return false; |
| 1325 base::FundamentalValue bypass_cache_value(bypass_cache); | 1326 base::FundamentalValue bypass_cache_value(bypass_cache); |
| 1326 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1327 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
| 1327 &bypass_cache_value, nullptr, nullptr); | 1328 &bypass_cache_value, nullptr, nullptr); |
| 1328 return true; | 1329 return true; |
| 1329 } | 1330 } |
| OLD | NEW |