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

Side by Side Diff: content/browser/download/save_package.cc

Issue 1899803002: Offline Pages: Use 'binary encoding' to create MHTML, instead of base64. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/download/save_package.h" 5 #include "content/browser/download/save_package.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // Confirm above didn't delete the tab out from under us. 334 // Confirm above didn't delete the tab out from under us.
335 if (!download_created_callback.is_null()) 335 if (!download_created_callback.is_null())
336 download_created_callback.Run(download_); 336 download_created_callback.Run(download_);
337 337
338 // Check save type and process the save page job. 338 // Check save type and process the save page job.
339 if (save_type_ == SAVE_PAGE_TYPE_AS_COMPLETE_HTML) { 339 if (save_type_ == SAVE_PAGE_TYPE_AS_COMPLETE_HTML) {
340 // Get directory 340 // Get directory
341 DCHECK(!saved_main_directory_path_.empty()); 341 DCHECK(!saved_main_directory_path_.empty());
342 GetSavableResourceLinks(); 342 GetSavableResourceLinks();
343 } else if (save_type_ == SAVE_PAGE_TYPE_AS_MHTML) { 343 } else if (save_type_ == SAVE_PAGE_TYPE_AS_MHTML) {
344 web_contents()->GenerateMHTML(saved_main_file_path_, base::Bind( 344 web_contents()->GenerateMHTML(
345 &SavePackage::OnMHTMLGenerated, this)); 345 saved_main_file_path_, /* use_binary_encoding = */ false,
346 base::Bind(&SavePackage::OnMHTMLGenerated, this));
346 } else { 347 } else {
347 DCHECK_EQ(SAVE_PAGE_TYPE_AS_ONLY_HTML, save_type_); 348 DCHECK_EQ(SAVE_PAGE_TYPE_AS_ONLY_HTML, save_type_);
348 wait_state_ = NET_FILES; 349 wait_state_ = NET_FILES;
349 SaveFileCreateInfo::SaveFileSource save_source = page_url_.SchemeIsFile() ? 350 SaveFileCreateInfo::SaveFileSource save_source = page_url_.SchemeIsFile() ?
350 SaveFileCreateInfo::SAVE_FILE_FROM_FILE : 351 SaveFileCreateInfo::SAVE_FILE_FROM_FILE :
351 SaveFileCreateInfo::SAVE_FILE_FROM_NET; 352 SaveFileCreateInfo::SAVE_FILE_FROM_NET;
352 // Add this item to waiting list. 353 // Add this item to waiting list.
353 waiting_item_queue_.push_back( 354 waiting_item_queue_.push_back(
354 new SaveItem(page_url_, Referrer(), this, save_source, 355 new SaveItem(page_url_, Referrer(), this, save_source,
355 FrameTreeNode::kFrameTreeNodeInvalidId)); 356 FrameTreeNode::kFrameTreeNodeInvalidId));
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 } 1497 }
1497 1498
1498 void SavePackage::FinalizeDownloadEntry() { 1499 void SavePackage::FinalizeDownloadEntry() {
1499 DCHECK(download_); 1500 DCHECK(download_);
1500 1501
1501 download_manager_->OnSavePackageSuccessfullyFinished(download_); 1502 download_manager_->OnSavePackageSuccessfullyFinished(download_);
1502 StopObservation(); 1503 StopObservation();
1503 } 1504 }
1504 1505
1505 } // namespace content 1506 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698