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

Side by Side Diff: chrome/browser/android/offline_pages/recent_tab_helper.cc

Issue 2683493002: Get signals working in the EXTRA_DATA section of MHTML (Closed)
Patch Set: Approach for writing to the file afterwards instead. Created 3 years, 9 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 (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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 save_page_params.proposed_offline_id = snapshot_info->request_id; 393 save_page_params.proposed_offline_id = snapshot_info->request_id;
394 save_page_params.is_background = false; 394 save_page_params.is_background = false;
395 page_model_->SavePage( 395 page_model_->SavePage(
396 save_page_params, delegate_->CreatePageArchiver(web_contents()), 396 save_page_params, delegate_->CreatePageArchiver(web_contents()),
397 base::Bind(&RecentTabHelper::SavePageCallback, 397 base::Bind(&RecentTabHelper::SavePageCallback,
398 weak_ptr_factory_.GetWeakPtr(), snapshot_info)); 398 weak_ptr_factory_.GetWeakPtr(), snapshot_info));
399 } 399 }
400 400
401 void RecentTabHelper::SavePageCallback(SnapshotProgressInfo* snapshot_info, 401 void RecentTabHelper::SavePageCallback(SnapshotProgressInfo* snapshot_info,
402 OfflinePageModel::SavePageResult result, 402 OfflinePageModel::SavePageResult result,
403 int64_t offline_id) { 403 int64_t offline_id,
404 const base::FilePath& saved_filepath) {
404 DCHECK(snapshot_info->IsForLastN() || 405 DCHECK(snapshot_info->IsForLastN() ||
405 snapshot_info->request_id == offline_id); 406 snapshot_info->request_id == offline_id);
406 ReportSnapshotCompleted(snapshot_info, result == SavePageResult::SUCCESS); 407 ReportSnapshotCompleted(snapshot_info, result == SavePageResult::SUCCESS);
407 } 408 }
408 409
409 // Note: this is the final step in the chain of callbacks and it's where the 410 // Note: this is the final step in the chain of callbacks and it's where the
410 // behavior is different depending on this being a last_n or downloads snapshot. 411 // behavior is different depending on this being a last_n or downloads snapshot.
411 void RecentTabHelper::ReportSnapshotCompleted( 412 void RecentTabHelper::ReportSnapshotCompleted(
412 SnapshotProgressInfo* snapshot_info, 413 SnapshotProgressInfo* snapshot_info,
413 bool success) { 414 bool success) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 } 464 }
464 465
465 void RecentTabHelper::CancelInFlightSnapshots() { 466 void RecentTabHelper::CancelInFlightSnapshots() {
466 weak_ptr_factory_.InvalidateWeakPtrs(); 467 weak_ptr_factory_.InvalidateWeakPtrs();
467 downloads_ongoing_snapshot_info_.reset(); 468 downloads_ongoing_snapshot_info_.reset();
468 downloads_latest_saved_snapshot_info_.reset(); 469 downloads_latest_saved_snapshot_info_.reset();
469 last_n_ongoing_snapshot_info_.reset(); 470 last_n_ongoing_snapshot_info_.reset();
470 } 471 }
471 472
472 } // namespace offline_pages 473 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698