Chromium Code Reviews| Index: content/browser/loader/offline_policy.h |
| diff --git a/content/browser/loader/offline_policy.h b/content/browser/loader/offline_policy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..20643a4747c45399f47064438d0cd978e8a32c27 |
| --- /dev/null |
| +++ b/content/browser/loader/offline_policy.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_LOADER_OFFLINE_POLICY |
| +#define CONTENT_BROWSER_LOADER_OFFLINE_POLICY |
| + |
| +#include <map> |
| + |
| +#include "base/basictypes.h" |
| +#include "content/common/content_export.h" |
| +#include "webkit/glue/resource_type.h" |
| + |
| +struct ResourceHostMsg_Request; |
| + |
| +namespace net { |
| +class HttpResponseInfo; |
| +class URLRequest; |
| +} |
| + |
| +namespace content { |
| + |
| +// This class controls under what conditions resources will be fetched |
| +// from cache even if stale rather than from the network. For example, |
| +// one policy would be that if requests for a particular route (e.g. "tab") |
| +// is unable to reach the server, other requests made with the same route |
| +// can be loaded from cache without first requiring a network timeout. |
| +// |
| +// There is a single OfflinePolicy object per user navigation unit |
| +// (generally a tab). |
| +class CONTENT_EXPORT OfflinePolicy { |
| + public: |
| + OfflinePolicy(); |
| + ~OfflinePolicy(); |
| + |
| + // 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.
|
| + int GetAdditionalLoadFlags( |
| + int current_flags, ResourceType::Type resource_type); |
| + |
| + // Incorporate online/offline information from a completed request. |
| + 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.
|
| + |
| +private: |
| + 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.
|
| + |
| + 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.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(OfflinePolicy); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_LOADER_OFFLINE_POLICY |