| 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 #include "components/offline_pages/core/client_policy_controller.h" | 5 #include "components/offline_pages/core/client_policy_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 .SetIsRemovedOnCacheReset(false) | 47 .SetIsRemovedOnCacheReset(false) |
| 48 .SetIsSupportedByDownload(true) | 48 .SetIsSupportedByDownload(true) |
| 49 .Build())); | 49 .Build())); |
| 50 policies_.insert(std::make_pair( | 50 policies_.insert(std::make_pair( |
| 51 kNTPSuggestionsNamespace, | 51 kNTPSuggestionsNamespace, |
| 52 OfflinePageClientPolicyBuilder(kNTPSuggestionsNamespace, | 52 OfflinePageClientPolicyBuilder(kNTPSuggestionsNamespace, |
| 53 LifetimeType::PERSISTENT, kUnlimitedPages, | 53 LifetimeType::PERSISTENT, kUnlimitedPages, |
| 54 kUnlimitedPages) | 54 kUnlimitedPages) |
| 55 .SetIsSupportedByDownload(true) | 55 .SetIsSupportedByDownload(true) |
| 56 .Build())); | 56 .Build())); |
| 57 policies_.insert(std::make_pair( |
| 58 kSuggestedArticlesNamespace, |
| 59 OfflinePageClientPolicyBuilder(kSuggestedArticlesNamespace, |
| 60 LifetimeType::TEMPORARY, kUnlimitedPages, |
| 61 kUnlimitedPages) |
| 62 .SetIsRemovedOnCacheReset(true) |
| 63 .SetExpirePeriod(base::TimeDelta::FromDays(30)) |
| 64 .Build())); |
| 57 | 65 |
| 58 // Fallback policy. | 66 // Fallback policy. |
| 59 policies_.insert(std::make_pair( | 67 policies_.insert(std::make_pair( |
| 60 kDefaultNamespace, MakePolicy(kDefaultNamespace, LifetimeType::TEMPORARY, | 68 kDefaultNamespace, MakePolicy(kDefaultNamespace, LifetimeType::TEMPORARY, |
| 61 base::TimeDelta::FromDays(1), 10, 1))); | 69 base::TimeDelta::FromDays(1), 10, 1))); |
| 62 } | 70 } |
| 63 | 71 |
| 64 ClientPolicyController::~ClientPolicyController() {} | 72 ClientPolicyController::~ClientPolicyController() {} |
| 65 | 73 |
| 66 // static | 74 // static |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 return *show_in_original_tab_cache_; | 162 return *show_in_original_tab_cache_; |
| 155 } | 163 } |
| 156 | 164 |
| 157 void ClientPolicyController::AddPolicyForTest( | 165 void ClientPolicyController::AddPolicyForTest( |
| 158 const std::string& name_space, | 166 const std::string& name_space, |
| 159 const OfflinePageClientPolicyBuilder& builder) { | 167 const OfflinePageClientPolicyBuilder& builder) { |
| 160 policies_.insert(std::make_pair(name_space, builder.Build())); | 168 policies_.insert(std::make_pair(name_space, builder.Build())); |
| 161 } | 169 } |
| 162 | 170 |
| 163 } // namespace offline_pages | 171 } // namespace offline_pages |
| OLD | NEW |