Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7452)

Unified Diff: chrome/renderer/net/net_error_helper.h

Issue 13270005: Display DNS probe results. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Refactor a bit again (DnsProbeRunner is now tied to a single DnsClient), other fixes Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..b172b52eb5d53f42b30044a32ac2ae37416835f6 100644
--- a/chrome/renderer/net/net_error_helper.h
+++ b/chrome/renderer/net/net_error_helper.h
@@ -5,14 +5,24 @@
#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 "googleurl/src/gurl.h"
mmenke 2013/06/12 19:17:12 Don't think this is needed.
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+#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 +41,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
+ // us to unit-test the state tracking without having to mock out WebFrames
mmenke 2013/06/12 19:17:12 nit: Many reviewers don't like we/us in comments.
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+ // 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_;
+
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 start the helper saw was an error page.
mmenke 2013/06/12 19:17:12 nit: Suggest "True if the last started load was a
Deprecated (see juliatuttle) 2013/06/13 14:37:04 Done.
+ 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_;
};

Powered by Google App Engine
This is Rietveld 408576698