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/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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 TabContents* PrintPreviewMessageHandler::GetPrintPreviewTab() { | 77 TabContents* PrintPreviewMessageHandler::GetPrintPreviewTab() { |
78 PrintPreviewTabController* tab_controller = | 78 PrintPreviewTabController* tab_controller = |
79 PrintPreviewTabController::GetInstance(); | 79 PrintPreviewTabController::GetInstance(); |
80 if (!tab_controller) | 80 if (!tab_controller) |
81 return NULL; | 81 return NULL; |
82 | 82 |
83 return tab_controller->GetPrintPreviewForTab(tab_contents()); | 83 return tab_controller->GetPrintPreviewForTab(tab_contents()); |
84 } | 84 } |
85 | 85 |
86 TabContents* PrintPreviewMessageHandler::tab_contents() { | 86 TabContents* PrintPreviewMessageHandler::tab_contents() { |
87 return TabContents::GetCurrentWrapperForContents(web_contents()); | 87 return TabContents::FromWebContents(web_contents()); |
88 } | 88 } |
89 | 89 |
90 PrintPreviewUI* PrintPreviewMessageHandler::GetPrintPreviewUI() { | 90 PrintPreviewUI* PrintPreviewMessageHandler::GetPrintPreviewUI() { |
91 TabContents* tab = GetPrintPreviewTab(); | 91 TabContents* tab = GetPrintPreviewTab(); |
92 if (!tab || !tab->web_contents()->GetWebUI()) | 92 if (!tab || !tab->web_contents()->GetWebUI()) |
93 return NULL; | 93 return NULL; |
94 return static_cast<PrintPreviewUI*>( | 94 return static_cast<PrintPreviewUI*>( |
95 tab->web_contents()->GetWebUI()->GetController()); | 95 tab->web_contents()->GetWebUI()->GetController()); |
96 } | 96 } |
97 | 97 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 return; | 260 return; |
261 } | 261 } |
262 // If |tab| is navigating and it has a print preview tab, notify |tab| to | 262 // If |tab| is navigating and it has a print preview tab, notify |tab| to |
263 // consider print preview done so it unfreezes the renderer in the case of | 263 // consider print preview done so it unfreezes the renderer in the case of |
264 // window.print(). | 264 // window.print(). |
265 if (preview_tab) | 265 if (preview_tab) |
266 tab->print_view_manager()->PrintPreviewDone(); | 266 tab->print_view_manager()->PrintPreviewDone(); |
267 } | 267 } |
268 | 268 |
269 } // namespace printing | 269 } // namespace printing |
OLD | NEW |