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

Side by Side Diff: components/offline_pages/core/offline_page_model_impl.cc

Issue 2656713002: Merge to M57: Remove popup overlay from MHTML when requested (Closed)
Patch Set: Created 3 years, 11 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/core/offline_page_model_impl.h" 5 #include "components/offline_pages/core/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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE, 354 InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE,
355 save_page_params.client_id, kInvalidOfflineId); 355 save_page_params.client_id, kInvalidOfflineId);
356 return; 356 return;
357 } 357 }
358 358
359 // If we already have an offline id, use it. If not, generate one. 359 // If we already have an offline id, use it. If not, generate one.
360 int64_t offline_id = save_page_params.proposed_offline_id; 360 int64_t offline_id = save_page_params.proposed_offline_id;
361 if (offline_id == kInvalidOfflineId) 361 if (offline_id == kInvalidOfflineId)
362 offline_id = GenerateOfflineId(); 362 offline_id = GenerateOfflineId();
363 363
364 OfflinePageArchiver::CreateArchiveParams create_archive_params;
365 // If the page is being saved in the background, we should try to remove the
366 // popup overlay that obstructs viewing the normal content.
367 create_archive_params.remove_popup_overlay = save_page_params.is_background;
364 archiver->CreateArchive( 368 archiver->CreateArchive(
365 archives_dir_, offline_id, 369 archives_dir_, create_archive_params,
366 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone, 370 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone,
367 weak_ptr_factory_.GetWeakPtr(), save_page_params, offline_id, 371 weak_ptr_factory_.GetWeakPtr(), save_page_params, offline_id,
368 GetCurrentTime(), callback)); 372 GetCurrentTime(), callback));
369 pending_archivers_.push_back(std::move(archiver)); 373 pending_archivers_.push_back(std::move(archiver));
370 } 374 }
371 375
372 void OfflinePageModelImpl::MarkPageAccessed(int64_t offline_id) { 376 void OfflinePageModelImpl::MarkPageAccessed(int64_t offline_id) {
373 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::MarkPageAccessedWhenLoadDone, 377 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::MarkPageAccessedWhenLoadDone,
374 weak_ptr_factory_.GetWeakPtr(), offline_id)); 378 weak_ptr_factory_.GetWeakPtr(), offline_id));
375 } 379 }
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 } 1092 }
1089 1093
1090 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); 1094 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task);
1091 } 1095 }
1092 1096
1093 base::Time OfflinePageModelImpl::GetCurrentTime() const { 1097 base::Time OfflinePageModelImpl::GetCurrentTime() const {
1094 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); 1098 return testing_clock_ ? testing_clock_->Now() : base::Time::Now();
1095 } 1099 }
1096 1100
1097 } // namespace offline_pages 1101 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/core/offline_page_model.cc ('k') | components/offline_pages/core/offline_page_model_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698