Chromium Code Reviews| 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/offline_page_model_impl.h" | 5 #include "components/offline_pages/offline_page_model_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 | 168 |
| 169 void OfflinePageModelImpl::SavePage( | 169 void OfflinePageModelImpl::SavePage( |
| 170 const GURL& url, | 170 const GURL& url, |
| 171 const ClientId& client_id, | 171 const ClientId& client_id, |
| 172 std::unique_ptr<OfflinePageArchiver> archiver, | 172 std::unique_ptr<OfflinePageArchiver> archiver, |
| 173 const SavePageCallback& callback) { | 173 const SavePageCallback& callback) { |
| 174 DCHECK(is_loaded_); | 174 DCHECK(is_loaded_); |
| 175 | 175 |
| 176 // Skip saving the page that is not intended to be saved, like local file | 176 // Skip saving the page that is not intended to be saved, like local file |
| 177 // page. | 177 // page. |
| 178 if (url.is_valid() && !CanSavePage(url)) { | 178 if (url.is_valid() && !url.SchemeIsHTTPOrHTTPS()) { |
|
dewittj
2016/06/01 16:05:04
Why not CanSavePage?
dougarnett
2016/06/01 16:18:25
Good question here about where CanSaveURL() should
dougarnett
2016/06/01 19:27:09
Justin and I chatted about this offline wondering
fgorski
2016/06/01 20:21:03
url.is_valid() was added recently, by jianli. We t
dougarnett
2016/06/01 22:40:22
Ok put CanSave method back on the Model with url.i
| |
| 179 InformSavePageDone(callback, SavePageResult::SKIPPED, client_id, | 179 InformSavePageDone(callback, SavePageResult::SKIPPED, client_id, |
| 180 kInvalidOfflineId); | 180 kInvalidOfflineId); |
| 181 return; | 181 return; |
| 182 } | 182 } |
| 183 | 183 |
| 184 // The web contents is not available if archiver is not created and passed. | 184 // The web contents is not available if archiver is not created and passed. |
| 185 if (!archiver.get()) { | 185 if (!archiver.get()) { |
| 186 InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE, client_id, | 186 InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE, client_id, |
| 187 kInvalidOfflineId); | 187 kInvalidOfflineId); |
| 188 return; | 188 return; |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 904 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { | 904 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { |
| 905 if (!is_loaded_) { | 905 if (!is_loaded_) { |
| 906 delayed_tasks_.push_back(task); | 906 delayed_tasks_.push_back(task); |
| 907 return; | 907 return; |
| 908 } | 908 } |
| 909 | 909 |
| 910 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 910 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 911 } | 911 } |
| 912 | 912 |
| 913 } // namespace offline_pages | 913 } // namespace offline_pages |
| OLD | NEW |