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/ui/webui/print_preview_ui.h" | 5 #include "chrome/browser/ui/webui/print_preview_ui.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 preview_ui_addr_str_); | 109 preview_ui_addr_str_); |
110 } | 110 } |
111 | 111 |
112 void PrintPreviewUI::SetInitiatorTabURLAndTitle( | 112 void PrintPreviewUI::SetInitiatorTabURLAndTitle( |
113 const std::string& initiator_url, | 113 const std::string& initiator_url, |
114 const string16& job_title) { | 114 const string16& job_title) { |
115 initiator_url_ = initiator_url; | 115 initiator_url_ = initiator_url; |
116 initiator_tab_title_ = job_title; | 116 initiator_tab_title_ = job_title; |
117 } | 117 } |
118 | 118 |
| 119 void PrintPreviewUI::SetSourceIsModifiable(bool source_is_modifiable) { |
| 120 source_is_modifiable_ = source_is_modifiable; |
| 121 } |
| 122 |
119 // static | 123 // static |
120 void PrintPreviewUI::GetCurrentPrintPreviewStatus( | 124 void PrintPreviewUI::GetCurrentPrintPreviewStatus( |
121 const std::string& preview_ui_addr, | 125 const std::string& preview_ui_addr, |
122 int request_id, | 126 int request_id, |
123 bool* cancel) { | 127 bool* cancel) { |
124 int current_id = -1; | 128 int current_id = -1; |
125 if (!g_print_preview_request_id_map.Get().Get(preview_ui_addr, ¤t_id)) { | 129 if (!g_print_preview_request_id_map.Get().Get(preview_ui_addr, ¤t_id)) { |
126 *cancel = true; | 130 *cancel = true; |
127 return; | 131 return; |
128 } | 132 } |
(...skipping 23 matching lines...) Expand all Loading... |
152 } | 156 } |
153 | 157 |
154 void PrintPreviewUI::OnShowSystemDialog() { | 158 void PrintPreviewUI::OnShowSystemDialog() { |
155 CallJavascriptFunction("onSystemDialogLinkClicked"); | 159 CallJavascriptFunction("onSystemDialogLinkClicked"); |
156 } | 160 } |
157 | 161 |
158 void PrintPreviewUI::OnDidGetPreviewPageCount( | 162 void PrintPreviewUI::OnDidGetPreviewPageCount( |
159 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { | 163 const PrintHostMsg_DidGetPreviewPageCount_Params& params) { |
160 DCHECK_GT(params.page_count, 0); | 164 DCHECK_GT(params.page_count, 0); |
161 base::FundamentalValue count(params.page_count); | 165 base::FundamentalValue count(params.page_count); |
162 base::FundamentalValue modifiable(params.is_modifiable); | |
163 base::FundamentalValue request_id(params.preview_request_id); | 166 base::FundamentalValue request_id(params.preview_request_id); |
164 CallJavascriptFunction("onDidGetPreviewPageCount", count, modifiable, | 167 CallJavascriptFunction("onDidGetPreviewPageCount", count,request_id); |
165 request_id); | |
166 } | 168 } |
167 | 169 |
168 void PrintPreviewUI::OnDidGetDefaultPageLayout( | 170 void PrintPreviewUI::OnDidGetDefaultPageLayout( |
169 const PageSizeMargins& page_layout) { | 171 const PageSizeMargins& page_layout) { |
170 if (page_layout.margin_top < 0 || page_layout.margin_left < 0 || | 172 if (page_layout.margin_top < 0 || page_layout.margin_left < 0 || |
171 page_layout.margin_bottom < 0 || page_layout.margin_right < 0 || | 173 page_layout.margin_bottom < 0 || page_layout.margin_right < 0 || |
172 page_layout.content_width < 0 || page_layout.content_height < 0) { | 174 page_layout.content_width < 0 || page_layout.content_height < 0) { |
173 NOTREACHED(); | 175 NOTREACHED(); |
174 return; | 176 return; |
175 } | 177 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 CallJavascriptFunction("printPreviewFailed"); | 238 CallJavascriptFunction("printPreviewFailed"); |
237 } | 239 } |
238 | 240 |
239 void PrintPreviewUI::OnInvalidPrinterSettings() { | 241 void PrintPreviewUI::OnInvalidPrinterSettings() { |
240 CallJavascriptFunction("invalidPrinterSettings"); | 242 CallJavascriptFunction("invalidPrinterSettings"); |
241 } | 243 } |
242 | 244 |
243 PrintPreviewDataService* PrintPreviewUI::print_preview_data_service() { | 245 PrintPreviewDataService* PrintPreviewUI::print_preview_data_service() { |
244 return PrintPreviewDataService::GetInstance(); | 246 return PrintPreviewDataService::GetInstance(); |
245 } | 247 } |
OLD | NEW |