OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_LOADER_OFFLINE_POLICY | |
6 #define CONTENT_BROWSER_LOADER_OFFLINE_POLICY | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/basictypes.h" | |
11 #include "content/common/content_export.h" | |
12 #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
| |
13 | |
14 struct ResourceHostMsg_Request; | |
15 | |
16 namespace net { | |
17 class HttpResponseInfo; | |
18 class URLRequest; | |
19 } | |
20 | |
21 namespace content { | |
22 | |
23 // This class controls under what conditions resources will be fetched | |
24 // from cache even if stale rather than from the network. For example, | |
25 // one policy would be that if requests for a particular route (e.g. "tab") | |
26 // is unable to reach the server, other requests made with the same route | |
27 // can be loaded from cache without first requiring a network timeout. | |
28 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
| |
29 public: | |
30 OfflinePolicy(); | |
31 ~OfflinePolicy(); | |
32 | |
33 // Return any additional load flags to be ORed for the current request. | |
34 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
| |
35 ResourceType::Type resource_type); | |
36 | |
37 // Incorporate online/offline information from a completed request. | |
38 void RequestCompleted(int child_id, int route_id, | |
39 const net::HttpResponseInfo& response_info); | |
40 | |
41 void RouteRemoved(int child_id, int route_id); | |
42 | |
43 private: | |
44 enum RouteOfflineState { ROUTE_INIT, ROUTE_ONLINE, ROUTE_OFFLINE }; | |
45 | |
46 // child_id, route_id -> state. | |
47 typedef std::map<std::pair<int, int>, RouteOfflineState> RouteMap; | |
48 | |
49 RouteMap offline_state_map_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(OfflinePolicy); | |
52 }; | |
53 | |
54 } // namespace content | |
55 | |
56 #endif // CONTENT_BROWSER_LOADER_OFFLINE_POLICY | |
OLD | NEW |