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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // User might have closed it already. | 93 // User might have closed it already. |
94 if (!print_preview_tab || !print_preview_tab->web_ui()) | 94 if (!print_preview_tab || !print_preview_tab->web_ui()) |
95 return NULL; | 95 return NULL; |
96 | 96 |
97 return static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); | 97 return static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); |
98 } | 98 } |
99 | 99 |
100 void PrintPreviewMessageHandler::OnRequestPrintPreview( | 100 void PrintPreviewMessageHandler::OnRequestPrintPreview( |
101 bool source_is_modifiable) { | 101 bool source_is_modifiable) { |
102 PrintPreviewTabController::PrintPreview(tab_contents_wrapper()); | 102 PrintPreviewTabController::PrintPreview(tab_contents_wrapper()); |
103 | 103 PrintPreviewUI::SetSourceIsModifiable(GetPrintPreviewTab(), |
104 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); | 104 source_is_modifiable); |
105 if (!print_preview_tab || !print_preview_tab->web_ui()) | |
106 return; | |
107 PrintPreviewUI* print_preview_ui = | |
108 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); | |
109 print_preview_ui->SetSourceIsModifiable(source_is_modifiable); | |
110 } | 105 } |
111 | 106 |
112 void PrintPreviewMessageHandler::OnDidGetPreviewPageCount( | 107 void PrintPreviewMessageHandler::OnDidGetPreviewPageCount( |
113 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { | 108 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { |
114 if (params.page_count <= 0) { | 109 if (params.page_count <= 0) { |
115 NOTREACHED(); | 110 NOTREACHED(); |
116 return; | 111 return; |
117 } | 112 } |
118 | 113 |
119 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); | 114 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 return; | 255 return; |
261 } | 256 } |
262 // If |tab| is navigating and it has a print preview tab, notify |tab| to | 257 // 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 | 258 // consider print preview done so it unfreezes the renderer in the case of |
264 // window.print(). | 259 // window.print(). |
265 if (preview_tab) | 260 if (preview_tab) |
266 tab->print_view_manager()->PrintPreviewDone(); | 261 tab->print_view_manager()->PrintPreviewDone(); |
267 } | 262 } |
268 | 263 |
269 } // namespace printing | 264 } // namespace printing |
OLD | NEW |