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

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

Issue 2100043004: [Offline pages] Filter out pages cached by different tabs on tab helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating comment to address CR Created 4 years, 5 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
« no previous file with comments | « chrome/browser/android/offline_pages/recent_tab_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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"
11 11
12 using LifetimeType = offline_pages::LifetimePolicy::LifetimeType; 12 using LifetimeType = offline_pages::LifetimePolicy::LifetimeType;
13 13
14 namespace offline_pages { 14 namespace offline_pages {
15 15
16 ClientPolicyController::ClientPolicyController() { 16 ClientPolicyController::ClientPolicyController() {
17 policies_.clear(); 17 policies_.clear();
18 // Manually defining client policies for bookmark and last_n. 18 // Manually defining client policies for bookmark and last_n.
19 policies_.insert(std::make_pair( 19 policies_.insert(std::make_pair(
20 kBookmarkNamespace, 20 kBookmarkNamespace,
21 MakePolicy(kBookmarkNamespace, LifetimeType::TEMPORARY, 21 MakePolicy(kBookmarkNamespace, LifetimeType::TEMPORARY,
22 base::TimeDelta::FromDays(7), kUnlimitedPages, 1))); 22 base::TimeDelta::FromDays(7), kUnlimitedPages, 1)));
23 policies_.insert(std::make_pair( 23 policies_.insert(std::make_pair(
24 kLastNNamespace, 24 kLastNNamespace, MakePolicy(kLastNNamespace, LifetimeType::TEMPORARY,
25 MakePolicy(kLastNNamespace, LifetimeType::TEMPORARY, 25 base::TimeDelta::FromDays(2), kUnlimitedPages,
26 base::TimeDelta::FromDays(2), kUnlimitedPages, 1))); 26 kUnlimitedPages)));
27 // Fallback policy. 27 // Fallback policy.
28 policies_.insert(std::make_pair( 28 policies_.insert(std::make_pair(
29 kDefaultNamespace, MakePolicy(kDefaultNamespace, LifetimeType::TEMPORARY, 29 kDefaultNamespace, MakePolicy(kDefaultNamespace, LifetimeType::TEMPORARY,
30 base::TimeDelta::FromDays(1), 10, 1))); 30 base::TimeDelta::FromDays(1), 10, 1)));
31 } 31 }
32 32
33 ClientPolicyController::~ClientPolicyController() {} 33 ClientPolicyController::~ClientPolicyController() {}
34 34
35 // static 35 // static
36 const OfflinePageClientPolicy ClientPolicyController::MakePolicy( 36 const OfflinePageClientPolicy ClientPolicyController::MakePolicy(
(...skipping 11 matching lines...) Expand all
48 const OfflinePageClientPolicy& ClientPolicyController::GetPolicy( 48 const OfflinePageClientPolicy& ClientPolicyController::GetPolicy(
49 const std::string& name_space) const { 49 const std::string& name_space) const {
50 const auto& iter = policies_.find(name_space); 50 const auto& iter = policies_.find(name_space);
51 if (iter != policies_.end()) 51 if (iter != policies_.end())
52 return iter->second; 52 return iter->second;
53 // Fallback when the namespace isn't defined. 53 // Fallback when the namespace isn't defined.
54 return policies_.at(kDefaultNamespace); 54 return policies_.at(kDefaultNamespace);
55 } 55 }
56 56
57 } // namespace offline_pages 57 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/recent_tab_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698