OLD | NEW |
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_CORE_OFFLINE_PAGE_CLIENT_POLICY_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_CLIENT_POLICY_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_CLIENT_POLICY_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_CLIENT_POLICY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // The struct describing feature set of the offline pages. | 48 // The struct describing feature set of the offline pages. |
49 struct FeaturePolicy { | 49 struct FeaturePolicy { |
50 // Whether pages are shown in download ui. | 50 // Whether pages are shown in download ui. |
51 bool is_supported_by_download; | 51 bool is_supported_by_download; |
52 // Whether pages are shown in recent tabs ui. | 52 // Whether pages are shown in recent tabs ui. |
53 bool is_supported_by_recent_tabs; | 53 bool is_supported_by_recent_tabs; |
54 // Whether pages should only be viewed in the tab they were generated in. | 54 // Whether pages should only be viewed in the tab they were generated in. |
55 bool only_shown_in_original_tab; | 55 bool only_shown_in_original_tab; |
56 // Whether pages are removed on user-initiated cache reset. Defaults to true. | 56 // Whether pages are removed on user-initiated cache reset. Defaults to true. |
57 bool is_removed_on_cache_reset; | 57 bool is_removed_on_cache_reset; |
| 58 // Whether the namespace should be disabled if prefetching-related preferences |
| 59 // are disabled. |
| 60 bool disabled_when_prefetch_disabled; |
58 | 61 |
59 FeaturePolicy() | 62 FeaturePolicy() |
60 : is_supported_by_download(false), | 63 : is_supported_by_download(false), |
61 is_supported_by_recent_tabs(false), | 64 is_supported_by_recent_tabs(false), |
62 only_shown_in_original_tab(false), | 65 only_shown_in_original_tab(false), |
63 is_removed_on_cache_reset(true) {} | 66 is_removed_on_cache_reset(true), |
| 67 disabled_when_prefetch_disabled(false) {} |
64 }; | 68 }; |
65 | 69 |
66 // The struct describing policies for various namespaces (Bookmark, Last-N etc.) | 70 // The struct describing policies for various namespaces (Bookmark, Last-N etc.) |
67 // used by offline page model. The name_space is supposed to be key, so that | 71 // used by offline page model. The name_space is supposed to be key, so that |
68 // it's sufficient to compare name_space only when doing comparisons. | 72 // it's sufficient to compare name_space only when doing comparisons. |
69 struct OfflinePageClientPolicy { | 73 struct OfflinePageClientPolicy { |
70 // Namespace to which the policy applied. | 74 // Namespace to which the policy applied. |
71 std::string name_space; | 75 std::string name_space; |
72 | 76 |
73 // Policy to control the lifetime of a page generated by this namespace. | 77 // Policy to control the lifetime of a page generated by this namespace. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return *this; | 141 return *this; |
138 } | 142 } |
139 | 143 |
140 OfflinePageClientPolicyBuilder& SetIsOnlyShownInOriginalTab( | 144 OfflinePageClientPolicyBuilder& SetIsOnlyShownInOriginalTab( |
141 const bool only_shown_in_original_tab) { | 145 const bool only_shown_in_original_tab) { |
142 policy_.feature_policy.only_shown_in_original_tab = | 146 policy_.feature_policy.only_shown_in_original_tab = |
143 only_shown_in_original_tab; | 147 only_shown_in_original_tab; |
144 return *this; | 148 return *this; |
145 } | 149 } |
146 | 150 |
| 151 OfflinePageClientPolicyBuilder& SetIsDisabledWhenPrefetchDisabled( |
| 152 const bool disabled_when_prefetch_disabled) { |
| 153 policy_.feature_policy.disabled_when_prefetch_disabled = |
| 154 disabled_when_prefetch_disabled; |
| 155 return *this; |
| 156 } |
| 157 |
147 private: | 158 private: |
148 OfflinePageClientPolicy policy_; | 159 OfflinePageClientPolicy policy_; |
149 | 160 |
150 DISALLOW_COPY_AND_ASSIGN(OfflinePageClientPolicyBuilder); | 161 DISALLOW_COPY_AND_ASSIGN(OfflinePageClientPolicyBuilder); |
151 }; | 162 }; |
152 | 163 |
153 } // namespace offline_pages | 164 } // namespace offline_pages |
154 | 165 |
155 #endif // COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_CLIENT_POLICY_H_ | 166 #endif // COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_CLIENT_POLICY_H_ |
OLD | NEW |