| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/android/offline_pages/recent_tab_helper.h" | 5 #include "chrome/browser/android/offline_pages/recent_tab_helper.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 DCHECK_EQ(snapshot_url_, web_contents()->GetLastCommittedURL()); | 238 DCHECK_EQ(snapshot_url_, web_contents()->GetLastCommittedURL()); |
| 239 if (result != OfflinePageModel::DeletePageResult::SUCCESS) { | 239 if (result != OfflinePageModel::DeletePageResult::SUCCESS) { |
| 240 ReportSnapshotCompleted(); | 240 ReportSnapshotCompleted(); |
| 241 return; | 241 return; |
| 242 } | 242 } |
| 243 | 243 |
| 244 OfflinePageModel::SavePageParams save_page_params; | 244 OfflinePageModel::SavePageParams save_page_params; |
| 245 save_page_params.url = snapshot_url_; | 245 save_page_params.url = snapshot_url_; |
| 246 save_page_params.client_id = snapshot_info_->client_id; | 246 save_page_params.client_id = snapshot_info_->client_id; |
| 247 save_page_params.proposed_offline_id = snapshot_info_->request_id; | 247 save_page_params.proposed_offline_id = snapshot_info_->request_id; |
| 248 save_page_params.is_background = false; |
| 248 page_model_->SavePage(save_page_params, | 249 page_model_->SavePage(save_page_params, |
| 249 delegate_->CreatePageArchiver(web_contents()), | 250 delegate_->CreatePageArchiver(web_contents()), |
| 250 base::Bind(&RecentTabHelper::SavePageCallback, | 251 base::Bind(&RecentTabHelper::SavePageCallback, |
| 251 weak_ptr_factory_.GetWeakPtr())); | 252 weak_ptr_factory_.GetWeakPtr())); |
| 252 } | 253 } |
| 253 | 254 |
| 254 void RecentTabHelper::SavePageCallback(OfflinePageModel::SavePageResult result, | 255 void RecentTabHelper::SavePageCallback(OfflinePageModel::SavePageResult result, |
| 255 int64_t offline_id) { | 256 int64_t offline_id) { |
| 256 DCHECK(snapshot_info_); | 257 DCHECK(snapshot_info_); |
| 257 snapshot_info_->page_snapshot_completed = (result == SavePageResult::SUCCESS); | 258 snapshot_info_->page_snapshot_completed = (result == SavePageResult::SUCCESS); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 282 else | 283 else |
| 283 request_coordinator->EnableForOffliner(snapshot_info_->request_id, | 284 request_coordinator->EnableForOffliner(snapshot_info_->request_id, |
| 284 snapshot_info_->client_id); | 285 snapshot_info_->client_id); |
| 285 } | 286 } |
| 286 | 287 |
| 287 ClientId RecentTabHelper::GetRecentPagesClientId() const { | 288 ClientId RecentTabHelper::GetRecentPagesClientId() const { |
| 288 return ClientId(kLastNNamespace, tab_id_); | 289 return ClientId(kLastNNamespace, tab_id_); |
| 289 } | 290 } |
| 290 | 291 |
| 291 } // namespace offline_pages | 292 } // namespace offline_pages |
| OLD | NEW |