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

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

Issue 1968563003: [Offline pages] Extracting callbacks from the Offline Page Model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/offline_page_storage_manager.h" 5 #include "components/offline_pages/offline_page_storage_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "components/offline_pages/client_policy_controller.h" 8 #include "components/offline_pages/client_policy_controller.h"
9 #include "components/offline_pages/offline_page_client_policy.h" 9 #include "components/offline_pages/offline_page_client_policy.h"
10 #include "components/offline_pages/offline_page_item.h" 10 #include "components/offline_pages/offline_page_item.h"
11 #include "components/offline_pages/offline_page_model.h" 11 #include "components/offline_pages/offline_page_model.h"
12 12
13 using DeletePageResult = offline_pages::OfflinePageModel::DeletePageResult;
14 using MultipleOfflinePageItemResult =
15 offline_pages::OfflinePageModel::MultipleOfflinePageItemResult;
16
17 namespace offline_pages { 13 namespace offline_pages {
18 14
19 OfflinePageStorageManager::OfflinePageStorageManager(OfflinePageModel* model) 15 OfflinePageStorageManager::OfflinePageStorageManager(OfflinePageModel* model)
20 : model_(model), 16 : model_(model),
21 policy_controller_(model->GetPolicyController()), 17 policy_controller_(model->GetPolicyController()),
22 in_progress_(false), 18 in_progress_(false),
23 weak_ptr_factory_(this) {} 19 weak_ptr_factory_(this) {}
24 20
25 OfflinePageStorageManager::~OfflinePageStorageManager() { 21 OfflinePageStorageManager::~OfflinePageStorageManager() {
26 } 22 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 64 }
69 65
70 bool OfflinePageStorageManager::IsPageExpired(const OfflinePageItem& page) { 66 bool OfflinePageStorageManager::IsPageExpired(const OfflinePageItem& page) {
71 base::Time now = base::Time::Now(); 67 base::Time now = base::Time::Now();
72 const LifetimePolicy& policy = 68 const LifetimePolicy& policy =
73 policy_controller_->GetPolicy(page.client_id.name_space).lifetime_policy; 69 policy_controller_->GetPolicy(page.client_id.name_space).lifetime_policy;
74 return now - page.last_access_time > policy.expiration_period; 70 return now - page.last_access_time > policy.expiration_period;
75 } 71 }
76 72
77 } // namespace offline_pages 73 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698