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

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: Sync'd to r193064. 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
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 #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.
darin (slow to review) 2013/04/11 20:01:23 nit: "for the current request" ... since the param
Randy Smith (Not in Mondays) 2013/04/12 14:06:44 Done.
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);
darin (slow to review) 2013/04/11 20:01:23 nit: how about method name that better describes t
Randy Smith (Not in Mondays) 2013/04/12 14:06:44 Done.
42
43 private:
44 enum OfflineState { INIT, ONLINE, OFFLINE };
darin (slow to review) 2013/04/11 20:01:23 nit: since this class is named OfflinePolicy, you
Randy Smith (Not in Mondays) 2013/04/12 14:06:44 Done.
45
46 OfflineState offline_state_;
darin (slow to review) 2013/04/11 20:01:23 ditto: could just be named "state_"
Randy Smith (Not in Mondays) 2013/04/12 14:06:44 Done.
47
48 DISALLOW_COPY_AND_ASSIGN(OfflinePolicy);
49 };
50
51 } // namespace content
52
53 #endif // CONTENT_BROWSER_LOADER_OFFLINE_POLICY
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698