| 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/base64.h" |
| 10 #if !defined(OS_CHROMEOS) | 10 #if !defined(OS_CHROMEOS) |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 } | 923 } |
| 924 | 924 |
| 925 void PrintPreviewHandler::FileSelectionCanceled(void* params) { | 925 void PrintPreviewHandler::FileSelectionCanceled(void* params) { |
| 926 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_); | 926 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_); |
| 927 print_preview_ui->OnFileSelectionCancelled(); | 927 print_preview_ui->OnFileSelectionCancelled(); |
| 928 } | 928 } |
| 929 | 929 |
| 930 void PrintPreviewHandler::HidePreviewTab() { | 930 void PrintPreviewHandler::HidePreviewTab() { |
| 931 TabContentsWrapper* preview_tab_wrapper = | 931 TabContentsWrapper* preview_tab_wrapper = |
| 932 TabContentsWrapper::GetCurrentWrapperForContents(preview_tab()); | 932 TabContentsWrapper::GetCurrentWrapperForContents(preview_tab()); |
| 933 if (GetBackgroundPrintingManager()->HasTabContents(preview_tab_wrapper)) | 933 if (GetBackgroundPrintingManager()->HasPreviewTabContents( |
| 934 preview_tab_wrapper)) |
| 934 return; | 935 return; |
| 935 GetBackgroundPrintingManager()->OwnTabContents(preview_tab_wrapper); | 936 |
| 937 GetBackgroundPrintingManager()->OwnPreviewTabContents(preview_tab_wrapper); |
| 936 } | 938 } |
| 937 | 939 |
| 938 void PrintPreviewHandler::ClearInitiatorTabDetails() { | 940 void PrintPreviewHandler::ClearInitiatorTabDetails() { |
| 939 TabContents* initiator_tab = GetInitiatorTab(); | 941 TabContents* initiator_tab = GetInitiatorTab(); |
| 940 if (!initiator_tab) | 942 if (!initiator_tab) |
| 941 return; | 943 return; |
| 942 | 944 |
| 943 // We no longer require the initiator tab details. Remove those details | 945 // We no longer require the initiator tab details. Remove those details |
| 944 // associated with the preview tab to allow the initiator tab to create | 946 // associated with the preview tab to allow the initiator tab to create |
| 945 // another preview tab. | 947 // another preview tab. |
| 946 printing::PrintPreviewTabController* tab_controller = | 948 printing::PrintPreviewTabController* tab_controller = |
| 947 printing::PrintPreviewTabController::GetInstance(); | 949 printing::PrintPreviewTabController::GetInstance(); |
| 948 if (tab_controller) | 950 if (tab_controller) { |
| 951 TabContentsWrapper* initiator_wrapper = |
| 952 TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab); |
| 949 tab_controller->EraseInitiatorTabInfo(preview_tab()); | 953 tab_controller->EraseInitiatorTabInfo(preview_tab()); |
| 954 GetBackgroundPrintingManager()->ReleaseInitiatorTabContents( |
| 955 initiator_wrapper); |
| 956 } |
| 950 } | 957 } |
| OLD | NEW |