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

Unified Diff: content/browser/loader/offline_policy.h

Issue 12886022: Implement offline mode behind a flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated Ricardo's comments. Created 7 years, 9 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: content/browser/loader/offline_policy.h
diff --git a/content/browser/loader/offline_policy.h b/content/browser/loader/offline_policy.h
new file mode 100644
index 0000000000000000000000000000000000000000..746a7f32bf009d271bee36fe107874faee21be1e
--- /dev/null
+++ b/content/browser/loader/offline_policy.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_LOADER_OFFLINE_POLICY
+#define CONTENT_BROWSER_LOADER_OFFLINE_POLICY
+
+#include <map>
+
+#include "base/basictypes.h"
+#include "content/common/content_export.h"
+#include "webkit/glue/resource_type.h"
droger_google 2013/04/05 10:55:24 This file should probably moved out of webkit/glue
Randy Smith (Not in Mondays) 2013/04/05 17:56:38 Darin, what's your perspective on this? I feel li
+
+struct ResourceHostMsg_Request;
+
+namespace net {
+class HttpResponseInfo;
+class URLRequest;
+}
+
+namespace content {
+
+// This class controls under what conditions resources will be fetched
+// from cache even if stale rather than from the network. For example,
+// one policy would be that if requests for a particular route (e.g. "tab")
+// is unable to reach the server, other requests made with the same route
+// can be loaded from cache without first requiring a network timeout.
+class CONTENT_EXPORT OfflinePolicy {
droger_google 2013/04/05 10:55:24 OfflinePolicy is in content/. This may not be a bl
Randy Smith (Not in Mondays) 2013/04/05 17:56:38 Wow, that's a stranger and more alien world than I
blundell 2013/04/08 16:52:04 We're currently determining (with darin and jam) w
+ public:
+ OfflinePolicy();
+ ~OfflinePolicy();
+
+ // Return any additional load flags to be ORed for the current request.
+ int GetAdditionalLoadFlags(int child_id, int route_id, int current_flags,
droger_google 2013/04/05 10:55:24 I have two issues with this API: 1) On iOS, we do
Randy Smith (Not in Mondays) 2013/04/05 17:56:38 My thought about using a single class was that it
+ ResourceType::Type resource_type);
+
+ // Incorporate online/offline information from a completed request.
+ void RequestCompleted(int child_id, int route_id,
+ const net::HttpResponseInfo& response_info);
+
+ void RouteRemoved(int child_id, int route_id);
+
+private:
+ enum RouteOfflineState { ROUTE_INIT, ROUTE_ONLINE, ROUTE_OFFLINE };
+
+ // child_id, route_id -> state.
+ typedef std::map<std::pair<int, int>, RouteOfflineState> RouteMap;
+
+ RouteMap offline_state_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(OfflinePolicy);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_LOADER_OFFLINE_POLICY

Powered by Google App Engine
This is Rietveld 408576698