| 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/net/net_error_tab_helper.h" | 5 #include "chrome/browser/net/net_error_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 rfh->Send(new ChromeViewMsg_NetErrorInfo(rfh->GetRoutingID(), | 255 rfh->Send(new ChromeViewMsg_NetErrorInfo(rfh->GetRoutingID(), |
| 256 dns_probe_status_)); | 256 dns_probe_status_)); |
| 257 | 257 |
| 258 if (!dns_probe_status_snoop_callback_.is_null()) | 258 if (!dns_probe_status_snoop_callback_.is_null()) |
| 259 dns_probe_status_snoop_callback_.Run(dns_probe_status_); | 259 dns_probe_status_snoop_callback_.Run(dns_probe_status_); |
| 260 } | 260 } |
| 261 | 261 |
| 262 void NetErrorTabHelper::RunNetworkDiagnostics(const GURL& url) { | 262 void NetErrorTabHelper::RunNetworkDiagnostics(const GURL& url) { |
| 263 // Only run diagnostics on HTTP or HTTPS URLs. Shouldn't receive URLs with | 263 // Only run diagnostics on HTTP or HTTPS URLs. Shouldn't receive URLs with |
| 264 // any other schemes, but the renderer is not trusted. | 264 // any other schemes, but the renderer is not trusted. |
| 265 if (!url.SchemeIsHTTPOrHTTPS()) | 265 if (!url.is_valid() || !url.SchemeIsHTTPOrHTTPS()) |
| 266 return; | 266 return; |
| 267 // Sanitize URL prior to running diagnostics on it. | 267 // Sanitize URL prior to running diagnostics on it. |
| 268 RunNetworkDiagnosticsHelper(url.GetOrigin()); | 268 RunNetworkDiagnosticsHelper(url.GetOrigin()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void NetErrorTabHelper::RunNetworkDiagnosticsHelper( | 271 void NetErrorTabHelper::RunNetworkDiagnosticsHelper( |
| 272 const GURL& sanitized_url) { | 272 const GURL& sanitized_url) { |
| 273 ShowNetworkDiagnosticsDialog(web_contents(), sanitized_url); | 273 ShowNetworkDiagnosticsDialog(web_contents(), sanitized_url); |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace chrome_browser_net | 276 } // namespace chrome_browser_net |
| OLD | NEW |