Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Side by Side Diff: content/browser/loader/offline_policy.h

Issue 12886022: Implement offline mode behind a flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Setup OfflinePolicy for all started requests. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/loader/global_routing_id.h ('k') | content/browser/loader/offline_policy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
13 struct ResourceHostMsg_Request;
14
15 namespace net {
16 class HttpResponseInfo;
17 class URLRequest;
18 }
19
20 namespace content {
21
22 // This class controls under what conditions resources will be fetched
23 // from cache even if stale rather than from the network. For example,
24 // one policy would be that if requests for a particular route (e.g. "tab")
25 // is unable to reach the server, other requests made with the same route
26 // can be loaded from cache without first requiring a network timeout.
27 //
28 // There is a single OfflinePolicy object per user navigation unit
29 // (generally a tab).
30 class CONTENT_EXPORT OfflinePolicy {
31 public:
32 OfflinePolicy();
33 ~OfflinePolicy();
34
35 // Return any additional load flags to be ORed for a request from
36 // this route with the given |resource_type|. |reset_state| indicates
37 // that this request should reinitialized the internal state for this
38 // policy object (e.g. in the case of a main frame load).
39 int GetAdditionalLoadFlags(int current_flags, bool reset_state);
40
41 // Incorporate online/offline information from a completed request.
42 void UpdateStateForCompletedRequest(
43 const net::HttpResponseInfo& response_info);
44
45 private:
46 enum State { INIT, ONLINE, OFFLINE };
47
48 bool enabled_;
49 State state_;
50
51 DISALLOW_COPY_AND_ASSIGN(OfflinePolicy);
52 };
53
54 } // namespace content
55
56 #endif // CONTENT_BROWSER_LOADER_OFFLINE_POLICY
OLDNEW
« no previous file with comments | « content/browser/loader/global_routing_id.h ('k') | content/browser/loader/offline_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698