OLD | NEW |
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/base64.h" |
9 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
10 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
14 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
15 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
16 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
17 #include "base/values.h" | 18 #include "base/values.h" |
18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/platform_util.h" | 20 #include "chrome/browser/platform_util.h" |
20 #include "chrome/browser/printing/background_printing_manager.h" | 21 #include "chrome/browser/printing/background_printing_manager.h" |
| 22 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
21 #include "chrome/browser/printing/printer_manager_dialog.h" | 23 #include "chrome/browser/printing/printer_manager_dialog.h" |
22 #include "chrome/browser/printing/print_preview_tab_controller.h" | 24 #include "chrome/browser/printing/print_preview_tab_controller.h" |
23 #include "chrome/browser/tabs/tab_strip_model.h" | 25 #include "chrome/browser/tabs/tab_strip_model.h" |
24 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
26 #include "chrome/browser/ui/webui/print_preview_ui.h" | 28 #include "chrome/browser/ui/webui/print_preview_ui.h" |
27 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
28 #include "chrome/common/print_messages.h" | 30 #include "chrome/common/print_messages.h" |
29 #include "content/browser/browser_thread.h" | 31 #include "content/browser/browser_thread.h" |
30 #include "content/browser/renderer_host/render_view_host.h" | 32 #include "content/browser/renderer_host/render_view_host.h" |
31 #include "content/browser/tab_contents/tab_contents.h" | 33 #include "content/browser/tab_contents/tab_contents.h" |
32 #include "printing/backend/print_backend.h" | 34 #include "printing/backend/print_backend.h" |
33 #include "printing/metafile.h" | 35 #include "printing/metafile.h" |
34 #include "printing/metafile_impl.h" | 36 #include "printing/metafile_impl.h" |
35 #include "printing/page_range.h" | 37 #include "printing/page_range.h" |
36 #include "printing/print_job_constants.h" | 38 #include "printing/print_job_constants.h" |
37 | 39 |
| 40 #if !defined(OS_CHROMEOS) |
| 41 #include "base/command_line.h" |
| 42 #include "chrome/common/chrome_switches.h" |
| 43 #endif |
| 44 |
38 #if defined(USE_CUPS) | 45 #if defined(USE_CUPS) |
39 #include <cups/cups.h> | 46 #include <cups/cups.h> |
40 | 47 |
41 #include "base/file_util.h" | 48 #include "base/file_util.h" |
42 #endif | 49 #endif |
43 | 50 |
44 namespace { | 51 namespace { |
45 | 52 |
46 const bool kColorDefaultValue = false; | 53 const bool kColorDefaultValue = false; |
47 const bool kLandscapeDefaultValue = false; | 54 const bool kLandscapeDefaultValue = false; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 #endif | 228 #endif |
222 printer_info->SetString(printing::kSettingPrinterName, printerName); | 229 printer_info->SetString(printing::kSettingPrinterName, printerName); |
223 printer_info->SetString(printing::kSettingDeviceName, iter->printer_name); | 230 printer_info->SetString(printing::kSettingDeviceName, iter->printer_name); |
224 printers->Append(printer_info); | 231 printers->Append(printer_info); |
225 } | 232 } |
226 VLOG(1) << "Enumerate printers finished, found " << i << " printers"; | 233 VLOG(1) << "Enumerate printers finished, found " << i << " printers"; |
227 | 234 |
228 BrowserThread::PostTask( | 235 BrowserThread::PostTask( |
229 BrowserThread::UI, FROM_HERE, | 236 BrowserThread::UI, FROM_HERE, |
230 NewRunnableMethod(this, | 237 NewRunnableMethod(this, |
231 &PrintSystemTaskProxy::SendPrinterList, | 238 &PrintSystemTaskProxy::SetupPrinterList, |
232 printers)); | 239 printers)); |
233 } | 240 } |
234 | 241 |
235 void SendPrinterList(ListValue* printers) { | 242 void SetupPrinterList(ListValue* printers) { |
236 if (handler_) | 243 if (handler_) { |
237 handler_->SendPrinterList(*printers); | 244 handler_->SetupPrinterList(*printers); |
| 245 } |
238 delete printers; | 246 delete printers; |
239 } | 247 } |
240 | 248 |
241 void GetPrinterCapabilities(const std::string& printer_name) { | 249 void GetPrinterCapabilities(const std::string& printer_name) { |
242 VLOG(1) << "Get printer capabilities start for " << printer_name; | 250 VLOG(1) << "Get printer capabilities start for " << printer_name; |
243 printing::PrinterCapsAndDefaults printer_info; | 251 printing::PrinterCapsAndDefaults printer_info; |
244 bool supports_color = true; | 252 bool supports_color = true; |
245 if (!print_backend_->GetPrinterCapsAndDefaults(printer_name, | 253 if (!print_backend_->GetPrinterCapsAndDefaults(printer_name, |
246 &printer_info)) { | 254 &printer_info)) { |
247 return; | 255 return; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 web_ui_->RegisterMessageCallback("getPrinters", | 371 web_ui_->RegisterMessageCallback("getPrinters", |
364 NewCallback(this, &PrintPreviewHandler::HandleGetPrinters)); | 372 NewCallback(this, &PrintPreviewHandler::HandleGetPrinters)); |
365 web_ui_->RegisterMessageCallback("getPreview", | 373 web_ui_->RegisterMessageCallback("getPreview", |
366 NewCallback(this, &PrintPreviewHandler::HandleGetPreview)); | 374 NewCallback(this, &PrintPreviewHandler::HandleGetPreview)); |
367 web_ui_->RegisterMessageCallback("print", | 375 web_ui_->RegisterMessageCallback("print", |
368 NewCallback(this, &PrintPreviewHandler::HandlePrint)); | 376 NewCallback(this, &PrintPreviewHandler::HandlePrint)); |
369 web_ui_->RegisterMessageCallback("getPrinterCapabilities", | 377 web_ui_->RegisterMessageCallback("getPrinterCapabilities", |
370 NewCallback(this, &PrintPreviewHandler::HandleGetPrinterCapabilities)); | 378 NewCallback(this, &PrintPreviewHandler::HandleGetPrinterCapabilities)); |
371 web_ui_->RegisterMessageCallback("showSystemDialog", | 379 web_ui_->RegisterMessageCallback("showSystemDialog", |
372 NewCallback(this, &PrintPreviewHandler::HandleShowSystemDialog)); | 380 NewCallback(this, &PrintPreviewHandler::HandleShowSystemDialog)); |
373 web_ui_->RegisterMessageCallback("managePrinters", | 381 web_ui_->RegisterMessageCallback("morePrinters", |
| 382 NewCallback(this, &PrintPreviewHandler::HandleShowSystemDialog)); |
| 383 web_ui_->RegisterMessageCallback("signIn", |
| 384 NewCallback(this, &PrintPreviewHandler::HandleManageCloudPrint)); |
| 385 web_ui_->RegisterMessageCallback("addPrinter", |
| 386 NewCallback(this, &PrintPreviewHandler::HandleManageCloudPrint)); |
| 387 web_ui_->RegisterMessageCallback("manageCloudPrinters", |
| 388 NewCallback(this, &PrintPreviewHandler::HandleManageCloudPrint)); |
| 389 web_ui_->RegisterMessageCallback("manageLocalPrinters", |
374 NewCallback(this, &PrintPreviewHandler::HandleManagePrinters)); | 390 NewCallback(this, &PrintPreviewHandler::HandleManagePrinters)); |
375 web_ui_->RegisterMessageCallback("closePrintPreviewTab", | 391 web_ui_->RegisterMessageCallback("closePrintPreviewTab", |
376 NewCallback(this, &PrintPreviewHandler::HandleClosePreviewTab)); | 392 NewCallback(this, &PrintPreviewHandler::HandleClosePreviewTab)); |
377 } | 393 } |
378 | 394 |
379 TabContents* PrintPreviewHandler::preview_tab() { | 395 TabContents* PrintPreviewHandler::preview_tab() { |
380 return web_ui_->tab_contents(); | 396 return web_ui_->tab_contents(); |
381 } | 397 } |
382 | 398 |
383 void PrintPreviewHandler::HandleGetDefaultPrinter(const ListValue*) { | 399 void PrintPreviewHandler::HandleGetDefaultPrinter(const ListValue*) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 if (!settings.get()) | 437 if (!settings.get()) |
422 return; | 438 return; |
423 | 439 |
424 VLOG(1) << "Print preview request start"; | 440 VLOG(1) << "Print preview request start"; |
425 RenderViewHost* rvh = initiator_tab->render_view_host(); | 441 RenderViewHost* rvh = initiator_tab->render_view_host(); |
426 rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings)); | 442 rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings)); |
427 } | 443 } |
428 | 444 |
429 void PrintPreviewHandler::HandlePrint(const ListValue* args) { | 445 void PrintPreviewHandler::HandlePrint(const ListValue* args) { |
430 ReportStats(); | 446 ReportStats(); |
431 | |
432 // Record the number of times the user requests to regenerate preview data | 447 // Record the number of times the user requests to regenerate preview data |
433 // before printing. | 448 // before printing. |
434 UMA_HISTOGRAM_COUNTS("PrintPreview.RegeneratePreviewRequest.BeforePrint", | 449 UMA_HISTOGRAM_COUNTS("PrintPreview.RegeneratePreviewRequest.BeforePrint", |
435 regenerate_preview_request_count_); | 450 regenerate_preview_request_count_); |
436 | 451 |
437 TabContents* initiator_tab = GetInitiatorTab(); | 452 TabContents* initiator_tab = GetInitiatorTab(); |
438 if (initiator_tab) { | 453 if (initiator_tab) { |
439 RenderViewHost* rvh = initiator_tab->render_view_host(); | 454 RenderViewHost* rvh = initiator_tab->render_view_host(); |
440 rvh->Send(new PrintMsg_ResetScriptedPrintCount(rvh->routing_id())); | 455 rvh->Send(new PrintMsg_ResetScriptedPrintCount(rvh->routing_id())); |
441 } | 456 } |
442 | 457 |
443 scoped_ptr<DictionaryValue> settings(GetSettingsDictionary(args)); | 458 scoped_ptr<DictionaryValue> settings(GetSettingsDictionary(args)); |
444 if (!settings.get()) | 459 if (!settings.get()) |
445 return; | 460 return; |
446 | 461 |
447 // Initializing last_used_printer_ if it is not already initialized. | 462 // Initializing last_used_printer_ if it is not already initialized. |
448 if (!last_used_printer_) | 463 if (!last_used_printer_) |
449 last_used_printer_ = new std::string(); | 464 last_used_printer_ = new std::string(); |
450 // Storing last used printer. | 465 // Storing last used printer. |
451 settings->GetString("deviceName", last_used_printer_); | 466 settings->GetString("deviceName", last_used_printer_); |
452 | 467 |
453 bool print_to_pdf = false; | 468 bool print_to_pdf = false; |
454 settings->GetBoolean(printing::kSettingPrintToPDF, &print_to_pdf); | 469 settings->GetBoolean(printing::kSettingPrintToPDF, &print_to_pdf); |
455 | 470 |
456 TabContentsWrapper* preview_tab_wrapper = | 471 TabContentsWrapper* preview_tab_wrapper = |
457 TabContentsWrapper::GetCurrentWrapperForContents(preview_tab()); | 472 TabContentsWrapper::GetCurrentWrapperForContents(preview_tab()); |
458 | 473 |
459 if (print_to_pdf) { | 474 bool print_to_cloud = settings->HasKey(printing::kSettingCloudPrintId); |
| 475 if (print_to_cloud) { |
| 476 std::string print_ticket; |
| 477 args->GetString(1, &print_ticket); |
| 478 SendCloudPrintJob(*settings, print_ticket); |
| 479 } else if (print_to_pdf) { |
460 ReportUserActionHistogram(PRINT_TO_PDF); | 480 ReportUserActionHistogram(PRINT_TO_PDF); |
461 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPDF", | 481 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPDF", |
462 GetPageCountFromSettingsDictionary(*settings)); | 482 GetPageCountFromSettingsDictionary(*settings)); |
463 | 483 |
464 // Pre-populating select file dialog with print job title. | 484 // Pre-populating select file dialog with print job title. |
465 string16 print_job_title_utf16 = | 485 string16 print_job_title_utf16 = |
466 preview_tab_wrapper->print_view_manager()->RenderSourceName(); | 486 preview_tab_wrapper->print_view_manager()->RenderSourceName(); |
467 | 487 |
468 #if defined(OS_WIN) | 488 #if defined(OS_WIN) |
469 FilePath::StringType print_job_title(print_job_title_utf16); | 489 FilePath::StringType print_job_title(print_job_title_utf16); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 print_backend_.get(), | 525 print_backend_.get(), |
506 has_logged_printers_count_); | 526 has_logged_printers_count_); |
507 | 527 |
508 BrowserThread::PostTask( | 528 BrowserThread::PostTask( |
509 BrowserThread::FILE, FROM_HERE, | 529 BrowserThread::FILE, FROM_HERE, |
510 NewRunnableMethod(task.get(), | 530 NewRunnableMethod(task.get(), |
511 &PrintSystemTaskProxy::GetPrinterCapabilities, | 531 &PrintSystemTaskProxy::GetPrinterCapabilities, |
512 printer_name)); | 532 printer_name)); |
513 } | 533 } |
514 | 534 |
| 535 void PrintPreviewHandler::HandleManageCloudPrint(const ListValue* args) { |
| 536 Browser* browser = BrowserList::GetLastActive(); |
| 537 browser->OpenURL(CloudPrintURL(browser->profile()). |
| 538 GetCloudPrintServiceManageURL(), |
| 539 GURL(), |
| 540 NEW_FOREGROUND_TAB, |
| 541 PageTransition::LINK); |
| 542 } |
| 543 |
515 void PrintPreviewHandler::HandleShowSystemDialog(const ListValue* args) { | 544 void PrintPreviewHandler::HandleShowSystemDialog(const ListValue* args) { |
516 ReportStats(); | 545 ReportStats(); |
517 ReportUserActionHistogram(FALLBACK_TO_ADVANCED_SETTINGS_DIALOG); | 546 ReportUserActionHistogram(FALLBACK_TO_ADVANCED_SETTINGS_DIALOG); |
518 | 547 |
519 TabContents* initiator_tab = GetInitiatorTab(); | 548 TabContents* initiator_tab = GetInitiatorTab(); |
520 if (!initiator_tab) | 549 if (!initiator_tab) |
521 return; | 550 return; |
522 initiator_tab->Activate(); | 551 initiator_tab->Activate(); |
523 | 552 |
524 TabContentsWrapper* wrapper = | 553 TabContentsWrapper* wrapper = |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 VLOG(1) << "Get printer capabilities finished"; | 591 VLOG(1) << "Get printer capabilities finished"; |
563 web_ui_->CallJavascriptFunction("updateWithPrinterCapabilities", | 592 web_ui_->CallJavascriptFunction("updateWithPrinterCapabilities", |
564 settings_info); | 593 settings_info); |
565 } | 594 } |
566 | 595 |
567 void PrintPreviewHandler::SendDefaultPrinter( | 596 void PrintPreviewHandler::SendDefaultPrinter( |
568 const StringValue& default_printer) { | 597 const StringValue& default_printer) { |
569 web_ui_->CallJavascriptFunction("setDefaultPrinter", default_printer); | 598 web_ui_->CallJavascriptFunction("setDefaultPrinter", default_printer); |
570 } | 599 } |
571 | 600 |
572 void PrintPreviewHandler::SendPrinterList(const ListValue& printers) { | 601 void PrintPreviewHandler::SetupPrinterList(const ListValue& printers) { |
573 web_ui_->CallJavascriptFunction("setPrinters", printers); | 602 SendCloudPrintEnabled(); |
| 603 web_ui_->CallJavascriptFunction("setPrinters", printers, |
| 604 *(Value::CreateBooleanValue(true))); |
| 605 } |
| 606 |
| 607 void PrintPreviewHandler::SendCloudPrintEnabled() { |
| 608 #if defined(OS_CHROMEOS) |
| 609 bool enable_cloud_print_integration = true; |
| 610 #else |
| 611 bool enable_cloud_print_integration = |
| 612 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableCloudPrint); |
| 613 #endif |
| 614 GURL gcp_url(CloudPrintURL(BrowserList::GetLastActive()->profile()). |
| 615 GetCloudPrintServiceURL()); |
| 616 if (enable_cloud_print_integration) { |
| 617 RenderViewHost* rvh = web_ui_->GetRenderViewHost(); |
| 618 rvh->Send(new PrintMsg_PrintSetupWhitelist(rvh->routing_id(), |
| 619 gcp_url.host())); |
| 620 } |
| 621 FundamentalValue enable(enable_cloud_print_integration); |
| 622 StringValue gcp_url_value(gcp_url.spec()); |
| 623 web_ui_->CallJavascriptFunction("setUseCloudPrint", enable, gcp_url_value); |
| 624 } |
| 625 |
| 626 void PrintPreviewHandler::SendCloudPrintJob(const DictionaryValue& settings, |
| 627 std::string print_ticket) { |
| 628 scoped_refptr<RefCountedBytes> data; |
| 629 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_); |
| 630 print_preview_ui->GetPrintPreviewData(&data); |
| 631 CHECK(data->front()); |
| 632 DCHECK_GT(data->size(), 0U); |
| 633 |
| 634 // BASE64 encode the job data. |
| 635 std::string raw_data(reinterpret_cast<const char*>(data->front()), |
| 636 data->size()); |
| 637 std::string base64_data; |
| 638 if (!base::Base64Encode(raw_data, &base64_data)) { |
| 639 NOTREACHED() << "Base64 encoding PDF data."; |
| 640 } |
| 641 |
| 642 TabContentsWrapper* wrapper = |
| 643 TabContentsWrapper::GetCurrentWrapperForContents(preview_tab()); |
| 644 string16 print_job_title_utf16 = |
| 645 wrapper->print_view_manager()->RenderSourceName(); |
| 646 std::string print_job_title = UTF16ToUTF8(print_job_title_utf16); |
| 647 std::string printer_id; |
| 648 settings.GetString("cloudPrintID", &printer_id); |
| 649 |
| 650 const char prolog[] = "------CloudPrintFormBoundaryjc9wuprokl8i\r\n" |
| 651 "Content-Disposition: form-data; name=\"capabilities\"\r\n\r\n%s\r\n" |
| 652 "------CloudPrintFormBoundaryjc9wuprokl8i\r\n" |
| 653 "Content-Disposition: form-data; name=\"contentType\"\r\n\r\ndataUrl\r\n" |
| 654 "------CloudPrintFormBoundaryjc9wuprokl8i\r\n" |
| 655 "Content-Disposition: form-data; name=\"title\"\r\n\r\n%s\r\n" |
| 656 "------CloudPrintFormBoundaryjc9wuprokl8i\r\n" |
| 657 "Content-Disposition: form-data; name=\"printerid\"\r\n\r\n%s\r\n" |
| 658 "------CloudPrintFormBoundaryjc9wuprokl8i\r\n" |
| 659 "Content-Disposition: form-data; name=\"content\"\r\n\r\n" |
| 660 "data:application/pdf;base64,%s\r\n" |
| 661 "------CloudPrintFormBoundaryjc9wuprokl8i\r\n"; |
| 662 |
| 663 std::string final_data; |
| 664 base::SStringPrintf(&final_data, |
| 665 prolog, |
| 666 print_ticket.c_str(), |
| 667 print_job_title.c_str(), |
| 668 printer_id.c_str(), |
| 669 base64_data.c_str()); |
| 670 |
| 671 StringValue data_value(final_data); |
| 672 |
| 673 web_ui_->CallJavascriptFunction("printToCloud", |
| 674 data_value); |
574 } | 675 } |
575 | 676 |
576 TabContents* PrintPreviewHandler::GetInitiatorTab() { | 677 TabContents* PrintPreviewHandler::GetInitiatorTab() { |
577 printing::PrintPreviewTabController* tab_controller = | 678 printing::PrintPreviewTabController* tab_controller = |
578 printing::PrintPreviewTabController::GetInstance(); | 679 printing::PrintPreviewTabController::GetInstance(); |
579 if (!tab_controller) | 680 if (!tab_controller) |
580 return NULL; | 681 return NULL; |
581 return tab_controller->GetInitiatorTab(preview_tab()); | 682 return tab_controller->GetInitiatorTab(preview_tab()); |
582 } | 683 } |
583 | 684 |
584 void PrintPreviewHandler::ClosePrintPreviewTab() { | 685 void PrintPreviewHandler::ClosePrintPreviewTab() { |
| 686 RenderViewHost* rvh = web_ui_->GetRenderViewHost(); |
| 687 GURL gcp_url(CloudPrintURL(BrowserList::GetLastActive()->profile()). |
| 688 GetCloudPrintServiceURL()); |
| 689 rvh->Send(new PrintMsg_PrintTeardownWhitelist(rvh->routing_id(), |
| 690 gcp_url.host())); |
585 Browser* preview_tab_browser = BrowserList::FindBrowserWithID( | 691 Browser* preview_tab_browser = BrowserList::FindBrowserWithID( |
586 preview_tab()->controller().window_id().id()); | 692 preview_tab()->controller().window_id().id()); |
587 if (!preview_tab_browser) | 693 if (!preview_tab_browser) |
588 return; | 694 return; |
589 TabStripModel* tabstrip = preview_tab_browser->tabstrip_model(); | 695 TabStripModel* tabstrip = preview_tab_browser->tabstrip_model(); |
590 | 696 |
591 // Keep print preview tab out of the recently closed tab list, because | 697 // Keep print preview tab out of the recently closed tab list, because |
592 // re-opening that page will just display a non-functional print preview page. | 698 // re-opening that page will just display a non-functional print preview page. |
593 tabstrip->CloseTabContentsAt(tabstrip->GetIndexOfController( | 699 tabstrip->CloseTabContentsAt(tabstrip->GetIndexOfController( |
594 &preview_tab()->controller()), TabStripModel::CLOSE_NONE); | 700 &preview_tab()->controller()), TabStripModel::CLOSE_NONE); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 metafile->InitFromData(static_cast<const void*>(data->front()), data->size()); | 744 metafile->InitFromData(static_cast<const void*>(data->front()), data->size()); |
639 | 745 |
640 // Updating last_saved_path_ to the newly selected folder. | 746 // Updating last_saved_path_ to the newly selected folder. |
641 *last_saved_path_ = path.DirName(); | 747 *last_saved_path_ = path.DirName(); |
642 | 748 |
643 PrintToPdfTask* task = new PrintToPdfTask(metafile, path); | 749 PrintToPdfTask* task = new PrintToPdfTask(metafile, path); |
644 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, task); | 750 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, task); |
645 | 751 |
646 ActivateInitiatorTabAndClosePreviewTab(); | 752 ActivateInitiatorTabAndClosePreviewTab(); |
647 } | 753 } |
OLD | NEW |