Chromium Code Reviews| Index: chrome/browser/net/net_error_tab_helper.cc |
| diff --git a/chrome/browser/net/net_error_tab_helper.cc b/chrome/browser/net/net_error_tab_helper.cc |
| index 416251a5238533810dd8935d5032a467f1c9f654..598cc39a44a3487343bd74e9a9dea20046257c34 100644 |
| --- a/chrome/browser/net/net_error_tab_helper.cc |
| +++ b/chrome/browser/net/net_error_tab_helper.cc |
| @@ -21,6 +21,7 @@ |
| #include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/navigation_handle.h" |
| #include "content/public/browser/render_frame_host.h" |
| +#include "content/public/browser/web_contents_interface_registry.h" |
| #include "ipc/ipc_message_macros.h" |
| #include "net/base/net_errors.h" |
| #include "url/gurl.h" |
| @@ -98,10 +99,9 @@ void NetErrorTabHelper::RenderFrameCreated( |
| // platform's network diagnostics dialog. |
| if (render_frame_host->GetParent()) |
| return; |
| - render_frame_host->Send( |
| - new ChromeViewMsg_SetCanShowNetworkDiagnosticsDialog( |
| - render_frame_host->GetRoutingID(), |
| - CanShowNetworkDiagnosticsDialog())); |
| + |
| + remote_network_diagnostics_client_.ForFrame(render_frame_host) |
|
Sam McNally
2016/09/07 01:48:47
Do we need to keep connections alive beyond this m
Ken Rockot(use gerrit already)
2016/09/07 22:48:18
Not in this case. I've removed RemoteFrameInterfac
|
| + ->SetCanShowNetworkDiagnosticsDialog(CanShowNetworkDiagnosticsDialog()); |
| } |
| void NetErrorTabHelper::DidStartNavigationToPendingEntry( |
| @@ -183,10 +183,11 @@ bool NetErrorTabHelper::OnMessageReceived( |
| return false; |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(NetErrorTabHelper, message) |
| - IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RunNetworkDiagnostics, |
| - RunNetworkDiagnostics) |
| #if BUILDFLAG(ANDROID_JAVA_UI) |
| IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowOfflinePages, ShowOfflinePages) |
| +#else |
| + case 0: // MSVC complains if we have a switch with only a default clause. |
|
Sam McNally
2016/09/07 01:48:47
Can we move the entire message map into the #if?
Ken Rockot(use gerrit already)
2016/09/07 22:48:18
Done
|
| + return false; |
| #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| @@ -196,6 +197,7 @@ bool NetErrorTabHelper::OnMessageReceived( |
| NetErrorTabHelper::NetErrorTabHelper(WebContents* contents) |
| : WebContentsObserver(contents), |
| + network_diagnostics_binding_(contents, this), |
| is_error_page_(false), |
| dns_error_active_(false), |
| dns_error_page_committed_(false), |
| @@ -286,12 +288,17 @@ void NetErrorTabHelper::RunNetworkDiagnostics(const GURL& url) { |
| // any other schemes, but the renderer is not trusted. |
| if (!url.is_valid() || !url.SchemeIsHTTPOrHTTPS()) |
| return; |
| + |
| // Sanitize URL prior to running diagnostics on it. |
| RunNetworkDiagnosticsHelper(url.GetOrigin().spec()); |
| } |
| void NetErrorTabHelper::RunNetworkDiagnosticsHelper( |
| const std::string& sanitized_url) { |
| + if (web_contents()->GetInterfaces()->GetCurrentTargetFrame() |
| + != web_contents()->GetMainFrame()) |
|
Sam McNally
2016/09/07 01:48:47
{}
Ken Rockot(use gerrit already)
2016/09/07 22:48:18
Done
|
| + return; |
| + |
| ShowNetworkDiagnosticsDialog(web_contents(), sanitized_url); |
| } |