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/ui/webui/print_preview/print_preview_data_source.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_data_source.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 AddLocalizedString("top", IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL); | 135 AddLocalizedString("top", IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL); |
136 AddLocalizedString("bottom", IDS_PRINT_PREVIEW_BOTTOM_MARGIN_LABEL); | 136 AddLocalizedString("bottom", IDS_PRINT_PREVIEW_BOTTOM_MARGIN_LABEL); |
137 AddLocalizedString("left", IDS_PRINT_PREVIEW_LEFT_MARGIN_LABEL); | 137 AddLocalizedString("left", IDS_PRINT_PREVIEW_LEFT_MARGIN_LABEL); |
138 AddLocalizedString("right", IDS_PRINT_PREVIEW_RIGHT_MARGIN_LABEL); | 138 AddLocalizedString("right", IDS_PRINT_PREVIEW_RIGHT_MARGIN_LABEL); |
139 | 139 |
140 set_json_path("strings.js"); | 140 set_json_path("strings.js"); |
141 if (is_dummy) { | 141 if (is_dummy) { |
142 set_default_resource(IDR_PRINT_PREVIEW_DUMMY_HTML); | 142 set_default_resource(IDR_PRINT_PREVIEW_DUMMY_HTML); |
143 } else { | 143 } else { |
144 add_resource_path("print_preview.js", IDR_PRINT_PREVIEW_JS); | 144 add_resource_path("print_preview.js", IDR_PRINT_PREVIEW_JS); |
| 145 add_resource_path("images/classic_printer_24.png", |
| 146 IDR_PRINT_PREVIEW_IMAGES_CLASSIC_PRINTER_24); |
| 147 add_resource_path("images/cloud_printer_24.png", |
| 148 IDR_PRINT_PREVIEW_IMAGES_CLOUD_PRINTER_24); |
| 149 add_resource_path("images/google_sponsored_printer_24.png", |
| 150 IDR_PRINT_PREVIEW_IMAGES_GOOGLE_SPONSORED_PRINTER_24); |
| 151 add_resource_path("images/classic_printer_32.png", |
| 152 IDR_PRINT_PREVIEW_IMAGES_CLASSIC_PRINTER_32); |
| 153 add_resource_path("images/cloud_printer_32.png", |
| 154 IDR_PRINT_PREVIEW_IMAGES_CLOUD_PRINTER_32); |
| 155 add_resource_path("images/google_sponsored_printer_32.png", |
| 156 IDR_PRINT_PREVIEW_IMAGES_GOOGLE_SPONSORED_PRINTER_32); |
145 set_default_resource(IDR_PRINT_PREVIEW_HTML); | 157 set_default_resource(IDR_PRINT_PREVIEW_HTML); |
146 } | 158 } |
147 } | 159 } |
148 | 160 |
149 PrintPreviewDataSource::~PrintPreviewDataSource() { | 161 PrintPreviewDataSource::~PrintPreviewDataSource() { |
150 } | 162 } |
151 | 163 |
152 void PrintPreviewDataSource::StartDataRequest(const std::string& path, | 164 void PrintPreviewDataSource::StartDataRequest(const std::string& path, |
153 bool is_incognito, | 165 bool is_incognito, |
154 int request_id) { | 166 int request_id) { |
(...skipping 13 matching lines...) Expand all Loading... |
168 url_substr[0], page_index, &data); | 180 url_substr[0], page_index, &data); |
169 } | 181 } |
170 if (data.get()) { | 182 if (data.get()) { |
171 SendResponse(request_id, data); | 183 SendResponse(request_id, data); |
172 return; | 184 return; |
173 } | 185 } |
174 // Invalid request. | 186 // Invalid request. |
175 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); | 187 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); |
176 SendResponse(request_id, empty_bytes); | 188 SendResponse(request_id, empty_bytes); |
177 } | 189 } |
OLD | NEW |