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

Side by Side Diff: components/offline_pages/offline_page_client_policy.h

Issue 2006923005: [Offline Pages] Two-step expiration in storage manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more comments, commit ready. Created 4 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_ 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 13
14 namespace offline_pages { 14 namespace offline_pages {
15 15
16 static const int kUnlimitedPages = 0; 16 static const size_t kUnlimitedPages = 0;
17 17
18 // The struct describing the lifetime policy of offline pages. 18 // The struct describing the lifetime policy of offline pages.
19 // The following behaviors are controlled by policy: 19 // The following behaviors are controlled by policy:
20 // a. Persistency of the offline page. 20 // a. Persistency of the offline page.
21 // b. Expiration time of an offline page 21 // b. Expiration time of an offline page
22 // c. Limit of number of pages offline. 22 // c. Limit of number of pages offline.
23 struct LifetimePolicy { 23 struct LifetimePolicy {
24 // Type of the client, indicating where the archived page would be saved 24 // Type of the client, indicating where the archived page would be saved
25 // and whether it could be kept indefinitely. 25 // and whether it could be kept indefinitely.
26 enum class LifetimeType { 26 enum class LifetimeType {
27 TEMPORARY, 27 TEMPORARY,
28 PERSISTENT, 28 PERSISTENT,
29 }; 29 };
30 30
31 // Type of the page generated by the client. 31 // Type of the page generated by the client.
32 LifetimeType lifetime_type; 32 LifetimeType lifetime_type;
33 33
34 // The time after which the page expires. 34 // The time after which the page expires.
35 base::TimeDelta expiration_period; 35 base::TimeDelta expiration_period;
36 36
37 // The maximum number of pages allowed to be saved by the namespace. 37 // The maximum number of pages allowed to be saved by the namespace.
38 // kUnlimitedPages (defined above) means no limit set. 38 // kUnlimitedPages (defined above) means no limit set.
39 int page_limit; 39 size_t page_limit;
40 }; 40 };
41 41
42 // The struct describing policies for various namespaces (Bookmark, Last-N etc.) 42 // The struct describing policies for various namespaces (Bookmark, Last-N etc.)
43 // used by offline page model. The name_space is supposed to be key, so that 43 // used by offline page model. The name_space is supposed to be key, so that
44 // it's sufficient to compare name_space only when doing comparisons. 44 // it's sufficient to compare name_space only when doing comparisons.
45 struct OfflinePageClientPolicy { 45 struct OfflinePageClientPolicy {
46 // Namespace to which the policy applied. 46 // Namespace to which the policy applied.
47 std::string name_space; 47 std::string name_space;
48 48
49 // Policy to control the lifetime of a page generated by this namespace. 49 // Policy to control the lifetime of a page generated by this namespace.
50 LifetimePolicy lifetime_policy; 50 LifetimePolicy lifetime_policy;
51 }; 51 };
52 52
53 } // namespace offline_pages 53 } // namespace offline_pages
54 54
55 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_ 55 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_
OLDNEW
« no previous file with comments | « components/offline_pages/client_policy_controller.cc ('k') | components/offline_pages/offline_page_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698