| 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/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/net/dns_probe_service.h" | 14 #include "chrome/browser/net/dns_probe_service.h" |
| 15 #include "chrome/common/features.h" | |
| 16 #include "chrome/common/network_diagnostics.mojom.h" | 15 #include "chrome/common/network_diagnostics.mojom.h" |
| 17 #include "components/error_page/common/net_error_info.h" | 16 #include "components/error_page/common/net_error_info.h" |
| 18 #include "components/prefs/pref_member.h" | 17 #include "components/prefs/pref_member.h" |
| 19 #include "content/public/browser/reload_type.h" | 18 #include "content/public/browser/reload_type.h" |
| 20 #include "content/public/browser/web_contents_binding_set.h" | 19 #include "content/public/browser/web_contents_binding_set.h" |
| 21 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
| 22 #include "content/public/browser/web_contents_user_data.h" | 21 #include "content/public/browser/web_contents_user_data.h" |
| 23 | 22 |
| 24 namespace chrome_browser_net { | 23 namespace chrome_browser_net { |
| 25 | 24 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 70 |
| 72 error_page::DnsProbeStatus dns_probe_status() const { | 71 error_page::DnsProbeStatus dns_probe_status() const { |
| 73 return dns_probe_status_; | 72 return dns_probe_status_; |
| 74 } | 73 } |
| 75 | 74 |
| 76 content::WebContentsFrameBindingSet<chrome::mojom::NetworkDiagnostics>& | 75 content::WebContentsFrameBindingSet<chrome::mojom::NetworkDiagnostics>& |
| 77 network_diagnostics_bindings_for_testing() { | 76 network_diagnostics_bindings_for_testing() { |
| 78 return network_diagnostics_bindings_; | 77 return network_diagnostics_bindings_; |
| 79 } | 78 } |
| 80 | 79 |
| 81 #if BUILDFLAG(ANDROID_JAVA_UI) | 80 #if defined(OS_ANDROID) |
| 82 void DownloadPageLater(); | 81 void DownloadPageLater(); |
| 83 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 82 #endif // defined(OS_ANDROID) |
| 84 | 83 |
| 85 private: | 84 private: |
| 86 friend class content::WebContentsUserData<NetErrorTabHelper>; | 85 friend class content::WebContentsUserData<NetErrorTabHelper>; |
| 87 | 86 |
| 88 void OnMainFrameDnsError(); | 87 void OnMainFrameDnsError(); |
| 89 | 88 |
| 90 void InitializePref(content::WebContents* contents); | 89 void InitializePref(content::WebContents* contents); |
| 91 bool ProbesAllowed() const; | 90 bool ProbesAllowed() const; |
| 92 | 91 |
| 93 // chrome::mojom::NetworkDiagnostics: | 92 // chrome::mojom::NetworkDiagnostics: |
| 94 void RunNetworkDiagnostics(const GURL& url) override; | 93 void RunNetworkDiagnostics(const GURL& url) override; |
| 95 | 94 |
| 96 // Shows the diagnostics dialog after its been sanitized, virtual for | 95 // Shows the diagnostics dialog after its been sanitized, virtual for |
| 97 // testing. | 96 // testing. |
| 98 virtual void RunNetworkDiagnosticsHelper(const std::string& sanitized_url); | 97 virtual void RunNetworkDiagnosticsHelper(const std::string& sanitized_url); |
| 99 | 98 |
| 100 #if BUILDFLAG(ANDROID_JAVA_UI) | 99 #if defined(OS_ANDROID) |
| 101 // Virtual for testing. | 100 // Virtual for testing. |
| 102 virtual void DownloadPageLaterHelper(const GURL& url); | 101 virtual void DownloadPageLaterHelper(const GURL& url); |
| 103 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 102 #endif // defined(OS_ANDROID) |
| 104 | 103 |
| 105 content::WebContentsFrameBindingSet<chrome::mojom::NetworkDiagnostics> | 104 content::WebContentsFrameBindingSet<chrome::mojom::NetworkDiagnostics> |
| 106 network_diagnostics_bindings_; | 105 network_diagnostics_bindings_; |
| 107 | 106 |
| 108 // True if the last provisional load that started was for an error page. | 107 // True if the last provisional load that started was for an error page. |
| 109 bool is_error_page_; | 108 bool is_error_page_; |
| 110 | 109 |
| 111 // True if the helper has seen a main frame page load fail with a DNS error, | 110 // True if the helper has seen a main frame page load fail with a DNS error, |
| 112 // but has not yet seen a new page commit successfully afterwards. | 111 // but has not yet seen a new page commit successfully afterwards. |
| 113 bool dns_error_active_; | 112 bool dns_error_active_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 129 BooleanPrefMember resolve_errors_with_web_service_; | 128 BooleanPrefMember resolve_errors_with_web_service_; |
| 130 | 129 |
| 131 base::WeakPtrFactory<NetErrorTabHelper> weak_factory_; | 130 base::WeakPtrFactory<NetErrorTabHelper> weak_factory_; |
| 132 | 131 |
| 133 DISALLOW_COPY_AND_ASSIGN(NetErrorTabHelper); | 132 DISALLOW_COPY_AND_ASSIGN(NetErrorTabHelper); |
| 134 }; | 133 }; |
| 135 | 134 |
| 136 } // namespace chrome_browser_net | 135 } // namespace chrome_browser_net |
| 137 | 136 |
| 138 #endif // CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ | 137 #endif // CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ |
| OLD | NEW |