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

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: Aliasing 4 result types in the model to reduce the change impact 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 #include "components/offline_pages/offline_page_types.h"
dewittj 2016/05/11 18:42:56 you could revert this file, if you like.
fgorski 2016/05/11 19:14:20 I did it on purpose to prevent another aliasing of
13 using DeletePageResult = offline_pages::OfflinePageModel::DeletePageResult;
14 using MultipleOfflinePageItemResult =
15 offline_pages::OfflinePageModel::MultipleOfflinePageItemResult;
16 13
17 namespace offline_pages { 14 namespace offline_pages {
18 15
19 OfflinePageStorageManager::OfflinePageStorageManager(OfflinePageModel* model) 16 OfflinePageStorageManager::OfflinePageStorageManager(OfflinePageModel* model)
20 : model_(model), 17 : model_(model),
21 policy_controller_(model->GetPolicyController()), 18 policy_controller_(model->GetPolicyController()),
22 in_progress_(false), 19 in_progress_(false),
23 weak_ptr_factory_(this) {} 20 weak_ptr_factory_(this) {}
24 21
25 OfflinePageStorageManager::~OfflinePageStorageManager() { 22 OfflinePageStorageManager::~OfflinePageStorageManager() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 65 }
69 66
70 bool OfflinePageStorageManager::IsPageExpired(const OfflinePageItem& page) { 67 bool OfflinePageStorageManager::IsPageExpired(const OfflinePageItem& page) {
71 base::Time now = base::Time::Now(); 68 base::Time now = base::Time::Now();
72 const LifetimePolicy& policy = 69 const LifetimePolicy& policy =
73 policy_controller_->GetPolicy(page.client_id.name_space).lifetime_policy; 70 policy_controller_->GetPolicy(page.client_id.name_space).lifetime_policy;
74 return now - page.last_access_time > policy.expiration_period; 71 return now - page.last_access_time > policy.expiration_period;
75 } 72 }
76 73
77 } // namespace offline_pages 74 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698