| 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/renderer/chrome_mock_render_thread.h" | 5 #include "chrome/renderer/chrome_mock_render_thread.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 !job_settings.GetInteger(printing::kSettingMarginsType, &margins_type)) { | 160 !job_settings.GetInteger(printing::kSettingMarginsType, &margins_type)) { |
| 161 return; | 161 return; |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Just return the default settings. | 164 // Just return the default settings. |
| 165 if (printer_.get()) { | 165 if (printer_.get()) { |
| 166 const ListValue* page_range_array; | 166 const ListValue* page_range_array; |
| 167 printing::PageRanges new_ranges; | 167 printing::PageRanges new_ranges; |
| 168 if (job_settings.GetList(printing::kSettingPageRange, &page_range_array)) { | 168 if (job_settings.GetList(printing::kSettingPageRange, &page_range_array)) { |
| 169 for (size_t index = 0; index < page_range_array->GetSize(); ++index) { | 169 for (size_t index = 0; index < page_range_array->GetSize(); ++index) { |
| 170 base::DictionaryValue* dict; | 170 const base::DictionaryValue* dict; |
| 171 if (!page_range_array->GetDictionary(index, &dict)) | 171 if (!page_range_array->GetDictionary(index, &dict)) |
| 172 continue; | 172 continue; |
| 173 printing::PageRange range; | 173 printing::PageRange range; |
| 174 if (!dict->GetInteger(printing::kSettingPageRangeFrom, &range.from) || | 174 if (!dict->GetInteger(printing::kSettingPageRangeFrom, &range.from) || |
| 175 !dict->GetInteger(printing::kSettingPageRangeTo, &range.to)) { | 175 !dict->GetInteger(printing::kSettingPageRangeTo, &range.to)) { |
| 176 continue; | 176 continue; |
| 177 } | 177 } |
| 178 // Page numbers are 1-based in the dictionary. | 178 // Page numbers are 1-based in the dictionary. |
| 179 // Page numbers are 0-based for the printing context. | 179 // Page numbers are 0-based for the printing context. |
| 180 range.from--; | 180 range.from--; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 191 print_dialog_user_response_ = response; | 191 print_dialog_user_response_ = response; |
| 192 } | 192 } |
| 193 | 193 |
| 194 void ChromeMockRenderThread::set_print_preview_cancel_page_number(int page) { | 194 void ChromeMockRenderThread::set_print_preview_cancel_page_number(int page) { |
| 195 print_preview_cancel_page_number_ = page; | 195 print_preview_cancel_page_number_ = page; |
| 196 } | 196 } |
| 197 | 197 |
| 198 int ChromeMockRenderThread::print_preview_pages_remaining() { | 198 int ChromeMockRenderThread::print_preview_pages_remaining() { |
| 199 return print_preview_pages_remaining_; | 199 return print_preview_pages_remaining_; |
| 200 } | 200 } |
| OLD | NEW |