| 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/printing/print_preview_message_handler.h" | 5 #include "chrome/browser/printing/print_preview_message_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // Inform the print preview tab of the failure. | 178 // Inform the print preview tab of the failure. |
| 179 TabContents* print_preview_tab = GetPrintPreviewTab(); | 179 TabContents* print_preview_tab = GetPrintPreviewTab(); |
| 180 // User might have closed it already. | 180 // User might have closed it already. |
| 181 if (!print_preview_tab) | 181 if (!print_preview_tab) |
| 182 return; | 182 return; |
| 183 | 183 |
| 184 TabContentsWrapper* wrapper = | 184 TabContentsWrapper* wrapper = |
| 185 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab); | 185 TabContentsWrapper::GetCurrentWrapperForContents(print_preview_tab); |
| 186 | 186 |
| 187 if (g_browser_process->background_printing_manager()-> | 187 if (g_browser_process->background_printing_manager()-> |
| 188 HasTabContents(wrapper)) { | 188 HasPreviewTabContents(wrapper)) { |
| 189 // Preview tab was hidden to serve the print request. | 189 // Preview tab was hidden to serve the print request. |
| 190 delete wrapper; | 190 delete wrapper; |
| 191 } else { | 191 } else { |
| 192 PrintPreviewUI* print_preview_ui = | 192 PrintPreviewUI* print_preview_ui = |
| 193 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); | 193 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); |
| 194 print_preview_ui->OnPrintPreviewFailed(); | 194 print_preview_ui->OnPrintPreviewFailed(); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 void PrintPreviewMessageHandler::OnDidGetDefaultPageLayout( | 198 void PrintPreviewMessageHandler::OnDidGetDefaultPageLayout( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 235 } |
| 236 | 236 |
| 237 void PrintPreviewMessageHandler::DidStartLoading() { | 237 void PrintPreviewMessageHandler::DidStartLoading() { |
| 238 if (tab_contents()->delegate() && | 238 if (tab_contents()->delegate() && |
| 239 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { | 239 printing::PrintPreviewTabController::IsPrintPreviewTab(tab_contents())) { |
| 240 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); | 240 tab_contents()->SetContentRestrictions(CONTENT_RESTRICTION_PRINT); |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace printing | 244 } // namespace printing |
| OLD | NEW |