Chromium Code Reviews| Index: chrome/browser/net/net_error_tab_helper.h |
| diff --git a/chrome/browser/net/net_error_tab_helper.h b/chrome/browser/net/net_error_tab_helper.h |
| index e48fa9fe80835ba087600d8dcc00e9975b9998f5..a390b34628eed652169697e552ecd71899a67b7c 100644 |
| --- a/chrome/browser/net/net_error_tab_helper.h |
| +++ b/chrome/browser/net/net_error_tab_helper.h |
| @@ -6,12 +6,12 @@ |
| #define CHROME_BROWSER_NET_NET_ERROR_TAB_HELPER_H_ |
| #include "base/basictypes.h" |
| +#include "base/bind.h" |
| #include "base/compiler_specific.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/prefs/pref_member.h" |
| #include "chrome/browser/net/dns_probe_service.h" |
| #include "chrome/common/net/net_error_info.h" |
| -#include "chrome/common/net/net_error_tracker.h" |
| #include "content/public/browser/web_contents_observer.h" |
| #include "content/public/browser/web_contents_user_data.h" |
| @@ -30,10 +30,19 @@ class NetErrorTabHelper |
| TESTING_FORCE_ENABLED |
| }; |
| + typedef base::Callback<void(chrome_common_net::DnsProbeStatus)> |
| + NetErrorInfoSnoopCallback; |
|
mmenke
2013/06/24 16:20:00
Since this takes a DnsProbeStatus rather than a Ne
Deprecated (see juliatuttle)
2013/06/25 16:45:04
There is no such type as a NetErrorInfo; I'll rena
mmenke
2013/06/25 17:40:26
There is actually a "ChromeViewMsg_NetErrorInfo",
|
| + |
| virtual ~NetErrorTabHelper(); |
| static void set_state_for_testing(TestingState testing_state); |
| + // Sets a callback that will be called immediately after the helper sends |
| + // a NetErrorHelper IPC. (Used by the DNS probe browser test to know when to |
| + // check the error page for updates, instead of polling.) |
| + void set_net_error_info_snoop_callback_for_testing( |
| + const NetErrorInfoSnoopCallback& net_error_snoop_callback); |
|
mmenke
2013/06/24 16:20:00
Per Google style guide, functions that use this na
Deprecated (see juliatuttle)
2013/06/25 16:45:04
Done.
|
| + |
| // content::WebContentsObserver implementation. |
| virtual void DidStartProvisionalLoadForFrame( |
| int64 frame_id, |
| @@ -59,43 +68,42 @@ class NetErrorTabHelper |
| const string16& error_description, |
| content::RenderViewHost* render_view_host) OVERRIDE; |
| - virtual void DidFinishLoad( |
| - int64 frame_id, |
| - const GURL& validated_url, |
| - bool is_main_frame, |
| - content::RenderViewHost* render_view_host) OVERRIDE; |
| - |
| - private: |
| - friend class content::WebContentsUserData<NetErrorTabHelper>; |
| - |
| - enum DnsProbeState { |
| - DNS_PROBE_NONE, |
| - DNS_PROBE_STARTED, |
| - DNS_PROBE_FINISHED |
| - }; |
| - |
| + protected: |
| // |contents| is the WebContents of the tab this NetErrorTabHelper is |
| // attached to. |
| explicit NetErrorTabHelper(content::WebContents* contents); |
| + virtual void StartDnsProbe(); |
| + virtual void SendInfo(); |
| + void OnDnsProbeFinished(chrome_common_net::DnsProbeStatus result); |
| - void TrackerCallback(NetErrorTracker::DnsErrorPageState state); |
| - void MaybePostStartDnsProbeTask(); |
| - void OnDnsProbeFinished(chrome_common_net::DnsProbeResult result); |
| - void MaybeSendInfo(); |
| + // The status of a DNS probe that may or may not have started or finished. |
| + // Since the renderer can change out from under the helper (in cross-process |
| + // navigations), it re-sends the status whenever an error page commits. |
| + chrome_common_net::DnsProbeStatus dns_probe_status_; |
| + |
| + private: |
| + friend class content::WebContentsUserData<NetErrorTabHelper>; |
| + |
| + void OnMainFrameDnsError(); |
| void InitializePref(content::WebContents* contents); |
| bool ProbesAllowed() const; |
| base::WeakPtrFactory<NetErrorTabHelper> weak_factory_; |
| - NetErrorTracker tracker_; |
| - NetErrorTracker::DnsErrorPageState dns_error_page_state_; |
| + // True if the last provisional load that started was for an error page. |
| + bool is_error_page_; |
| - DnsProbeState dns_probe_state_; |
| - chrome_common_net::DnsProbeResult dns_probe_result_; |
| + // True if the helper has seen a main frame page load fail with a DNS error, |
| + // but has not yet seen a new page load successfully afterwards. |
| + bool dns_error_active_; |
| // Whether we are enabled to run by the DnsProbe-Enable field trial. |
| const bool enabled_by_trial_; |
| + |
| + // Optional callback for browser test to snoop on outgoing NetErrorInfo IPCs. |
| + NetErrorInfoSnoopCallback net_error_info_snoop_callback_; |
| + |
| // "Use a web service to resolve navigation errors" preference is required |
| // to allow probes. |
| BooleanPrefMember resolve_errors_with_web_service_; |