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_data_source.h" | 5 #include "chrome/browser/ui/webui/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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 AddLocalizedString("incrementTitle", IDS_PRINT_PREVIEW_INCREMENT_TITLE); | 116 AddLocalizedString("incrementTitle", IDS_PRINT_PREVIEW_INCREMENT_TITLE); |
117 AddLocalizedString("decrementTitle", IDS_PRINT_PREVIEW_DECREMENT_TITLE); | 117 AddLocalizedString("decrementTitle", IDS_PRINT_PREVIEW_DECREMENT_TITLE); |
118 AddLocalizedString("printPagesLabel", IDS_PRINT_PREVIEW_PRINT_PAGES_LABEL); | 118 AddLocalizedString("printPagesLabel", IDS_PRINT_PREVIEW_PRINT_PAGES_LABEL); |
119 AddLocalizedString("optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL); | 119 AddLocalizedString("optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL); |
120 AddLocalizedString("optionHeaderFooter", | 120 AddLocalizedString("optionHeaderFooter", |
121 IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER); | 121 IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER); |
122 AddLocalizedString("marginsLabel", IDS_PRINT_PREVIEW_MARGINS_LABEL); | 122 AddLocalizedString("marginsLabel", IDS_PRINT_PREVIEW_MARGINS_LABEL); |
123 AddLocalizedString("defaultMargins", IDS_PRINT_PREVIEW_DEFAULT_MARGINS); | 123 AddLocalizedString("defaultMargins", IDS_PRINT_PREVIEW_DEFAULT_MARGINS); |
124 AddLocalizedString("noMargins", IDS_PRINT_PREVIEW_NO_MARGINS); | 124 AddLocalizedString("noMargins", IDS_PRINT_PREVIEW_NO_MARGINS); |
125 AddLocalizedString("customMargins", IDS_PRINT_PREVIEW_CUSTOM_MARGINS); | 125 AddLocalizedString("customMargins", IDS_PRINT_PREVIEW_CUSTOM_MARGINS); |
| 126 AddLocalizedString("invalidMarginSettings", |
| 127 IDS_PRINT_PREVIEW_INVALID_MARGIN_SETTINGS); |
126 | 128 |
127 set_json_path("strings.js"); | 129 set_json_path("strings.js"); |
128 add_resource_path("print_preview.js", IDR_PRINT_PREVIEW_JS); | 130 add_resource_path("print_preview.js", IDR_PRINT_PREVIEW_JS); |
129 set_default_resource(IDR_PRINT_PREVIEW_HTML); | 131 set_default_resource(IDR_PRINT_PREVIEW_HTML); |
130 } | 132 } |
131 | 133 |
132 PrintPreviewDataSource::~PrintPreviewDataSource() { | 134 PrintPreviewDataSource::~PrintPreviewDataSource() { |
133 } | 135 } |
134 | 136 |
135 void PrintPreviewDataSource::StartDataRequest(const std::string& path, | 137 void PrintPreviewDataSource::StartDataRequest(const std::string& path, |
(...skipping 15 matching lines...) Expand all Loading... |
151 url_substr[0], page_index, &data); | 153 url_substr[0], page_index, &data); |
152 } | 154 } |
153 if (data.get()) { | 155 if (data.get()) { |
154 SendResponse(request_id, data); | 156 SendResponse(request_id, data); |
155 return; | 157 return; |
156 } | 158 } |
157 // Invalid request. | 159 // Invalid request. |
158 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); | 160 scoped_refptr<RefCountedBytes> empty_bytes(new RefCountedBytes); |
159 SendResponse(request_id, empty_bytes); | 161 SendResponse(request_id, empty_bytes); |
160 } | 162 } |
OLD | NEW |