| 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/client_policy_controller.h" | 5 #include "components/offline_pages/client_policy_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "components/offline_pages/client_namespace_constants.h" | 10 #include "components/offline_pages/client_namespace_constants.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 kCCTNamespace, | 32 kCCTNamespace, |
| 33 MakePolicy(kCCTNamespace, LifetimeType::TEMPORARY, | 33 MakePolicy(kCCTNamespace, LifetimeType::TEMPORARY, |
| 34 base::TimeDelta::FromDays(2), kUnlimitedPages, 1))); | 34 base::TimeDelta::FromDays(2), kUnlimitedPages, 1))); |
| 35 | 35 |
| 36 policies_.insert(std::make_pair( | 36 policies_.insert(std::make_pair( |
| 37 kDownloadNamespace, MakePolicy(kDownloadNamespace, | 37 kDownloadNamespace, MakePolicy(kDownloadNamespace, |
| 38 LifetimeType::PERSISTENT, | 38 LifetimeType::PERSISTENT, |
| 39 base::TimeDelta::FromDays(0), | 39 base::TimeDelta::FromDays(0), |
| 40 kUnlimitedPages, | 40 kUnlimitedPages, |
| 41 kUnlimitedPages))); | 41 kUnlimitedPages))); |
| 42 policies_.insert(std::make_pair( |
| 43 kNTPSuggestionsNamespace, MakePolicy(kNTPSuggestionsNamespace, |
| 44 LifetimeType::PERSISTENT, |
| 45 base::TimeDelta::FromDays(0), |
| 46 kUnlimitedPages, |
| 47 kUnlimitedPages))); |
| 42 | 48 |
| 43 // Fallback policy. | 49 // Fallback policy. |
| 44 policies_.insert(std::make_pair( | 50 policies_.insert(std::make_pair( |
| 45 kDefaultNamespace, MakePolicy(kDefaultNamespace, LifetimeType::TEMPORARY, | 51 kDefaultNamespace, MakePolicy(kDefaultNamespace, LifetimeType::TEMPORARY, |
| 46 base::TimeDelta::FromDays(1), 10, 1))); | 52 base::TimeDelta::FromDays(1), 10, 1))); |
| 47 } | 53 } |
| 48 | 54 |
| 49 ClientPolicyController::~ClientPolicyController() {} | 55 ClientPolicyController::~ClientPolicyController() {} |
| 50 | 56 |
| 51 // static | 57 // static |
| (...skipping 12 matching lines...) Expand all Loading... |
| 64 const OfflinePageClientPolicy& ClientPolicyController::GetPolicy( | 70 const OfflinePageClientPolicy& ClientPolicyController::GetPolicy( |
| 65 const std::string& name_space) const { | 71 const std::string& name_space) const { |
| 66 const auto& iter = policies_.find(name_space); | 72 const auto& iter = policies_.find(name_space); |
| 67 if (iter != policies_.end()) | 73 if (iter != policies_.end()) |
| 68 return iter->second; | 74 return iter->second; |
| 69 // Fallback when the namespace isn't defined. | 75 // Fallback when the namespace isn't defined. |
| 70 return policies_.at(kDefaultNamespace); | 76 return policies_.at(kDefaultNamespace); |
| 71 } | 77 } |
| 72 | 78 |
| 73 } // namespace offline_pages | 79 } // namespace offline_pages |
| OLD | NEW |