Chromium Code Reviews| 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 // 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.
| |
| 6 // from cache even if stale rather than from the network. For example, | |
| 7 // one policy would be that if requests for a particular route (e.g. "tab") | |
| 8 // is unable to reach the server, other requests made with the same route | |
| 9 // can be loaded from cache without first requiring a network timeout. | |
| 10 | |
| 11 #ifndef CONTENT_BROWSER_LOADER_OFFLINE_POLICY | |
| 12 #define CONTENT_BROWSER_LOADER_OFFLINE_POLICY | |
| 13 | |
| 14 #include <map> | |
| 15 | |
| 16 #include "base/basictypes.h" | |
| 17 #include "webkit/glue/resource_type.h" | |
| 18 | |
| 19 struct ResourceHostMsg_Request; | |
| 20 | |
| 21 namespace net { | |
| 22 class HttpResponseInfo; | |
| 23 class URLRequest; | |
| 24 } | |
| 25 | |
| 26 namespace content { | |
| 27 | |
| 28 class OfflinePolicy { | |
| 29 public: | |
| 30 OfflinePolicy(); | |
| 31 ~OfflinePolicy(); | |
| 32 | |
| 33 // 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
| |
| 34 int GetAdditionalLoadFlags(int child_id, int route_id, int current_flags, | |
| 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 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.
| |
| 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 |