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" |
| 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 // |
| 29 // There is a single OfflinePolicy object per user navigation unit |
| 30 // (generally a tab). |
| 31 class CONTENT_EXPORT OfflinePolicy { |
| 32 public: |
| 33 OfflinePolicy(); |
| 34 ~OfflinePolicy(); |
| 35 |
| 36 // Return any additional load flags to be ORed for the current request. |
| 37 int GetAdditionalLoadFlags( |
| 38 int current_flags, ResourceType::Type resource_type); |
| 39 |
| 40 // Incorporate online/offline information from a completed request. |
| 41 void RequestCompleted(const net::HttpResponseInfo& response_info); |
| 42 |
| 43 private: |
| 44 enum OfflineState { INIT, ONLINE, OFFLINE }; |
| 45 |
| 46 OfflineState offline_state_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(OfflinePolicy); |
| 49 }; |
| 50 |
| 51 } // namespace content |
| 52 |
| 53 #endif // CONTENT_BROWSER_LOADER_OFFLINE_POLICY |
OLD | NEW |