OLD | NEW |
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_ui.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 g_browser_process->background_printing_manager(); | 529 g_browser_process->background_printing_manager(); |
530 if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) | 530 if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) |
531 return; | 531 return; |
532 OnClosePrintPreviewDialog(); | 532 OnClosePrintPreviewDialog(); |
533 } | 533 } |
534 | 534 |
535 void PrintPreviewUI::OnInitiatorClosed() { | 535 void PrintPreviewUI::OnInitiatorClosed() { |
536 WebContents* preview_dialog = web_ui()->GetWebContents(); | 536 WebContents* preview_dialog = web_ui()->GetWebContents(); |
537 printing::BackgroundPrintingManager* background_printing_manager = | 537 printing::BackgroundPrintingManager* background_printing_manager = |
538 g_browser_process->background_printing_manager(); | 538 g_browser_process->background_printing_manager(); |
539 if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) | 539 if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) { |
540 web_ui()->CallJavascriptFunctionUnsafe("cancelPendingPrintRequest"); | 540 background_printing_manager->OnPrintRequestCancelled(preview_dialog); |
541 else | 541 handler_->HandleCancelPendingPrintRequest(nullptr); |
| 542 } else { |
542 OnClosePrintPreviewDialog(); | 543 OnClosePrintPreviewDialog(); |
| 544 } |
543 } | 545 } |
544 | 546 |
545 void PrintPreviewUI::OnPrintPreviewCancelled() { | 547 void PrintPreviewUI::OnPrintPreviewCancelled() { |
546 handler_->OnPrintPreviewCancelled(); | 548 handler_->OnPrintPreviewCancelled(); |
547 } | 549 } |
548 | 550 |
549 void PrintPreviewUI::OnPrintPreviewRequest(int request_id) { | 551 void PrintPreviewUI::OnPrintPreviewRequest(int request_id) { |
550 if (!initial_preview_start_time_.is_null()) { | 552 if (!initial_preview_start_time_.is_null()) { |
551 UMA_HISTOGRAM_TIMES("PrintPreview.InitializationTime", | 553 UMA_HISTOGRAM_TIMES("PrintPreview.InitializationTime", |
552 base::TimeTicks::Now() - initial_preview_start_time_); | 554 base::TimeTicks::Now() - initial_preview_start_time_); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 } | 690 } |
689 | 691 |
690 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { | 692 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { |
691 handler_->FileSelected(path, 0, NULL); | 693 handler_->FileSelected(path, 0, NULL); |
692 } | 694 } |
693 | 695 |
694 void PrintPreviewUI::SetPdfSavedClosureForTesting( | 696 void PrintPreviewUI::SetPdfSavedClosureForTesting( |
695 const base::Closure& closure) { | 697 const base::Closure& closure) { |
696 handler_->SetPdfSavedClosureForTesting(closure); | 698 handler_->SetPdfSavedClosureForTesting(closure); |
697 } | 699 } |
OLD | NEW |