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

Side by Side Diff: chrome/browser/printing/print_job_worker.cc

Issue 480303002: Use document from preview for System Dialog printing on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tue 08/19/2014 11:17:57.84 Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } else { 107 } else {
108 BrowserThread::PostTask( 108 BrowserThread::PostTask(
109 BrowserThread::UI, FROM_HERE, 109 BrowserThread::UI, FROM_HERE,
110 base::Bind(&HoldRefCallback, make_scoped_refptr(owner_), 110 base::Bind(&HoldRefCallback, make_scoped_refptr(owner_),
111 base::Bind(&PrintJobWorker::UseDefaultSettings, 111 base::Bind(&PrintJobWorker::UseDefaultSettings,
112 base::Unretained(this)))); 112 base::Unretained(this))));
113 } 113 }
114 } 114 }
115 115
116 void PrintJobWorker::SetSettings( 116 void PrintJobWorker::SetSettings(
117 const base::DictionaryValue* const new_settings) { 117 scoped_ptr<PrintingUIWebContentsObserver> web_contents_observer,
118 scoped_ptr<base::DictionaryValue> new_settings) {
118 DCHECK(task_runner_->RunsTasksOnCurrentThread()); 119 DCHECK(task_runner_->RunsTasksOnCurrentThread());
119 120
120 BrowserThread::PostTask( 121 BrowserThread::PostTask(
121 BrowserThread::UI, 122 BrowserThread::UI,
122 FROM_HERE, 123 FROM_HERE,
123 base::Bind(&HoldRefCallback, 124 base::Bind(&HoldRefCallback,
124 make_scoped_refptr(owner_), 125 make_scoped_refptr(owner_),
125 base::Bind(&PrintJobWorker::UpdatePrintSettings, 126 base::Bind(&PrintJobWorker::UpdatePrintSettings,
126 base::Unretained(this), 127 base::Unretained(this),
127 base::Owned(new_settings)))); 128 base::Passed(&web_contents_observer),
129 base::Passed(&new_settings))));
128 } 130 }
129 131
130 void PrintJobWorker::UpdatePrintSettings( 132 void PrintJobWorker::UpdatePrintSettings(
131 const base::DictionaryValue* const new_settings) { 133 scoped_ptr<PrintingUIWebContentsObserver> web_contents_observer,
132 PrintingContext::Result result = 134 scoped_ptr<base::DictionaryValue> new_settings) {
133 printing_context_->UpdatePrintSettings(*new_settings); 135 DCHECK_CURRENTLY_ON(BrowserThread::UI);
136 PrintingContext::Result result = printing_context_->UpdatePrintSettings(
137 *new_settings,
138 web_contents_observer ? web_contents_observer->GetParentView() : NULL);
134 GetSettingsDone(result); 139 GetSettingsDone(result);
135 } 140 }
136 141
137 void PrintJobWorker::GetSettingsDone(PrintingContext::Result result) { 142 void PrintJobWorker::GetSettingsDone(PrintingContext::Result result) {
138 // Most PrintingContext functions may start a message loop and process 143 // Most PrintingContext functions may start a message loop and process
139 // message recursively, so disable recursive task processing. 144 // message recursively, so disable recursive task processing.
140 // TODO(thestig): See above comment. SetNestableTasksAllowed(false) needs to 145 // TODO(thestig): See above comment. SetNestableTasksAllowed(false) needs to
141 // be called on the same thread as the previous call. See 146 // be called on the same thread as the previous call. See
142 // http://crbug.com/73466 147 // http://crbug.com/73466
143 // MessageLoop::current()->SetNestableTasksAllowed(false); 148 // MessageLoop::current()->SetNestableTasksAllowed(false);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 document_, 394 document_,
390 scoped_refptr<PrintedPage>())); 395 scoped_refptr<PrintedPage>()));
391 Cancel(); 396 Cancel();
392 397
393 // Makes sure the variables are reinitialized. 398 // Makes sure the variables are reinitialized.
394 document_ = NULL; 399 document_ = NULL;
395 page_number_ = PageNumber::npos(); 400 page_number_ = PageNumber::npos();
396 } 401 }
397 402
398 } // namespace printing 403 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698