| 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 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 base::TimeDelta::FromDays(1), 10))); | 33 base::TimeDelta::FromDays(1), 10))); |
| 34 } | 34 } |
| 35 | 35 |
| 36 ClientPolicyController::~ClientPolicyController() {} | 36 ClientPolicyController::~ClientPolicyController() {} |
| 37 | 37 |
| 38 // static | 38 // static |
| 39 const OfflinePageClientPolicy ClientPolicyController::MakePolicy( | 39 const OfflinePageClientPolicy ClientPolicyController::MakePolicy( |
| 40 const std::string& name_space, | 40 const std::string& name_space, |
| 41 LifetimeType lifetime_type, | 41 LifetimeType lifetime_type, |
| 42 const base::TimeDelta& expire_period, | 42 const base::TimeDelta& expire_period, |
| 43 int page_limit) { | 43 size_t page_limit) { |
| 44 OfflinePageClientPolicy policy( | 44 OfflinePageClientPolicy policy( |
| 45 {name_space, {lifetime_type, expire_period, page_limit}}); | 45 {name_space, {lifetime_type, expire_period, page_limit}}); |
| 46 return policy; | 46 return policy; |
| 47 } | 47 } |
| 48 | 48 |
| 49 const OfflinePageClientPolicy& ClientPolicyController::GetPolicy( | 49 const OfflinePageClientPolicy& ClientPolicyController::GetPolicy( |
| 50 const std::string& name_space) const { | 50 const std::string& name_space) const { |
| 51 const auto& iter = policies_.find(name_space); | 51 const auto& iter = policies_.find(name_space); |
| 52 if (iter != policies_.end()) | 52 if (iter != policies_.end()) |
| 53 return iter->second; | 53 return iter->second; |
| 54 // Fallback when the namespace isn't defined. | 54 // Fallback when the namespace isn't defined. |
| 55 return policies_.at(kDefaultNamespace); | 55 return policies_.at(kDefaultNamespace); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace offline_pages | 58 } // namespace offline_pages |
| OLD | NEW |