Chromium Code Reviews| Index: chrome/renderer/net/net_error_helper.h |
| diff --git a/chrome/renderer/net/net_error_helper.h b/chrome/renderer/net/net_error_helper.h |
| index cb33387e1e19cb9baee021c56909020cf0fc53d3..d359774e178a69f6877af7562ea6b426c90ddd5d 100644 |
| --- a/chrome/renderer/net/net_error_helper.h |
| +++ b/chrome/renderer/net/net_error_helper.h |
| @@ -5,14 +5,23 @@ |
| #ifndef CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
| #define CHROME_RENDERER_NET_NET_ERROR_HELPER_H_ |
| +#include <string> |
| + |
| #include "chrome/common/net/net_error_info.h" |
| -#include "chrome/common/net/net_error_tracker.h" |
| #include "content/public/renderer/render_view_observer.h" |
| +#include "third_party/WebKit/public/platform/WebURLError.h" |
| + |
| +namespace base { |
| +class DictionaryValue; |
| +} |
| namespace WebKit { |
| class WebFrame; |
| } |
| +// Listens for NetErrorInfo messages from the NetErrorTabHelper on the |
| +// browser side and updates the error page with more details (currently, just |
| +// DNS probe results) if/when available. |
| class NetErrorHelper : public content::RenderViewObserver { |
| public: |
| explicit NetErrorHelper(content::RenderView* render_view); |
| @@ -31,14 +40,45 @@ class NetErrorHelper : public content::RenderViewObserver { |
| // IPC::Listener implementation. |
| virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| + static bool GetErrorStringsForDnsProbe( |
| + WebKit::WebFrame* frame, |
| + const WebKit::WebURLError& error, |
| + bool is_failed_post, |
| + const std::string& locale, |
| + base::DictionaryValue* error_strings); |
| + |
| + protected: |
| + // These methods handle tracking the actual state of the page; this allows |
| + // unit-testing of the state tracking without having to mock out WebFrames |
| + // and such. |
| + void OnStartLoad(bool is_main_frame, bool is_error_page); |
| + void OnFailLoad(bool is_main_frame, bool is_dns_error); |
| + void OnCommitLoad(bool is_main_frame); |
| + void OnFinishLoad(bool is_main_frame); |
| + |
| + void OnNetErrorInfo(int status); |
| + virtual void UpdateErrorPage(); |
| + |
| + // The last DnsProbeStatus received from the browser. |
| + chrome_common_net::DnsProbeStatus last_status_; |
|
mmenke
2013/06/13 20:04:55
nit: Suggest renaming this last_probe_status_, to
Deprecated (see juliatuttle)
2013/06/18 19:36:37
Done.
|
| + |
| private: |
| - void OnNetErrorInfo(int dns_probe_result); |
| - void TrackerCallback(NetErrorTracker::DnsErrorPageState state); |
| - void UpdateErrorPage(chrome_common_net::DnsProbeResult dns_probe_result); |
| + WebKit::WebURLError GetUpdatedError() const; |
| + |
| + // True if the last provisional load started was an error page. |
| + bool is_error_page_; |
| + |
| + // 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_; |
| + |
| + // True if the helper has seen the page finish loading, but has not yet seen |
| + // a new provisional load commit. |
| + bool page_loaded_; |
| + |
| + // The last main frame error seen by the helper. |
| + WebKit::WebURLError last_error_; |
| - NetErrorTracker tracker_; |
| - NetErrorTracker::DnsErrorPageState dns_error_page_state_; |
| - bool updated_error_page_; |
| bool is_failed_post_; |
| }; |