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" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // Sets a callback that will be called immediately after the helper sends | 44 // Sets a callback that will be called immediately after the helper sends |
45 // a NetErrorHelper IPC. (Used by the DNS probe browser test to know when to | 45 // a NetErrorHelper IPC. (Used by the DNS probe browser test to know when to |
46 // check the error page for updates, instead of polling.) | 46 // check the error page for updates, instead of polling.) |
47 void set_dns_probe_status_snoop_callback_for_testing( | 47 void set_dns_probe_status_snoop_callback_for_testing( |
48 const DnsProbeStatusSnoopCallback& dns_probe_status_snoop_callback) { | 48 const DnsProbeStatusSnoopCallback& dns_probe_status_snoop_callback) { |
49 dns_probe_status_snoop_callback_ = dns_probe_status_snoop_callback; | 49 dns_probe_status_snoop_callback_ = dns_probe_status_snoop_callback; |
50 } | 50 } |
51 | 51 |
52 // content::WebContentsObserver implementation. | 52 // content::WebContentsObserver implementation. |
53 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; | 53 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; |
54 | 54 void DidStartNavigation( |
55 void DidStartNavigationToPendingEntry( | 55 content::NavigationHandle* navigation_handle) override; |
56 const GURL& url, | 56 void DidFinishNavigation( |
57 content::ReloadType reload_type) override; | 57 content::NavigationHandle* navigation_handle) override; |
58 | |
59 void DidStartProvisionalLoadForFrame( | |
60 content::RenderFrameHost* render_frame_host, | |
61 const GURL& validated_url, | |
62 bool is_error_page, | |
63 bool is_iframe_srcdoc) override; | |
64 | |
65 void DidCommitProvisionalLoadForFrame( | |
66 content::RenderFrameHost* render_frame_host, | |
67 const GURL& url, | |
68 ui::PageTransition transition_type) override; | |
69 | |
70 void DidFailProvisionalLoad(content::RenderFrameHost* render_frame_host, | |
71 const GURL& validated_url, | |
72 int error_code, | |
73 const base::string16& error_description, | |
74 bool was_ignored_by_handler) override; | |
75 | |
76 bool OnMessageReceived(const IPC::Message& message, | 58 bool OnMessageReceived(const IPC::Message& message, |
77 content::RenderFrameHost* render_frame_host) override; | 59 content::RenderFrameHost* render_frame_host) override; |
78 | 60 |
79 | 61 |
80 protected: | 62 protected: |
81 // |contents| is the WebContents of the tab this NetErrorTabHelper is | 63 // |contents| is the WebContents of the tab this NetErrorTabHelper is |
82 // attached to. | 64 // attached to. |
83 explicit NetErrorTabHelper(content::WebContents* contents); | 65 explicit NetErrorTabHelper(content::WebContents* contents); |
84 virtual void StartDnsProbe(); | 66 virtual void StartDnsProbe(); |
85 virtual void SendInfo(); | 67 virtual void SendInfo(); |
(...skipping 13 matching lines...) Expand all Loading... |
99 | 81 |
100 // Sanitizes |url| and shows a dialog for it. | 82 // Sanitizes |url| and shows a dialog for it. |
101 void RunNetworkDiagnostics(const GURL& url); | 83 void RunNetworkDiagnostics(const GURL& url); |
102 | 84 |
103 // Shows the diagnostics dialog after its been sanitized, virtual for | 85 // Shows the diagnostics dialog after its been sanitized, virtual for |
104 // testing. | 86 // testing. |
105 virtual void RunNetworkDiagnosticsHelper(const std::string& sanitized_url); | 87 virtual void RunNetworkDiagnosticsHelper(const std::string& sanitized_url); |
106 | 88 |
107 // Relates to offline pages handling. | 89 // Relates to offline pages handling. |
108 #if BUILDFLAG(ANDROID_JAVA_UI) | 90 #if BUILDFLAG(ANDROID_JAVA_UI) |
109 void UpdateHasOfflinePages(content::RenderFrameHost* render_frame_host); | 91 void UpdateHasOfflinePages(int frame_tree_node_id); |
110 void SetHasOfflinePages(int frame_tree_node_id, bool has_offline_pages); | 92 void SetHasOfflinePages(int frame_tree_node_id, bool has_offline_pages); |
111 void ShowOfflinePages(); | 93 void ShowOfflinePages(); |
112 bool IsFromErrorPage() const; | 94 bool IsFromErrorPage() const; |
113 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 95 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
114 | 96 |
115 // True if the last provisional load that started was for an error page. | 97 // True if the last provisional load that started was for an error page. |
116 bool is_error_page_; | 98 bool is_error_page_; |
117 | 99 |
118 // True if the helper has seen a main frame page load fail with a DNS error, | 100 // True if the helper has seen a main frame page load fail with a DNS error, |
119 // but has not yet seen a new page commit successfully afterwards. | 101 // but has not yet seen a new page commit successfully afterwards. |
(...skipping 16 matching lines...) Expand all Loading... |
136 BooleanPrefMember resolve_errors_with_web_service_; | 118 BooleanPrefMember resolve_errors_with_web_service_; |
137 | 119 |
138 base::WeakPtrFactory<NetErrorTabHelper> weak_factory_; | 120 base::WeakPtrFactory<NetErrorTabHelper> weak_factory_; |
139 | 121 |
140 DISALLOW_COPY_AND_ASSIGN(NetErrorTabHelper); | 122 DISALLOW_COPY_AND_ASSIGN(NetErrorTabHelper); |
141 }; | 123 }; |
142 | 124 |
143 } // namespace chrome_browser_net | 125 } // namespace chrome_browser_net |
144 | 126 |
145 #endif // CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ | 127 #endif // CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ |
OLD | NEW |