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" | 15 #include "chrome/common/features.h" |
16 #include "components/error_page/common/net_error_info.h" | 16 #include "components/error_page/common/net_error_info.h" |
17 #include "components/prefs/pref_member.h" | 17 #include "components/prefs/pref_member.h" |
| 18 #include "content/public/browser/reload_type.h" |
18 #include "content/public/browser/web_contents_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
19 #include "content/public/browser/web_contents_user_data.h" | 20 #include "content/public/browser/web_contents_user_data.h" |
20 | 21 |
21 namespace chrome_browser_net { | 22 namespace chrome_browser_net { |
22 | 23 |
23 // A TabHelper that monitors loads for certain types of network errors and | 24 // A TabHelper that monitors loads for certain types of network errors and |
24 // does interesting things with them. Currently, starts DNS probes using the | 25 // does interesting things with them. Currently, starts DNS probes using the |
25 // DnsProbeService whenever a page fails to load with a DNS-related error. | 26 // DnsProbeService whenever a page fails to load with a DNS-related error. |
26 class NetErrorTabHelper | 27 class NetErrorTabHelper |
27 : public content::WebContentsObserver, | 28 : public content::WebContentsObserver, |
(...skipping 18 matching lines...) Expand all Loading... |
46 void set_dns_probe_status_snoop_callback_for_testing( | 47 void set_dns_probe_status_snoop_callback_for_testing( |
47 const DnsProbeStatusSnoopCallback& dns_probe_status_snoop_callback) { | 48 const DnsProbeStatusSnoopCallback& dns_probe_status_snoop_callback) { |
48 dns_probe_status_snoop_callback_ = dns_probe_status_snoop_callback; | 49 dns_probe_status_snoop_callback_ = dns_probe_status_snoop_callback; |
49 } | 50 } |
50 | 51 |
51 // content::WebContentsObserver implementation. | 52 // content::WebContentsObserver implementation. |
52 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; | 53 void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; |
53 | 54 |
54 void DidStartNavigationToPendingEntry( | 55 void DidStartNavigationToPendingEntry( |
55 const GURL& url, | 56 const GURL& url, |
56 content::NavigationController::ReloadType reload_type) override; | 57 content::ReloadType reload_type) override; |
57 | 58 |
58 void DidStartProvisionalLoadForFrame( | 59 void DidStartProvisionalLoadForFrame( |
59 content::RenderFrameHost* render_frame_host, | 60 content::RenderFrameHost* render_frame_host, |
60 const GURL& validated_url, | 61 const GURL& validated_url, |
61 bool is_error_page, | 62 bool is_error_page, |
62 bool is_iframe_srcdoc) override; | 63 bool is_iframe_srcdoc) override; |
63 | 64 |
64 void DidCommitProvisionalLoadForFrame( | 65 void DidCommitProvisionalLoadForFrame( |
65 content::RenderFrameHost* render_frame_host, | 66 content::RenderFrameHost* render_frame_host, |
66 const GURL& url, | 67 const GURL& url, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |