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

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

Issue 8425008: PrintPreview:[MAC] Added "Open PDF In Preview" option to open the pdf in native preview app. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 years, 1 month 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
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 <ctype.h> 7 #include <ctype.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 398
399 // Storing last used margin settings. 399 // Storing last used margin settings.
400 int margin_type; 400 int margin_type;
401 if (!settings->GetInteger(printing::kSettingMarginsType, &margin_type)) 401 if (!settings->GetInteger(printing::kSettingMarginsType, &margin_type))
402 margin_type = printing::DEFAULT_MARGINS; 402 margin_type = printing::DEFAULT_MARGINS;
403 last_used_margins_type_ = static_cast<printing::MarginType>(margin_type); 403 last_used_margins_type_ = static_cast<printing::MarginType>(margin_type);
404 404
405 bool print_to_pdf = false; 405 bool print_to_pdf = false;
406 settings->GetBoolean(printing::kSettingPrintToPDF, &print_to_pdf); 406 settings->GetBoolean(printing::kSettingPrintToPDF, &print_to_pdf);
407 407
408 bool open_pdf_in_preview = false;
409 #if defined(OS_MACOSX)
410 open_pdf_in_preview = settings->HasKey(printing::kSettingOpenPDFInPreview);
411 #endif
412
408 settings->SetBoolean(printing::kSettingHeaderFooterEnabled, false); 413 settings->SetBoolean(printing::kSettingHeaderFooterEnabled, false);
409 414
410 bool is_cloud_printer = settings->HasKey(printing::kSettingCloudPrintId); 415 bool is_cloud_printer = settings->HasKey(printing::kSettingCloudPrintId);
411 bool is_cloud_dialog = false; 416 bool is_cloud_dialog = false;
412 settings->GetBoolean(printing::kSettingCloudPrintDialog, &is_cloud_dialog); 417 settings->GetBoolean(printing::kSettingCloudPrintDialog, &is_cloud_dialog);
413 if (is_cloud_printer) { 418 if (is_cloud_printer && !open_pdf_in_preview) {
414 std::string print_ticket; 419 std::string print_ticket;
415 args->GetString(1, &print_ticket); 420 args->GetString(1, &print_ticket);
416 SendCloudPrintJob(*settings, print_ticket); 421 SendCloudPrintJob(*settings, print_ticket);
417 } else if (print_to_pdf) { 422 } else if (print_to_pdf && !open_pdf_in_preview) {
418 HandlePrintToPdf(*settings); 423 HandlePrintToPdf(*settings);
419 } else if (is_cloud_dialog) { 424 } else if (is_cloud_dialog && !open_pdf_in_preview) {
420 HandlePrintWithCloudPrint(); 425 HandlePrintWithCloudPrint();
421 } else { 426 } else {
422 ReportPrintSettingsStats(*settings); 427 ReportPrintSettingsStats(*settings);
423 ReportUserActionHistogram(PRINT_TO_PRINTER); 428 ReportUserActionHistogram(PRINT_TO_PRINTER);
424 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPrinter", 429 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPrinter",
425 GetPageCountFromSettingsDictionary(*settings)); 430 GetPageCountFromSettingsDictionary(*settings));
426 431
427 // This tries to activate the initiator tab as well, so do not clear the 432 // This tries to activate the initiator tab as well, so do not clear the
428 // association with the initiator tab yet. 433 // association with the initiator tab yet.
429 HidePreviewTab(); 434 HidePreviewTab();
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 return; 873 return;
869 874
870 // We no longer require the initiator tab details. Remove those details 875 // We no longer require the initiator tab details. Remove those details
871 // associated with the preview tab to allow the initiator tab to create 876 // associated with the preview tab to allow the initiator tab to create
872 // another preview tab. 877 // another preview tab.
873 printing::PrintPreviewTabController* tab_controller = 878 printing::PrintPreviewTabController* tab_controller =
874 printing::PrintPreviewTabController::GetInstance(); 879 printing::PrintPreviewTabController::GetInstance();
875 if (tab_controller) 880 if (tab_controller)
876 tab_controller->EraseInitiatorTabInfo(preview_tab_wrapper()); 881 tab_controller->EraseInitiatorTabInfo(preview_tab_wrapper());
877 } 882 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698