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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 #endif | 232 #endif |
226 printer_info->SetString(printing::kSettingPrinterName, printerName); | 233 printer_info->SetString(printing::kSettingPrinterName, printerName); |
227 printer_info->SetString(printing::kSettingDeviceName, iter->printer_name); | 234 printer_info->SetString(printing::kSettingDeviceName, iter->printer_name); |
228 printers->Append(printer_info); | 235 printers->Append(printer_info); |
229 } | 236 } |
230 VLOG(1) << "Enumerate printers finished, found " << i << " printers"; | 237 VLOG(1) << "Enumerate printers finished, found " << i << " printers"; |
231 | 238 |
232 BrowserThread::PostTask( | 239 BrowserThread::PostTask( |
233 BrowserThread::UI, FROM_HERE, | 240 BrowserThread::UI, FROM_HERE, |
234 NewRunnableMethod(this, | 241 NewRunnableMethod(this, |
235 &PrintSystemTaskProxy::SendPrinterList, | 242 &PrintSystemTaskProxy::SetupPrinterList, |
236 printers)); | 243 printers)); |
237 } | 244 } |
238 | 245 |
239 void SendPrinterList(ListValue* printers) { | 246 void SetupPrinterList(ListValue* printers) { |
240 if (handler_) | 247 if (handler_) { |
241 handler_->SendPrinterList(*printers); | 248 handler_->SetupPrinterList(*printers); |
| 249 } |
242 delete printers; | 250 delete printers; |
243 } | 251 } |
244 | 252 |
245 void GetPrinterCapabilities(const std::string& printer_name) { | 253 void GetPrinterCapabilities(const std::string& printer_name) { |
246 VLOG(1) << "Get printer capabilities start for " << printer_name; | 254 VLOG(1) << "Get printer capabilities start for " << printer_name; |
247 printing::PrinterCapsAndDefaults printer_info; | 255 printing::PrinterCapsAndDefaults printer_info; |
248 bool supports_color = true; | 256 bool supports_color = true; |
249 if (!print_backend_->GetPrinterCapsAndDefaults(printer_name, | 257 if (!print_backend_->GetPrinterCapsAndDefaults(printer_name, |
250 &printer_info)) { | 258 &printer_info)) { |
251 return; | 259 return; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 web_ui_->RegisterMessageCallback("getPrinters", | 375 web_ui_->RegisterMessageCallback("getPrinters", |
368 NewCallback(this, &PrintPreviewHandler::HandleGetPrinters)); | 376 NewCallback(this, &PrintPreviewHandler::HandleGetPrinters)); |
369 web_ui_->RegisterMessageCallback("getPreview", | 377 web_ui_->RegisterMessageCallback("getPreview", |
370 NewCallback(this, &PrintPreviewHandler::HandleGetPreview)); | 378 NewCallback(this, &PrintPreviewHandler::HandleGetPreview)); |
371 web_ui_->RegisterMessageCallback("print", | 379 web_ui_->RegisterMessageCallback("print", |
372 NewCallback(this, &PrintPreviewHandler::HandlePrint)); | 380 NewCallback(this, &PrintPreviewHandler::HandlePrint)); |
373 web_ui_->RegisterMessageCallback("getPrinterCapabilities", | 381 web_ui_->RegisterMessageCallback("getPrinterCapabilities", |
374 NewCallback(this, &PrintPreviewHandler::HandleGetPrinterCapabilities)); | 382 NewCallback(this, &PrintPreviewHandler::HandleGetPrinterCapabilities)); |
375 web_ui_->RegisterMessageCallback("showSystemDialog", | 383 web_ui_->RegisterMessageCallback("showSystemDialog", |
376 NewCallback(this, &PrintPreviewHandler::HandleShowSystemDialog)); | 384 NewCallback(this, &PrintPreviewHandler::HandleShowSystemDialog)); |
377 web_ui_->RegisterMessageCallback("managePrinters", | 385 web_ui_->RegisterMessageCallback("morePrinters", |
| 386 NewCallback(this, &PrintPreviewHandler::HandleShowSystemDialog)); |
| 387 web_ui_->RegisterMessageCallback("signIn", |
| 388 NewCallback(this, &PrintPreviewHandler::HandleManageCloudPrint)); |
| 389 web_ui_->RegisterMessageCallback("addPrinter", |
| 390 NewCallback(this, &PrintPreviewHandler::HandleManageCloudPrint)); |
| 391 web_ui_->RegisterMessageCallback("manageCloudPrinters", |
| 392 NewCallback(this, &PrintPreviewHandler::HandleManageCloudPrint)); |
| 393 web_ui_->RegisterMessageCallback("manageLocalPrinters", |
378 NewCallback(this, &PrintPreviewHandler::HandleManagePrinters)); | 394 NewCallback(this, &PrintPreviewHandler::HandleManagePrinters)); |
379 web_ui_->RegisterMessageCallback("closePrintPreviewTab", | 395 web_ui_->RegisterMessageCallback("closePrintPreviewTab", |
380 NewCallback(this, &PrintPreviewHandler::HandleClosePreviewTab)); | 396 NewCallback(this, &PrintPreviewHandler::HandleClosePreviewTab)); |
381 web_ui_->RegisterMessageCallback("hidePreview", | 397 web_ui_->RegisterMessageCallback("hidePreview", |
382 NewCallback(this, &PrintPreviewHandler::HandleHidePreview)); | 398 NewCallback(this, &PrintPreviewHandler::HandleHidePreview)); |
383 } | 399 } |
384 | 400 |
385 TabContents* PrintPreviewHandler::preview_tab() { | 401 TabContents* PrintPreviewHandler::preview_tab() { |
386 return web_ui_->tab_contents(); | 402 return web_ui_->tab_contents(); |
387 } | 403 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 if (!settings.get()) | 443 if (!settings.get()) |
428 return; | 444 return; |
429 | 445 |
430 VLOG(1) << "Print preview request start"; | 446 VLOG(1) << "Print preview request start"; |
431 RenderViewHost* rvh = initiator_tab->render_view_host(); | 447 RenderViewHost* rvh = initiator_tab->render_view_host(); |
432 rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings)); | 448 rvh->Send(new PrintMsg_PrintPreview(rvh->routing_id(), *settings)); |
433 } | 449 } |
434 | 450 |
435 void PrintPreviewHandler::HandlePrint(const ListValue* args) { | 451 void PrintPreviewHandler::HandlePrint(const ListValue* args) { |
436 ReportStats(); | 452 ReportStats(); |
437 | |
438 // Record the number of times the user requests to regenerate preview data | 453 // Record the number of times the user requests to regenerate preview data |
439 // before printing. | 454 // before printing. |
440 UMA_HISTOGRAM_COUNTS("PrintPreview.RegeneratePreviewRequest.BeforePrint", | 455 UMA_HISTOGRAM_COUNTS("PrintPreview.RegeneratePreviewRequest.BeforePrint", |
441 regenerate_preview_request_count_); | 456 regenerate_preview_request_count_); |
442 | 457 |
443 TabContents* initiator_tab = GetInitiatorTab(); | 458 TabContents* initiator_tab = GetInitiatorTab(); |
444 if (initiator_tab) { | 459 if (initiator_tab) { |
445 RenderViewHost* rvh = initiator_tab->render_view_host(); | 460 RenderViewHost* rvh = initiator_tab->render_view_host(); |
446 rvh->Send(new PrintMsg_ResetScriptedPrintCount(rvh->routing_id())); | 461 rvh->Send(new PrintMsg_ResetScriptedPrintCount(rvh->routing_id())); |
447 } | 462 } |
448 | 463 |
449 scoped_ptr<DictionaryValue> settings(GetSettingsDictionary(args)); | 464 scoped_ptr<DictionaryValue> settings(GetSettingsDictionary(args)); |
450 if (!settings.get()) | 465 if (!settings.get()) |
451 return; | 466 return; |
452 | 467 |
453 // Initializing last_used_printer_ if it is not already initialized. | 468 // Initializing last_used_printer_ if it is not already initialized. |
454 if (!last_used_printer_) | 469 if (!last_used_printer_) |
455 last_used_printer_ = new std::string(); | 470 last_used_printer_ = new std::string(); |
456 // Storing last used printer. | 471 // Storing last used printer. |
457 settings->GetString("deviceName", last_used_printer_); | 472 settings->GetString("deviceName", last_used_printer_); |
458 | 473 |
459 bool print_to_pdf = false; | 474 bool print_to_pdf = false; |
460 settings->GetBoolean(printing::kSettingPrintToPDF, &print_to_pdf); | 475 settings->GetBoolean(printing::kSettingPrintToPDF, &print_to_pdf); |
461 | 476 |
462 TabContentsWrapper* preview_tab_wrapper = | 477 TabContentsWrapper* preview_tab_wrapper = |
463 TabContentsWrapper::GetCurrentWrapperForContents(preview_tab()); | 478 TabContentsWrapper::GetCurrentWrapperForContents(preview_tab()); |
464 | 479 |
465 if (print_to_pdf) { | 480 bool print_to_cloud = settings->HasKey(printing::kSettingCloudPrintId); |
| 481 if (print_to_cloud) { |
| 482 std::string print_ticket; |
| 483 args->GetString(1, &print_ticket); |
| 484 SendCloudPrintJob(*settings, print_ticket); |
| 485 } else if (print_to_pdf) { |
466 ReportUserActionHistogram(PRINT_TO_PDF); | 486 ReportUserActionHistogram(PRINT_TO_PDF); |
467 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPDF", | 487 UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToPDF", |
468 GetPageCountFromSettingsDictionary(*settings)); | 488 GetPageCountFromSettingsDictionary(*settings)); |
469 | 489 |
470 // Pre-populating select file dialog with print job title. | 490 // Pre-populating select file dialog with print job title. |
471 string16 print_job_title_utf16 = | 491 string16 print_job_title_utf16 = |
472 preview_tab_wrapper->print_view_manager()->RenderSourceName(); | 492 preview_tab_wrapper->print_view_manager()->RenderSourceName(); |
473 | 493 |
474 #if defined(OS_WIN) | 494 #if defined(OS_WIN) |
475 FilePath::StringType print_job_title(print_job_title_utf16); | 495 FilePath::StringType print_job_title(print_job_title_utf16); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 print_backend_.get(), | 536 print_backend_.get(), |
517 has_logged_printers_count_); | 537 has_logged_printers_count_); |
518 | 538 |
519 BrowserThread::PostTask( | 539 BrowserThread::PostTask( |
520 BrowserThread::FILE, FROM_HERE, | 540 BrowserThread::FILE, FROM_HERE, |
521 NewRunnableMethod(task.get(), | 541 NewRunnableMethod(task.get(), |
522 &PrintSystemTaskProxy::GetPrinterCapabilities, | 542 &PrintSystemTaskProxy::GetPrinterCapabilities, |
523 printer_name)); | 543 printer_name)); |
524 } | 544 } |
525 | 545 |
| 546 void PrintPreviewHandler::HandleManageCloudPrint(const ListValue* args) { |
| 547 Browser* browser = BrowserList::GetLastActive(); |
| 548 browser->OpenURL(CloudPrintURL(browser->profile()). |
| 549 GetCloudPrintServiceManageURL(), |
| 550 GURL(), |
| 551 NEW_FOREGROUND_TAB, |
| 552 PageTransition::LINK); |
| 553 } |
| 554 |
526 void PrintPreviewHandler::HandleShowSystemDialog(const ListValue* args) { | 555 void PrintPreviewHandler::HandleShowSystemDialog(const ListValue* args) { |
527 ReportStats(); | 556 ReportStats(); |
528 ReportUserActionHistogram(FALLBACK_TO_ADVANCED_SETTINGS_DIALOG); | 557 ReportUserActionHistogram(FALLBACK_TO_ADVANCED_SETTINGS_DIALOG); |
529 | 558 |
530 TabContents* initiator_tab = GetInitiatorTab(); | 559 TabContents* initiator_tab = GetInitiatorTab(); |
531 if (!initiator_tab) | 560 if (!initiator_tab) |
532 return; | 561 return; |
533 initiator_tab->Activate(); | 562 initiator_tab->Activate(); |
534 | 563 |
535 TabContentsWrapper* wrapper = | 564 TabContentsWrapper* wrapper = |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 VLOG(1) << "Get printer capabilities finished"; | 602 VLOG(1) << "Get printer capabilities finished"; |
574 web_ui_->CallJavascriptFunction("updateWithPrinterCapabilities", | 603 web_ui_->CallJavascriptFunction("updateWithPrinterCapabilities", |
575 settings_info); | 604 settings_info); |
576 } | 605 } |
577 | 606 |
578 void PrintPreviewHandler::SendDefaultPrinter( | 607 void PrintPreviewHandler::SendDefaultPrinter( |
579 const StringValue& default_printer) { | 608 const StringValue& default_printer) { |
580 web_ui_->CallJavascriptFunction("setDefaultPrinter", default_printer); | 609 web_ui_->CallJavascriptFunction("setDefaultPrinter", default_printer); |
581 } | 610 } |
582 | 611 |
583 void PrintPreviewHandler::SendPrinterList(const ListValue& printers) { | 612 void PrintPreviewHandler::SetupPrinterList(const ListValue& printers) { |
584 web_ui_->CallJavascriptFunction("setPrinters", printers); | 613 SendCloudPrintEnabled(); |
| 614 web_ui_->CallJavascriptFunction("setPrinters", printers, |
| 615 *(Value::CreateBooleanValue(true))); |
| 616 } |
| 617 |
| 618 void PrintPreviewHandler::SendCloudPrintEnabled() { |
| 619 #if defined(OS_CHROMEOS) |
| 620 bool enable_cloud_print_integration = true; |
| 621 #else |
| 622 bool enable_cloud_print_integration = |
| 623 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableCloudPrint); |
| 624 #endif |
| 625 GURL gcp_url(CloudPrintURL(BrowserList::GetLastActive()->profile()). |
| 626 GetCloudPrintServiceURL()); |
| 627 if (enable_cloud_print_integration) { |
| 628 RenderViewHost* rvh = web_ui_->GetRenderViewHost(); |
| 629 rvh->Send(new PrintMsg_PrintSetupWhitelist(rvh->routing_id(), |
| 630 gcp_url.host())); |
| 631 } |
| 632 FundamentalValue enable(enable_cloud_print_integration); |
| 633 StringValue gcp_url_value(gcp_url.spec()); |
| 634 web_ui_->CallJavascriptFunction("setUseCloudPrint", enable, gcp_url_value); |
| 635 } |
| 636 |
| 637 void PrintPreviewHandler::SendCloudPrintJob(const DictionaryValue& settings, |
| 638 std::string print_ticket) { |
| 639 scoped_refptr<RefCountedBytes> data; |
| 640 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_); |
| 641 print_preview_ui->GetPrintPreviewData(&data); |
| 642 CHECK(data->front()); |
| 643 DCHECK_GT(data->size(), 0U); |
| 644 |
| 645 // BASE64 encode the job data. |
| 646 std::string raw_data(reinterpret_cast<const char*>(data->front()), |
| 647 data->size()); |
| 648 std::string base64_data; |
| 649 if (!base::Base64Encode(raw_data, &base64_data)) { |
| 650 NOTREACHED() << "Base64 encoding PDF data."; |
| 651 } |
| 652 |
| 653 TabContentsWrapper* wrapper = |
| 654 TabContentsWrapper::GetCurrentWrapperForContents(preview_tab()); |
| 655 string16 print_job_title_utf16 = |
| 656 wrapper->print_view_manager()->RenderSourceName(); |
| 657 std::string print_job_title = UTF16ToUTF8(print_job_title_utf16); |
| 658 std::string printer_id; |
| 659 settings.GetString("cloudPrintID", &printer_id); |
| 660 |
| 661 const char prolog[] = "------CloudPrintFormBoundaryjc9wuprokl8i\r\n" |
| 662 "Content-Disposition: form-data; name=\"capabilities\"\r\n\r\n%s\r\n" |
| 663 "------CloudPrintFormBoundaryjc9wuprokl8i\r\n" |
| 664 "Content-Disposition: form-data; name=\"contentType\"\r\n\r\ndataUrl\r\n" |
| 665 "------CloudPrintFormBoundaryjc9wuprokl8i\r\n" |
| 666 "Content-Disposition: form-data; name=\"title\"\r\n\r\n%s\r\n" |
| 667 "------CloudPrintFormBoundaryjc9wuprokl8i\r\n" |
| 668 "Content-Disposition: form-data; name=\"printerid\"\r\n\r\n%s\r\n" |
| 669 "------CloudPrintFormBoundaryjc9wuprokl8i\r\n" |
| 670 "Content-Disposition: form-data; name=\"content\"\r\n\r\n" |
| 671 "data:application/pdf;base64,%s\r\n" |
| 672 "------CloudPrintFormBoundaryjc9wuprokl8i\r\n"; |
| 673 |
| 674 std::string final_data; |
| 675 base::SStringPrintf(&final_data, |
| 676 prolog, |
| 677 print_ticket.c_str(), |
| 678 print_job_title.c_str(), |
| 679 printer_id.c_str(), |
| 680 base64_data.c_str()); |
| 681 |
| 682 StringValue data_value(final_data); |
| 683 |
| 684 web_ui_->CallJavascriptFunction("printToCloud", |
| 685 data_value); |
585 } | 686 } |
586 | 687 |
587 TabContents* PrintPreviewHandler::GetInitiatorTab() { | 688 TabContents* PrintPreviewHandler::GetInitiatorTab() { |
588 printing::PrintPreviewTabController* tab_controller = | 689 printing::PrintPreviewTabController* tab_controller = |
589 printing::PrintPreviewTabController::GetInstance(); | 690 printing::PrintPreviewTabController::GetInstance(); |
590 if (!tab_controller) | 691 if (!tab_controller) |
591 return NULL; | 692 return NULL; |
592 return tab_controller->GetInitiatorTab(preview_tab()); | 693 return tab_controller->GetInitiatorTab(preview_tab()); |
593 } | 694 } |
594 | 695 |
595 void PrintPreviewHandler::ClosePrintPreviewTab() { | 696 void PrintPreviewHandler::ClosePrintPreviewTab() { |
| 697 RenderViewHost* rvh = web_ui_->GetRenderViewHost(); |
| 698 GURL gcp_url(CloudPrintURL(BrowserList::GetLastActive()->profile()). |
| 699 GetCloudPrintServiceURL()); |
| 700 rvh->Send(new PrintMsg_PrintTeardownWhitelist(rvh->routing_id(), |
| 701 gcp_url.host())); |
596 Browser* preview_tab_browser = BrowserList::FindBrowserWithID( | 702 Browser* preview_tab_browser = BrowserList::FindBrowserWithID( |
597 preview_tab()->controller().window_id().id()); | 703 preview_tab()->controller().window_id().id()); |
598 if (!preview_tab_browser) | 704 if (!preview_tab_browser) |
599 return; | 705 return; |
600 TabStripModel* tabstrip = preview_tab_browser->tabstrip_model(); | 706 TabStripModel* tabstrip = preview_tab_browser->tabstrip_model(); |
601 | 707 |
602 // Keep print preview tab out of the recently closed tab list, because | 708 // Keep print preview tab out of the recently closed tab list, because |
603 // re-opening that page will just display a non-functional print preview page. | 709 // re-opening that page will just display a non-functional print preview page. |
604 tabstrip->CloseTabContentsAt(tabstrip->GetIndexOfController( | 710 tabstrip->CloseTabContentsAt(tabstrip->GetIndexOfController( |
605 &preview_tab()->controller()), TabStripModel::CLOSE_NONE); | 711 &preview_tab()->controller()), TabStripModel::CLOSE_NONE); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 if (initiator_tab) { | 776 if (initiator_tab) { |
671 // We no longer require the intiator tab details. Remove those details | 777 // We no longer require the intiator tab details. Remove those details |
672 // associated with the preview tab to allow the initiator tab to create | 778 // associated with the preview tab to allow the initiator tab to create |
673 // another preview tab. | 779 // another preview tab. |
674 printing::PrintPreviewTabController* tab_controller = | 780 printing::PrintPreviewTabController* tab_controller = |
675 printing::PrintPreviewTabController::GetInstance(); | 781 printing::PrintPreviewTabController::GetInstance(); |
676 if (tab_controller) | 782 if (tab_controller) |
677 tab_controller->EraseInitiatorTabInfo(preview_tab()); | 783 tab_controller->EraseInitiatorTabInfo(preview_tab()); |
678 } | 784 } |
679 } | 785 } |
OLD | NEW |