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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 } | 820 } |
821 | 821 |
822 void PrintPreviewHandler::OnNavigation() { | 822 void PrintPreviewHandler::OnNavigation() { |
823 TabContents* initiator_tab = GetInitiatorTab(); | 823 TabContents* initiator_tab = GetInitiatorTab(); |
824 if (!initiator_tab) | 824 if (!initiator_tab) |
825 return; | 825 return; |
826 | 826 |
827 TabContentsWrapper* wrapper = | 827 TabContentsWrapper* wrapper = |
828 TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab); | 828 TabContentsWrapper::GetCurrentWrapperForContents(initiator_tab); |
829 wrapper->print_view_manager()->set_observer(NULL); | 829 wrapper->print_view_manager()->set_observer(NULL); |
| 830 |
| 831 // Tell the initiator tab to stop rendering the print preview, if any, |
| 832 // since the preview tab is gone. |
| 833 RenderViewHost* rvh = initiator_tab->render_view_host(); |
| 834 rvh->Send(new PrintMsg_AbortPreview(rvh->routing_id())); |
830 } | 835 } |
831 | 836 |
832 void PrintPreviewHandler::FileSelected(const FilePath& path, | 837 void PrintPreviewHandler::FileSelected(const FilePath& path, |
833 int index, void* params) { | 838 int index, void* params) { |
834 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_); | 839 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui_); |
835 scoped_refptr<RefCountedBytes> data(new RefCountedBytes()); | 840 scoped_refptr<RefCountedBytes> data(new RefCountedBytes()); |
836 print_preview_ui->GetPrintPreviewData(&data); | 841 print_preview_ui->GetPrintPreviewData(&data); |
837 if (!data->front()) { | 842 if (!data->front()) { |
838 NOTREACHED(); | 843 NOTREACHED(); |
839 return; | 844 return; |
(...skipping 30 matching lines...) Expand all Loading... |
870 return; | 875 return; |
871 | 876 |
872 // We no longer require the initiator tab details. Remove those details | 877 // We no longer require the initiator tab details. Remove those details |
873 // associated with the preview tab to allow the initiator tab to create | 878 // associated with the preview tab to allow the initiator tab to create |
874 // another preview tab. | 879 // another preview tab. |
875 printing::PrintPreviewTabController* tab_controller = | 880 printing::PrintPreviewTabController* tab_controller = |
876 printing::PrintPreviewTabController::GetInstance(); | 881 printing::PrintPreviewTabController::GetInstance(); |
877 if (tab_controller) | 882 if (tab_controller) |
878 tab_controller->EraseInitiatorTabInfo(preview_tab()); | 883 tab_controller->EraseInitiatorTabInfo(preview_tab()); |
879 } | 884 } |
OLD | NEW |