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/background/request_coordinator.h" | 5 #include "components/offline_pages/background/request_coordinator.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 } | 187 } |
188 | 188 |
189 RequestCoordinator::~RequestCoordinator() {} | 189 RequestCoordinator::~RequestCoordinator() {} |
190 | 190 |
191 int64_t RequestCoordinator::SavePageLater(const GURL& url, | 191 int64_t RequestCoordinator::SavePageLater(const GURL& url, |
192 const ClientId& client_id, | 192 const ClientId& client_id, |
193 bool user_requested, | 193 bool user_requested, |
194 RequestAvailability availability) { | 194 RequestAvailability availability) { |
195 DVLOG(2) << "URL is " << url << " " << __func__; | 195 DVLOG(2) << "URL is " << url << " " << __func__; |
196 | 196 |
197 // Make sure this is called on actual instance (as the factory | |
198 // may not return one for incognito profile). | |
199 CHECK(this); | |
fgorski
2016/11/22 21:43:37
I don't think this is a good strategy. (It does no
dougarnett
2016/11/22 22:01:16
I found the Factory returning null was not suffici
| |
200 | |
197 if (!OfflinePageModel::CanSaveURL(url)) { | 201 if (!OfflinePageModel::CanSaveURL(url)) { |
198 DVLOG(1) << "Not able to save page for requested url: " << url; | 202 DVLOG(1) << "Not able to save page for requested url: " << url; |
199 return 0L; | 203 return 0L; |
200 } | 204 } |
201 | 205 |
202 int64_t id = GenerateOfflineId(); | 206 int64_t id = GenerateOfflineId(); |
203 | 207 |
204 // Build a SavePageRequest. | 208 // Build a SavePageRequest. |
205 offline_pages::SavePageRequest request(id, url, client_id, base::Time::Now(), | 209 offline_pages::SavePageRequest request(id, url, client_id, base::Time::Now(), |
206 user_requested); | 210 user_requested); |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
954 | 958 |
955 ClientPolicyController* RequestCoordinator::GetPolicyController() { | 959 ClientPolicyController* RequestCoordinator::GetPolicyController() { |
956 return policy_controller_.get(); | 960 return policy_controller_.get(); |
957 } | 961 } |
958 | 962 |
959 void RequestCoordinator::Shutdown() { | 963 void RequestCoordinator::Shutdown() { |
960 network_quality_estimator_ = nullptr; | 964 network_quality_estimator_ = nullptr; |
961 } | 965 } |
962 | 966 |
963 } // namespace offline_pages | 967 } // namespace offline_pages |
OLD | NEW |