Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 kUnlimitedPages))); | 26 kUnlimitedPages))); |
| 27 policies_.insert(std::make_pair( | 27 policies_.insert(std::make_pair( |
| 28 kAsyncNamespace, MakePolicy(kAsyncNamespace, LifetimeType::PERSISTENT, | 28 kAsyncNamespace, MakePolicy(kAsyncNamespace, LifetimeType::PERSISTENT, |
| 29 base::TimeDelta::FromDays(2), kUnlimitedPages, | 29 base::TimeDelta::FromDays(2), kUnlimitedPages, |
| 30 kUnlimitedPages))); | 30 kUnlimitedPages))); |
| 31 policies_.insert(std::make_pair( | 31 policies_.insert(std::make_pair( |
| 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( | |
| 37 kDownloadNamespace, MakePolicy(kDownloadNamespace, | |
| 38 LifetimeType::PERSISTENT, | |
| 39 base::TimeDelta::FromDays(2), | |
|
fgorski
2016/08/04 06:05:41
this value is/should be irrelevant for PERSISTENT
chili
2016/08/04 06:53:28
Done.
| |
| 40 kUnlimitedPages, | |
| 41 kUnlimitedPages))); | |
| 42 | |
| 36 // Fallback policy. | 43 // Fallback policy. |
| 37 policies_.insert(std::make_pair( | 44 policies_.insert(std::make_pair( |
| 38 kDefaultNamespace, MakePolicy(kDefaultNamespace, LifetimeType::TEMPORARY, | 45 kDefaultNamespace, MakePolicy(kDefaultNamespace, LifetimeType::TEMPORARY, |
| 39 base::TimeDelta::FromDays(1), 10, 1))); | 46 base::TimeDelta::FromDays(1), 10, 1))); |
| 40 } | 47 } |
| 41 | 48 |
| 42 ClientPolicyController::~ClientPolicyController() {} | 49 ClientPolicyController::~ClientPolicyController() {} |
| 43 | 50 |
| 44 // static | 51 // static |
| 45 const OfflinePageClientPolicy ClientPolicyController::MakePolicy( | 52 const OfflinePageClientPolicy ClientPolicyController::MakePolicy( |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 57 const OfflinePageClientPolicy& ClientPolicyController::GetPolicy( | 64 const OfflinePageClientPolicy& ClientPolicyController::GetPolicy( |
| 58 const std::string& name_space) const { | 65 const std::string& name_space) const { |
| 59 const auto& iter = policies_.find(name_space); | 66 const auto& iter = policies_.find(name_space); |
| 60 if (iter != policies_.end()) | 67 if (iter != policies_.end()) |
| 61 return iter->second; | 68 return iter->second; |
| 62 // Fallback when the namespace isn't defined. | 69 // Fallback when the namespace isn't defined. |
| 63 return policies_.at(kDefaultNamespace); | 70 return policies_.at(kDefaultNamespace); |
| 64 } | 71 } |
| 65 | 72 |
| 66 } // namespace offline_pages | 73 } // namespace offline_pages |
| OLD | NEW |