Chromium Code Reviews| Index: components/offline_pages/offline_page_client_policy.h |
| diff --git a/components/offline_pages/offline_page_client_policy.h b/components/offline_pages/offline_page_client_policy.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e2751d49e501148dc05230cc78a17e40ac732c64 |
| --- /dev/null |
| +++ b/components/offline_pages/offline_page_client_policy.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_ |
| +#define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <string> |
| + |
| +#include "base/time/time.h" |
| + |
| +namespace offline_pages { |
| + |
| +// The struct describing the lifetime policy of offlined pages. |
|
fgorski
2016/04/30 17:42:26
nit: offline pages
no "-d"
applies below
romax
2016/05/02 20:33:45
Done.
|
| +// Page Policies: |
|
fgorski
2016/04/30 17:42:25
The following behaviors are controlled by policy
romax
2016/05/02 20:33:45
Done.
|
| +// a. Automatically offlined or user-initiated. |
|
fgorski
2016/04/30 17:42:26
Persistency (lifetime) of the offline page.
romax
2016/05/02 20:33:45
Done.
|
| +// b. Expiration time of an offlined page |
| +// c. Limit of number of pages offlined. |
| +struct LifetimePolicy { |
| + public: |
|
fgorski
2016/04/30 17:42:26
nit: not needed for structs.
romax
2016/05/02 20:33:44
Done.
|
| + // Type of the client, indicating where the archived page would be saved. |
|
fgorski
2016/04/30 17:42:25
and whether it could be kept indefinitely.
romax
2016/05/02 20:33:45
Done.
|
| + enum class LifetimeType { |
| + TEMPORARY, |
| + PERSISTENT, |
| + }; |
| + |
| + // Type of the page generated by the client. |
| + LifetimeType type; |
|
fgorski
2016/04/30 17:42:26
lifetime_type would be a better name
romax
2016/05/02 20:33:44
Done.
|
| + |
| + // The time before the page expires. |
| + base::TimeDelta expire_period; |
|
fgorski
2016/04/30 17:42:26
expiration period.
I am wondering if storing that
romax
2016/05/02 20:33:44
Acknowledged.
|
| + |
| + // The maximum number of pages allowd generated by this client. |
|
fgorski
2016/04/30 17:42:26
allowed to be saved by
dougarnett
2016/05/02 15:32:34
I'm not clear what "this client" means here - is i
romax
2016/05/02 20:33:45
Done.
|
| + // kPageUnlimited (0) means no limit set. |
|
fgorski
2016/04/30 17:42:26
kPageUnlimited should be defined in this file.
romax
2016/05/02 20:33:45
Done.
|
| + int64_t page_limit; |
|
fgorski
2016/04/30 17:42:25
int should be more than enough.
romax
2016/05/02 20:33:45
Done.
|
| +}; |
| + |
| +// The struct describing policies for various namespaces (Bookmark, Last-N etc.) |
| +// used by offline page model. The name_space is supposed to be key, so that |
| +// it's sufficient to compare name_space only when doing comparisons. |
| +struct OfflinePageClientPolicy { |
| + public: |
|
fgorski
2016/04/30 17:42:26
nit: not needed for structs.
romax
2016/05/02 20:33:45
Done.
|
| + // Namespace to which the policy applied. |
| + std::string name_space; |
| + |
| + // Policy to control the lifetime of a page generated by this namespace. |
| + LifetimePolicy lifetime_policy; |
| +}; |
| + |
| +} // namespace offline_pages |
| + |
| +#endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_ |