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

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

Issue 19777002: Revert 211950 "Display DNS probe results." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1568/src/
Patch Set: Created 7 years, 5 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
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | chrome/renderer/net/net_error_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/net/net_error_helper.h
===================================================================
--- chrome/renderer/net/net_error_helper.h (revision 212348)
+++ chrome/renderer/net/net_error_helper.h (working copy)
@@ -5,23 +5,14 @@
#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);
@@ -40,61 +31,14 @@
// IPC::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
- // Examines |frame| and |error| to see if this is an error worthy of a DNS
- // probe. If it is, initializes |error_strings| based on |error|,
- // |is_failed_post|, and |locale| with suitable strings and returns true.
- // If not, returns false, in which case the caller should look up error
- // strings directly using LocalizedError::GetNavigationErrorStrings.
- 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);
-
- // |UpdateErrorPage| is virtual so it can be mocked out in the unittest.
- virtual void UpdateErrorPage();
-
- // The last DnsProbeStatus received from the browser.
- chrome_common_net::DnsProbeStatus last_probe_status_;
-
private:
- WebKit::WebURLError GetUpdatedError() const;
+ void OnNetErrorInfo(int dns_probe_result);
+ void TrackerCallback(NetErrorTracker::DnsErrorPageState state);
+ void UpdateErrorPage(chrome_common_net::DnsProbeResult dns_probe_result);
- // Whether the last provisional load started was for an error page.
- bool last_start_was_error_page_;
-
- // Whether the last provisional load failure failed with a DNS error.
- bool last_fail_was_dns_error_;
-
- // Ideally, this would be simply "last_commit_was_dns_error_page_".
- //
- // Unfortunately, that breaks if two DNS errors occur in a row; after the
- // second failure, but before the second page commits, the helper can receive
- // probe results. If all it knows is that the last commit was a DNS error
- // page, it will cheerfully forward the results for the second probe to the
- // first page.
- //
- // Thus, the semantics of this flag are a little weird. It is set whenever
- // a DNS error page commits, and cleared whenever any other page commits,
- // but it is also cleared whenever a DNS error occurs, to prevent the race
- // described above.
- bool forwarding_probe_results_;
-
- // 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_;
};
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | chrome/renderer/net/net_error_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698