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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // Inform the print preview tab of the failure. | 93 // Inform the print preview tab of the failure. |
94 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); | 94 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); |
95 // User might have closed it already. | 95 // User might have closed it already. |
96 if (!print_preview_tab || !print_preview_tab->web_ui()) | 96 if (!print_preview_tab || !print_preview_tab->web_ui()) |
97 return NULL; | 97 return NULL; |
98 | 98 |
99 return static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); | 99 return static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); |
100 } | 100 } |
101 | 101 |
102 void PrintPreviewMessageHandler::OnRequestPrintPreview() { | 102 void PrintPreviewMessageHandler::OnRequestPrintPreview( |
| 103 bool source_is_modifiable) { |
103 PrintPreviewTabController::PrintPreview(tab_contents_wrapper()); | 104 PrintPreviewTabController::PrintPreview(tab_contents_wrapper()); |
| 105 |
| 106 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); |
| 107 if (!print_preview_tab || !print_preview_tab->web_ui()) |
| 108 return; |
| 109 PrintPreviewUI* print_preview_ui = |
| 110 static_cast<PrintPreviewUI*>(print_preview_tab->web_ui()); |
| 111 print_preview_ui->SetSourceIsModifiable(source_is_modifiable); |
104 } | 112 } |
105 | 113 |
106 void PrintPreviewMessageHandler::OnDidGetPreviewPageCount( | 114 void PrintPreviewMessageHandler::OnDidGetPreviewPageCount( |
107 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { | 115 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { |
108 if (params.page_count <= 0) { | 116 if (params.page_count <= 0) { |
109 NOTREACHED(); | 117 NOTREACHED(); |
110 return; | 118 return; |
111 } | 119 } |
112 | 120 |
113 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); | 121 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 253 } |
246 | 254 |
247 void PrintPreviewMessageHandler::DidStartLoading() { | 255 void PrintPreviewMessageHandler::DidStartLoading() { |
248 if (tab_contents()->delegate() && | 256 if (tab_contents()->delegate() && |
249 PrintPreviewTabController::IsPrintPreviewTab(tab_contents_wrapper())) { | 257 PrintPreviewTabController::IsPrintPreviewTab(tab_contents_wrapper())) { |
250 tab_contents()->SetContentRestrictions(content::CONTENT_RESTRICTION_PRINT); | 258 tab_contents()->SetContentRestrictions(content::CONTENT_RESTRICTION_PRINT); |
251 } | 259 } |
252 } | 260 } |
253 | 261 |
254 } // namespace printing | 262 } // namespace printing |
OLD | NEW |