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) { | |
104 PrintPreviewTabController::PrintPreview(tab_contents_wrapper()); | 103 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); | |
112 } | 104 } |
113 | 105 |
114 void PrintPreviewMessageHandler::OnDidGetPreviewPageCount( | 106 void PrintPreviewMessageHandler::OnDidGetPreviewPageCount( |
115 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { | 107 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { |
116 if (params.page_count <= 0) { | 108 if (params.page_count <= 0) { |
117 NOTREACHED(); | 109 NOTREACHED(); |
118 return; | 110 return; |
119 } | 111 } |
120 | 112 |
121 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); | 113 TabContentsWrapper* print_preview_tab = GetPrintPreviewTab(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 245 } |
254 | 246 |
255 void PrintPreviewMessageHandler::DidStartLoading() { | 247 void PrintPreviewMessageHandler::DidStartLoading() { |
256 if (tab_contents()->delegate() && | 248 if (tab_contents()->delegate() && |
257 PrintPreviewTabController::IsPrintPreviewTab(tab_contents_wrapper())) { | 249 PrintPreviewTabController::IsPrintPreviewTab(tab_contents_wrapper())) { |
258 tab_contents()->SetContentRestrictions(content::CONTENT_RESTRICTION_PRINT); | 250 tab_contents()->SetContentRestrictions(content::CONTENT_RESTRICTION_PRINT); |
259 } | 251 } |
260 } | 252 } |
261 | 253 |
262 } // namespace printing | 254 } // namespace printing |
OLD | NEW |