OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <string> |
| 11 |
| 12 #include "base/time/time.h" |
| 13 |
| 14 namespace offline_pages { |
| 15 |
| 16 static const int kUnlimitedPages = 0; |
| 17 |
| 18 // The struct describing the lifetime policy of offline pages. |
| 19 // The following behaviors are controlled by policy: |
| 20 // a. Persistency of the offline page. |
| 21 // b. Expiration time of an offline page |
| 22 // c. Limit of number of pages offline. |
| 23 struct LifetimePolicy { |
| 24 // Type of the client, indicating where the archived page would be saved |
| 25 // and whether it could be kept indefinitely. |
| 26 enum class LifetimeType { |
| 27 TEMPORARY, |
| 28 PERSISTENT, |
| 29 }; |
| 30 |
| 31 // Type of the page generated by the client. |
| 32 LifetimeType lifetime_type; |
| 33 |
| 34 // The time after which the page expires. |
| 35 base::TimeDelta expiration_period; |
| 36 |
| 37 // The maximum number of pages allowed to be saved by the namespace. |
| 38 // kUnlimitedPages (defined above) means no limit set. |
| 39 int page_limit; |
| 40 }; |
| 41 |
| 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 |
| 44 // it's sufficient to compare name_space only when doing comparisons. |
| 45 struct OfflinePageClientPolicy { |
| 46 // Namespace to which the policy applied. |
| 47 std::string name_space; |
| 48 |
| 49 // Policy to control the lifetime of a page generated by this namespace. |
| 50 LifetimePolicy lifetime_policy; |
| 51 }; |
| 52 |
| 53 } // namespace offline_pages |
| 54 |
| 55 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_CLIENT_POLICY_H_ |
OLD | NEW |