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_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (settings->empty()) { | 158 if (settings->empty()) { |
159 NOTREACHED() << "Print job settings dictionary is empty"; | 159 NOTREACHED() << "Print job settings dictionary is empty"; |
160 return NULL; | 160 return NULL; |
161 } | 161 } |
162 | 162 |
163 return settings.release(); | 163 return settings.release(); |
164 } | 164 } |
165 | 165 |
166 int GetPageCountFromSettingsDictionary(const DictionaryValue& settings) { | 166 int GetPageCountFromSettingsDictionary(const DictionaryValue& settings) { |
167 int count = 0; | 167 int count = 0; |
168 ListValue* page_range_array; | 168 const ListValue* page_range_array; |
169 if (settings.GetList(printing::kSettingPageRange, &page_range_array)) { | 169 if (settings.GetList(printing::kSettingPageRange, &page_range_array)) { |
170 for (size_t index = 0; index < page_range_array->GetSize(); ++index) { | 170 for (size_t index = 0; index < page_range_array->GetSize(); ++index) { |
171 DictionaryValue* dict; | 171 DictionaryValue* dict; |
172 if (!page_range_array->GetDictionary(index, &dict)) | 172 if (!page_range_array->GetDictionary(index, &dict)) |
173 continue; | 173 continue; |
174 | 174 |
175 printing::PageRange range; | 175 printing::PageRange range; |
176 if (!dict->GetInteger(printing::kSettingPageRangeFrom, &range.from) || | 176 if (!dict->GetInteger(printing::kSettingPageRangeFrom, &range.from) || |
177 !dict->GetInteger(printing::kSettingPageRangeTo, &range.to)) { | 177 !dict->GetInteger(printing::kSettingPageRangeTo, &range.to)) { |
178 continue; | 178 continue; |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 return; | 930 return; |
931 | 931 |
932 // We no longer require the initiator tab details. Remove those details | 932 // We no longer require the initiator tab details. Remove those details |
933 // associated with the preview tab to allow the initiator tab to create | 933 // associated with the preview tab to allow the initiator tab to create |
934 // another preview tab. | 934 // another preview tab. |
935 printing::PrintPreviewTabController* tab_controller = | 935 printing::PrintPreviewTabController* tab_controller = |
936 printing::PrintPreviewTabController::GetInstance(); | 936 printing::PrintPreviewTabController::GetInstance(); |
937 if (tab_controller) | 937 if (tab_controller) |
938 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); | 938 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); |
939 } | 939 } |
OLD | NEW |