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

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

Issue 136203009: Support auto-reload on errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 11 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_core.h
diff --git a/chrome/renderer/net/net_error_helper_core.h b/chrome/renderer/net/net_error_helper_core.h
index cfbc8a154e2089a31da691f09567f5f2d23b2630..aa1ae9b45eb7d6d7452d94864e4f3a9d7446efff 100644
--- a/chrome/renderer/net/net_error_helper_core.h
+++ b/chrome/renderer/net/net_error_helper_core.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "chrome/common/net/net_error_info.h"
#include "url/gurl.h"
@@ -31,6 +32,15 @@ class NetErrorHelperCore {
ERROR_PAGE,
};
+ class MockableOneShotTimer {
+ public:
+ virtual void Start(const tracked_objects::Location& posted_from,
+ base::TimeDelta delay,
+ const base::Closure& user_task) = 0;
+ virtual void Stop() = 0;
+ virtual bool IsRunning() const = 0;
+ };
+
// The Delegate handles all interaction with the RenderView, WebFrame, and
// the network, as well as the generation of error pages.
class Delegate {
@@ -58,6 +68,15 @@ class NetErrorHelperCore {
// Cancels an error page fetch. Does nothing if no fetch is ongoing.
virtual void CancelFetchErrorPage() = 0;
+ // Starts a fetch of |url| for autoreload.
+ virtual void FetchAutoReloadPage(const GURL& url) = 0;
+
+ // Cancels an autoreload fetch.
+ virtual void CancelFetchAutoReloadPage() = 0;
+
+ // Allocates a new MockableOneShotTimer.
+ virtual MockableOneShotTimer* NewMockableOneShotTimer() = 0;
+
protected:
virtual ~Delegate() {}
};
@@ -96,6 +115,13 @@ class NetErrorHelperCore {
alt_error_page_url_ = alt_error_page_url;
}
+ void set_auto_reload_enabled(bool auto_reload_enabled) {
+ auto_reload_enabled_ = auto_reload_enabled;
+ }
+
+ virtual void StartAutoReload();
+ virtual bool IsAutoReloading() const;
+
private:
struct ErrorPageInfo;
@@ -126,6 +152,12 @@ class NetErrorHelperCore {
scoped_ptr<ErrorPageInfo> committed_error_page_info_;
GURL alt_error_page_url_;
+
+ bool auto_reload_enabled_;
+ scoped_ptr<MockableOneShotTimer> auto_reload_timer_;
+ int auto_reload_count_;
+
+ void AutoReload();
};
#endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_CORE_H_

Powered by Google App Engine
This is Rietveld 408576698