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/printing/print_job_worker.h" | 5 #include "chrome/browser/printing/print_job_worker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 BrowserThread::UI, FROM_HERE, | 115 BrowserThread::UI, FROM_HERE, |
116 base::Bind(&HoldRefCallback, make_scoped_refptr(owner_), | 116 base::Bind(&HoldRefCallback, make_scoped_refptr(owner_), |
117 base::Bind(&PrintJobWorker::UpdatePrintSettings, | 117 base::Bind(&PrintJobWorker::UpdatePrintSettings, |
118 base::Unretained(this), new_settings))); | 118 base::Unretained(this), new_settings))); |
119 } | 119 } |
120 | 120 |
121 void PrintJobWorker::UpdatePrintSettings( | 121 void PrintJobWorker::UpdatePrintSettings( |
122 const DictionaryValue* const new_settings) { | 122 const DictionaryValue* const new_settings) { |
123 // Create new PageRanges based on |new_settings|. | 123 // Create new PageRanges based on |new_settings|. |
124 PageRanges new_ranges; | 124 PageRanges new_ranges; |
125 ListValue* page_range_array; | 125 const ListValue* page_range_array; |
126 if (new_settings->GetList(kSettingPageRange, &page_range_array)) { | 126 if (new_settings->GetList(kSettingPageRange, &page_range_array)) { |
127 for (size_t index = 0; index < page_range_array->GetSize(); ++index) { | 127 for (size_t index = 0; index < page_range_array->GetSize(); ++index) { |
128 DictionaryValue* dict; | 128 DictionaryValue* dict; |
129 if (!page_range_array->GetDictionary(index, &dict)) | 129 if (!page_range_array->GetDictionary(index, &dict)) |
130 continue; | 130 continue; |
131 | 131 |
132 PageRange range; | 132 PageRange range; |
133 if (!dict->GetInteger(kSettingPageRangeFrom, &range.from) || | 133 if (!dict->GetInteger(kSettingPageRangeFrom, &range.from) || |
134 !dict->GetInteger(kSettingPageRangeTo, &range.to)) { | 134 !dict->GetInteger(kSettingPageRangeTo, &range.to)) { |
135 continue; | 135 continue; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 JobEventDetails::FAILED, document_, | 361 JobEventDetails::FAILED, document_, |
362 scoped_refptr<PrintedPage>())); | 362 scoped_refptr<PrintedPage>())); |
363 Cancel(); | 363 Cancel(); |
364 | 364 |
365 // Makes sure the variables are reinitialized. | 365 // Makes sure the variables are reinitialized. |
366 document_ = NULL; | 366 document_ = NULL; |
367 page_number_ = PageNumber::npos(); | 367 page_number_ = PageNumber::npos(); |
368 } | 368 } |
369 | 369 |
370 } // namespace printing | 370 } // namespace printing |
OLD | NEW |