Index: content/browser/loader/offline_manager.h |
diff --git a/content/browser/loader/offline_manager.h b/content/browser/loader/offline_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..951e589f7996dbc7016e28bbb3d3ff4ac631030c |
--- /dev/null |
+++ b/content/browser/loader/offline_manager.h |
@@ -0,0 +1,54 @@ |
+// 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 manages the switch between offline and online for resource |
darin (slow to review)
2013/03/27 18:33:59
I think it'd be helpful to describe the goal of th
Randy Smith (Not in Mondays)
2013/04/03 19:20:34
Hmmm. I had considered that in the realm of polic
|
+// loading. |
+ |
+#ifndef CONTENT_BROWSER_LOADER_OFFLINE_MANAGER |
+#define CONTENT_BROWSER_LOADER_OFFLINE_MANAGER |
+ |
+#include <map> |
+ |
+#include "base/basictypes.h" |
+ |
+struct ResourceHostMsg_Request; |
+ |
+namespace net { |
+class HttpResponseInfo; |
+class URLRequest; |
+} |
+ |
+namespace content { |
+ |
+class OfflineManager { |
darin (slow to review)
2013/03/27 18:33:59
nit: manager is such a generic term. I wonder if
Randy Smith (Not in Mondays)
2013/04/03 19:20:34
Done.
|
+ public: |
+ OfflineManager(); |
+ ~OfflineManager(); |
+ |
+ // Return any additional load flags to be |'d for the current request. |
+ int OfflineLoadFlags(int child_id, int route_id, |
darin (slow to review)
2013/03/27 18:33:59
nit: maybe call this GetAdditionalLoadFlags? What
Randy Smith (Not in Mondays)
2013/04/03 19:20:34
Done.
|
+ const ResourceHostMsg_Request& request_data); |
+ |
+ // Incorporate online/offline information from a completed request. |
+ // Note that the response info must be available through |
+ // |request->response_info()|. |
+ void RequestCompleted(int child_id, int route_id, |
+ const net::URLRequest* request); |
+ |
+ void RouteDeleted(int child_id, int route_id); |
darin (slow to review)
2013/03/27 18:33:59
should there be an explicit RouteAdded? RouteDele
Randy Smith (Not in Mondays)
2013/04/03 19:20:34
Sorry to reflect this back, but I'd be inclined to
|
+ |
+private: |
+ typedef enum { ROUTE_INIT, ROUTE_ONLINE, ROUTE_OFFLINE } RouteOfflineState; |
+ |
+ // child_id, route_id -> state. |
+ typedef std::map<std::pair<int, int>, RouteOfflineState> RouteMap; |
+ |
+ RouteMap offline_state_map_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(OfflineManager); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_LOADER_OFFLINE_MANAGER |