| 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 "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/io_thread.h" | 10 #include "chrome/browser/io_thread.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 testing_state_ = state; | 86 testing_state_ = state; |
| 87 } | 87 } |
| 88 | 88 |
| 89 void NetErrorTabHelper::RenderFrameCreated( | 89 void NetErrorTabHelper::RenderFrameCreated( |
| 90 content::RenderFrameHost* render_frame_host) { | 90 content::RenderFrameHost* render_frame_host) { |
| 91 // Ignore subframe creation - only main frame error pages can link to the | 91 // Ignore subframe creation - only main frame error pages can link to the |
| 92 // platform's network diagnostics dialog. | 92 // platform's network diagnostics dialog. |
| 93 if (render_frame_host->GetParent()) | 93 if (render_frame_host->GetParent()) |
| 94 return; | 94 return; |
| 95 | 95 |
| 96 mojom::NetworkDiagnosticsClientAssociatedPtr client; | 96 chrome::mojom::NetworkDiagnosticsClientAssociatedPtr client; |
| 97 render_frame_host->GetRemoteAssociatedInterfaces()->GetInterface(&client); | 97 render_frame_host->GetRemoteAssociatedInterfaces()->GetInterface(&client); |
| 98 client->SetCanShowNetworkDiagnosticsDialog(CanShowNetworkDiagnosticsDialog()); | 98 client->SetCanShowNetworkDiagnosticsDialog(CanShowNetworkDiagnosticsDialog()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void NetErrorTabHelper::DidStartNavigation( | 101 void NetErrorTabHelper::DidStartNavigation( |
| 102 content::NavigationHandle* navigation_handle) { | 102 content::NavigationHandle* navigation_handle) { |
| 103 if (!navigation_handle->IsInMainFrame()) | 103 if (!navigation_handle->IsInMainFrame()) |
| 104 return; | 104 return; |
| 105 | 105 |
| 106 if (navigation_handle->IsErrorPage() && | 106 if (navigation_handle->IsErrorPage() && |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 bool NetErrorTabHelper::IsFromErrorPage() const { | 296 bool NetErrorTabHelper::IsFromErrorPage() const { |
| 297 content::NavigationEntry* entry = | 297 content::NavigationEntry* entry = |
| 298 web_contents()->GetController().GetLastCommittedEntry(); | 298 web_contents()->GetController().GetLastCommittedEntry(); |
| 299 return entry && (entry->GetPageType() == content::PAGE_TYPE_ERROR); | 299 return entry && (entry->GetPageType() == content::PAGE_TYPE_ERROR); |
| 300 } | 300 } |
| 301 | 301 |
| 302 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 302 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| 303 | 303 |
| 304 } // namespace chrome_browser_net | 304 } // namespace chrome_browser_net |
| OLD | NEW |