| 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 #ifndef CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/prefs/pref_member.h" | 14 #include "base/prefs/pref_member.h" |
| 15 #include "chrome/browser/net/dns_probe_service.h" | 15 #include "chrome/browser/net/dns_probe_service.h" |
| 16 #include "chrome/common/features.h" |
| 16 #include "components/error_page/common/net_error_info.h" | 17 #include "components/error_page/common/net_error_info.h" |
| 17 #include "content/public/browser/web_contents_observer.h" | 18 #include "content/public/browser/web_contents_observer.h" |
| 18 #include "content/public/browser/web_contents_user_data.h" | 19 #include "content/public/browser/web_contents_user_data.h" |
| 19 | 20 |
| 20 namespace chrome_browser_net { | 21 namespace chrome_browser_net { |
| 21 | 22 |
| 22 // A TabHelper that monitors loads for certain types of network errors and | 23 // A TabHelper that monitors loads for certain types of network errors and |
| 23 // does interesting things with them. Currently, starts DNS probes using the | 24 // does interesting things with them. Currently, starts DNS probes using the |
| 24 // DnsProbeService whenever a page fails to load with a DNS-related error. | 25 // DnsProbeService whenever a page fails to load with a DNS-related error. |
| 25 class NetErrorTabHelper | 26 class NetErrorTabHelper |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 bool ProbesAllowed() const; | 97 bool ProbesAllowed() const; |
| 97 | 98 |
| 98 // Sanitizes |url| and shows a dialog for it. | 99 // Sanitizes |url| and shows a dialog for it. |
| 99 void RunNetworkDiagnostics(const GURL& url); | 100 void RunNetworkDiagnostics(const GURL& url); |
| 100 | 101 |
| 101 // Shows the diagnostics dialog after its been sanitized, virtual for | 102 // Shows the diagnostics dialog after its been sanitized, virtual for |
| 102 // testing. | 103 // testing. |
| 103 virtual void RunNetworkDiagnosticsHelper(const std::string& sanitized_url); | 104 virtual void RunNetworkDiagnosticsHelper(const std::string& sanitized_url); |
| 104 | 105 |
| 105 // Relates to offline pages handling. | 106 // Relates to offline pages handling. |
| 106 #if defined(OS_ANDROID) | 107 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 107 void SetOfflinePageInfo(content::RenderFrameHost* render_frame_host, | 108 void SetOfflinePageInfo(content::RenderFrameHost* render_frame_host, |
| 108 const GURL& url); | 109 const GURL& url); |
| 109 void ShowOfflinePages(); | 110 void ShowOfflinePages(); |
| 110 void LoadOfflineCopy(const GURL& url); | 111 void LoadOfflineCopy(const GURL& url); |
| 111 bool IsFromErrorPage() const; | 112 bool IsFromErrorPage() const; |
| 112 #endif // defined(OS_ANDROID) | 113 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| 113 | 114 |
| 114 // True if the last provisional load that started was for an error page. | 115 // True if the last provisional load that started was for an error page. |
| 115 bool is_error_page_; | 116 bool is_error_page_; |
| 116 | 117 |
| 117 // True if the helper has seen a main frame page load fail with a DNS error, | 118 // True if the helper has seen a main frame page load fail with a DNS error, |
| 118 // but has not yet seen a new page commit successfully afterwards. | 119 // but has not yet seen a new page commit successfully afterwards. |
| 119 bool dns_error_active_; | 120 bool dns_error_active_; |
| 120 | 121 |
| 121 // True if the helper has seen an error page commit while |dns_error_active_| | 122 // True if the helper has seen an error page commit while |dns_error_active_| |
| 122 // is true. (This should never be true if |dns_error_active_| is false.) | 123 // is true. (This should never be true if |dns_error_active_| is false.) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 135 BooleanPrefMember resolve_errors_with_web_service_; | 136 BooleanPrefMember resolve_errors_with_web_service_; |
| 136 | 137 |
| 137 base::WeakPtrFactory<NetErrorTabHelper> weak_factory_; | 138 base::WeakPtrFactory<NetErrorTabHelper> weak_factory_; |
| 138 | 139 |
| 139 DISALLOW_COPY_AND_ASSIGN(NetErrorTabHelper); | 140 DISALLOW_COPY_AND_ASSIGN(NetErrorTabHelper); |
| 140 }; | 141 }; |
| 141 | 142 |
| 142 } // namespace chrome_browser_net | 143 } // namespace chrome_browser_net |
| 143 | 144 |
| 144 #endif // CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ | 145 #endif // CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ |
| OLD | NEW |