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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 585653003: Fixed regression in "Save To Pdf" of Print Preview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/ui/webui/print_preview/print_preview_handler.h" 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 240 }
241 241
242 // Callback that stores a PDF file on disk. 242 // Callback that stores a PDF file on disk.
243 void PrintToPdfCallback(const scoped_refptr<base::RefCountedBytes>& data, 243 void PrintToPdfCallback(const scoped_refptr<base::RefCountedBytes>& data,
244 const base::FilePath& path, 244 const base::FilePath& path,
245 const base::Closure& pdf_file_saved_closure) { 245 const base::Closure& pdf_file_saved_closure) {
246 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 246 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
247 printing::PdfMetafileSkia metafile; 247 printing::PdfMetafileSkia metafile;
248 metafile.InitFromData(static_cast<const void*>(data->front()), data->size()); 248 metafile.InitFromData(static_cast<const void*>(data->front()), data->size());
249 base::File file(path, 249 base::File file(path,
250 base::File::FLAG_CREATE_ALWAYS || base::File::FLAG_WRITE); 250 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
251 metafile.SaveTo(&file); 251 metafile.SaveTo(&file);
252 if (!pdf_file_saved_closure.is_null()) 252 if (!pdf_file_saved_closure.is_null())
253 pdf_file_saved_closure.Run(); 253 pdf_file_saved_closure.Run();
254 } 254 }
255 255
256 std::string GetDefaultPrinterOnFileThread() { 256 std::string GetDefaultPrinterOnFileThread() {
257 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 257 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
258 258
259 scoped_refptr<printing::PrintBackend> print_backend( 259 scoped_refptr<printing::PrintBackend> print_backend(
260 printing::PrintBackend::CreateInstance(NULL)); 260 printing::PrintBackend::CreateInstance(NULL));
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 1595
1596 void PrintPreviewHandler::UnregisterForMergeSession() { 1596 void PrintPreviewHandler::UnregisterForMergeSession() {
1597 if (reconcilor_) 1597 if (reconcilor_)
1598 reconcilor_->RemoveMergeSessionObserver(this); 1598 reconcilor_->RemoveMergeSessionObserver(this);
1599 } 1599 }
1600 1600
1601 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1601 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1602 const base::Closure& closure) { 1602 const base::Closure& closure) {
1603 pdf_file_saved_closure_ = closure; 1603 pdf_file_saved_closure_ = closure;
1604 } 1604 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698