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

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: Fixes Created 6 years, 10 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..27b7af48a870b9f38792416f12a525feb5fc541c 100644
--- a/chrome/renderer/net/net_error_helper_core.h
+++ b/chrome/renderer/net/net_error_helper_core.h
@@ -7,8 +7,10 @@
#include <string>
+#include "base/callback.h"
#include "base/memory/weak_ptr.h"
#include "chrome/common/net/net_error_info.h"
+#include "chrome/renderer/net/mockable_one_shot_timer.h"
#include "url/gurl.h"
namespace blink {
@@ -58,6 +60,12 @@ class NetErrorHelperCore {
// Cancels an error page fetch. Does nothing if no fetch is ongoing.
virtual void CancelFetchErrorPage() = 0;
+ // Starts a reload of the page in the observed frame.
+ virtual void ReloadPage() = 0;
+
+ // Allocates a new MockableOneShotTimer.
+ virtual MockableOneShotTimer* NewMockableOneShotTimer() = 0;
+
protected:
virtual ~Delegate() {}
};
@@ -92,10 +100,20 @@ class NetErrorHelperCore {
// has been received.
void OnNetErrorInfo(chrome_common_net::DnsProbeStatus status);
+ // Notifies |this| that the network's online status changed.
+ void NetworkStateChanged(bool online);
+
void set_alt_error_page_url(const GURL& alt_error_page_url) {
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 StartAutoReloadTimer();
+ virtual bool IsAutoReloading() const;
mmenke 2014/02/05 23:31:43 Neither of these needs to be virtual.
mmenke 2014/02/05 23:31:43 Suggest calling this IsAutoReloadingForTesting().
Elly Fong-Jones 2014/02/10 21:42:06 Done.
Elly Fong-Jones 2014/02/10 21:42:06 Done.
+
private:
struct ErrorPageInfo;
@@ -126,6 +144,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_;
mmenke 2014/02/05 23:31:43 Think this needs a comment - it's not the number o
Elly Fong-Jones 2014/02/10 21:42:06 Done.
+
+ void AutoReload();
mmenke 2014/02/05 23:31:43 Methods should be declared before member variables
mmenke 2014/02/05 23:31:43 Suggest calling this "Reload" instead, since it do
Elly Fong-Jones 2014/02/10 21:42:06 Done.
Elly Fong-Jones 2014/02/10 21:42:06 Done.
};
#endif // CHROME_RENDERER_NET_NET_ERROR_HELPER_CORE_H_

Powered by Google App Engine
This is Rietveld 408576698