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..1b2ca3cfeef95229cfe80114fd22b79bd1a38a5f |
--- /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. |
+// |
+// This class controls under what conditions resources will be fetched |
rvargas (doing something else)
2013/04/03 21:48:19
nit: move the comment to just before the class.
Randy Smith (Not in Mondays)
2013/04/04 19:42:49
Done.
|
+// 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. |
+ |
+#ifndef CONTENT_BROWSER_LOADER_OFFLINE_POLICY |
+#define CONTENT_BROWSER_LOADER_OFFLINE_POLICY |
+ |
+#include <map> |
+ |
+#include "base/basictypes.h" |
+#include "webkit/glue/resource_type.h" |
+ |
+struct ResourceHostMsg_Request; |
+ |
+namespace net { |
+class HttpResponseInfo; |
+class URLRequest; |
+} |
+ |
+namespace content { |
+ |
+class OfflinePolicy { |
+ public: |
+ OfflinePolicy(); |
+ ~OfflinePolicy(); |
+ |
+ // Return any additional load flags to be |'d for the current request. |
rvargas (doing something else)
2013/04/03 21:48:19
nit: ORed ? OR'd ? added?. By the way, flags shoul
Randy Smith (Not in Mondays)
2013/04/04 19:42:49
Done.
rvargas (doing something else)
2013/04/04 20:13:12
Yeah, that's what I meant... we are using int ever
|
+ int GetAdditionalLoadFlags(int child_id, int route_id, int current_flags, |
+ 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: |
+ typedef enum { ROUTE_INIT, ROUTE_ONLINE, ROUTE_OFFLINE } RouteOfflineState; |
rvargas (doing something else)
2013/04/03 21:48:19
nit: enum RouteOfflineState {}
Randy Smith (Not in Mondays)
2013/04/04 19:42:49
Done.
|
+ |
+ // 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 |