Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: components/offline_pages/core/client_policy_controller.cc

Issue 2811813002: [Offline Pages] Set up the initial prefetching service. (Closed)
Patch Set: Implement invalidating a single ContentSuggestion. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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)
carlosk 2017/04/18 00:36:09 Shouldn't the limit of pages per URL be 1?
dewittj 2017/04/18 18:20:25 I don't think we should enforce this here. I thin
carlosk 2017/04/18 20:17:22 OK. We can change this later on should we decide t
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698