| 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 <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 void PrintPreviewUI::OnHidePreviewDialog() { | 648 void PrintPreviewUI::OnHidePreviewDialog() { |
| 649 WebContents* preview_dialog = web_ui()->GetWebContents(); | 649 WebContents* preview_dialog = web_ui()->GetWebContents(); |
| 650 printing::BackgroundPrintingManager* background_printing_manager = | 650 printing::BackgroundPrintingManager* background_printing_manager = |
| 651 g_browser_process->background_printing_manager(); | 651 g_browser_process->background_printing_manager(); |
| 652 if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) | 652 if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) |
| 653 return; | 653 return; |
| 654 | 654 |
| 655 ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate(); | 655 ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate(); |
| 656 if (!delegate) | 656 if (!delegate) |
| 657 return; | 657 return; |
| 658 delegate->ReleaseWebContentsOnDialogClose(); | 658 std::unique_ptr<content::WebContents> preview_contents = |
| 659 background_printing_manager->OwnPrintPreviewDialog(preview_dialog); | 659 delegate->ReleaseWebContents(); |
| 660 DCHECK_EQ(preview_dialog, preview_contents.get()); |
| 661 background_printing_manager->OwnPrintPreviewDialog( |
| 662 preview_contents.release()); |
| 660 OnClosePrintPreviewDialog(); | 663 OnClosePrintPreviewDialog(); |
| 661 } | 664 } |
| 662 | 665 |
| 663 void PrintPreviewUI::OnClosePrintPreviewDialog() { | 666 void PrintPreviewUI::OnClosePrintPreviewDialog() { |
| 664 if (dialog_closed_) | 667 if (dialog_closed_) |
| 665 return; | 668 return; |
| 666 dialog_closed_ = true; | 669 dialog_closed_ = true; |
| 667 ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate(); | 670 ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate(); |
| 668 if (!delegate) | 671 if (!delegate) |
| 669 return; | 672 return; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 692 } | 695 } |
| 693 | 696 |
| 694 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { | 697 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { |
| 695 handler_->FileSelected(path, 0, NULL); | 698 handler_->FileSelected(path, 0, NULL); |
| 696 } | 699 } |
| 697 | 700 |
| 698 void PrintPreviewUI::SetPdfSavedClosureForTesting( | 701 void PrintPreviewUI::SetPdfSavedClosureForTesting( |
| 699 const base::Closure& closure) { | 702 const base::Closure& closure) { |
| 700 handler_->SetPdfSavedClosureForTesting(closure); | 703 handler_->SetPdfSavedClosureForTesting(closure); |
| 701 } | 704 } |
| OLD | NEW |