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

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

Issue 7038041: Print Preview: Check the result from GetPrintPreviewData() and return on failure. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 | Annotate | Revision Log
« 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_handler.h" 5 #include "chrome/browser/ui/webui/print_preview_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/i18n/file_util_icu.h" 9 #include "base/i18n/file_util_icu.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 preview_tab(), 441 preview_tab(),
442 platform_util::GetTopLevel(preview_tab()->GetNativeView()), 442 platform_util::GetTopLevel(preview_tab()->GetNativeView()),
443 NULL); 443 NULL);
444 } 444 }
445 445
446 void PrintPreviewHandler::FileSelected(const FilePath& path, 446 void PrintPreviewHandler::FileSelected(const FilePath& path,
447 int index, void* params) { 447 int index, void* params) {
448 PrintPreviewUIHTMLSource::PrintPreviewData data; 448 PrintPreviewUIHTMLSource::PrintPreviewData data;
449 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_); 449 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_);
450 print_preview_ui->html_source()->GetPrintPreviewData(&data); 450 print_preview_ui->html_source()->GetPrintPreviewData(&data);
451 DCHECK(data.first); 451 if (!data.first || !data.second) {
452 DCHECK_GT(data.second, 0U); 452 NOTREACHED();
453 return;
454 }
453 455
454 printing::PreviewMetafile* metafile = new printing::PreviewMetafile; 456 printing::PreviewMetafile* metafile = new printing::PreviewMetafile;
455 metafile->InitFromData(data.first->memory(), data.second); 457 metafile->InitFromData(data.first->memory(), data.second);
456 458
457 // Updating last_saved_path_ to the newly selected folder. 459 // Updating last_saved_path_ to the newly selected folder.
458 *last_saved_path_ = path.DirName(); 460 *last_saved_path_ = path.DirName();
459 461
460 PrintToPdfTask* task = new PrintToPdfTask(metafile, path); 462 PrintToPdfTask* task = new PrintToPdfTask(metafile, path);
461 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, task); 463 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, task);
462 464
463 ActivateInitiatorTabAndClosePreviewTab(); 465 ActivateInitiatorTabAndClosePreviewTab();
464 } 466 }
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