Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2604)

Unified Diff: chrome/browser/printing/print_job_worker.cc

Issue 329683002: Improvements in --debug-print switch implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Thu 06/12/2014 2:53:06.07 Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/printing/print_job.cc ('k') | chrome/browser/printing/print_view_manager_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_job_worker.cc
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
index 88ef3e9e5c16683ba7968f2b9bc51d97123ab22c..f79478514a8bdf88a652bd41d1936bd4af63a453 100644
--- a/chrome/browser/printing/print_job_worker.cc
+++ b/chrome/browser/printing/print_job_worker.cc
@@ -120,39 +120,19 @@ void PrintJobWorker::SetSettings(
DCHECK_EQ(message_loop(), base::MessageLoop::current());
BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&HoldRefCallback, make_scoped_refptr(owner_),
+ BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&HoldRefCallback,
+ make_scoped_refptr(owner_),
base::Bind(&PrintJobWorker::UpdatePrintSettings,
- base::Unretained(this), new_settings)));
+ base::Unretained(this),
+ base::Owned(new_settings))));
}
void PrintJobWorker::UpdatePrintSettings(
const base::DictionaryValue* const new_settings) {
- // Create new PageRanges based on |new_settings|.
- PageRanges new_ranges;
- const base::ListValue* page_range_array;
- if (new_settings->GetList(kSettingPageRange, &page_range_array)) {
- for (size_t index = 0; index < page_range_array->GetSize(); ++index) {
- const base::DictionaryValue* dict;
- if (!page_range_array->GetDictionary(index, &dict))
- continue;
-
- PageRange range;
- if (!dict->GetInteger(kSettingPageRangeFrom, &range.from) ||
- !dict->GetInteger(kSettingPageRangeTo, &range.to)) {
- continue;
- }
-
- // Page numbers are 1-based in the dictionary.
- // Page numbers are 0-based for the printing context.
- range.from--;
- range.to--;
- new_ranges.push_back(range);
- }
- }
PrintingContext::Result result =
- printing_context_->UpdatePrintSettings(*new_settings, new_ranges);
- delete new_settings;
+ printing_context_->UpdatePrintSettings(*new_settings);
GetSettingsDone(result);
}
@@ -272,8 +252,8 @@ void PrintJobWorker::OnNewPage() {
while (true) {
// Is the page available?
- scoped_refptr<PrintedPage> page;
- if (!document_->GetPage(page_number_.ToInt(), &page)) {
+ scoped_refptr<PrintedPage> page = document_->GetPage(page_number_.ToInt());
+ if (!page) {
// We need to wait for the page to be available.
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
« no previous file with comments | « chrome/browser/printing/print_job.cc ('k') | chrome/browser/printing/print_view_manager_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698