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

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

Issue 8201027: Move margin processing code to the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/printer_query.h" 5 #include "chrome/browser/printing/printer_query.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/threading/thread_restrictions.h" 8 #include "base/threading/thread_restrictions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/printing/print_job_worker.h" 10 #include "chrome/browser/printing/print_job_worker.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 int PrinterQuery::cookie() const { 70 int PrinterQuery::cookie() const {
71 return cookie_; 71 return cookie_;
72 } 72 }
73 73
74 void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings, 74 void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings,
75 gfx::NativeView parent_view, 75 gfx::NativeView parent_view,
76 int expected_page_count, 76 int expected_page_count,
77 bool has_selection, 77 bool has_selection,
78 bool use_overlays, 78 MarginType margin_type,
79 CancelableTask* callback) { 79 CancelableTask* callback) {
80 DCHECK_EQ(io_message_loop_, MessageLoop::current()); 80 DCHECK_EQ(io_message_loop_, MessageLoop::current());
81 DCHECK(!is_print_dialog_box_shown_); 81 DCHECK(!is_print_dialog_box_shown_);
82 if (!StartWorker(callback)) 82 if (!StartWorker(callback))
83 return; 83 return;
84 84
85 // Real work is done in PrintJobWorker::Init(). 85 // Real work is done in PrintJobWorker::Init().
86 is_print_dialog_box_shown_ = ask_user_for_settings == ASK_USER; 86 is_print_dialog_box_shown_ = ask_user_for_settings == ASK_USER;
87 worker_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( 87 worker_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
88 worker_.get(), 88 worker_.get(),
89 &PrintJobWorker::GetSettings, 89 &PrintJobWorker::GetSettings,
90 is_print_dialog_box_shown_, 90 is_print_dialog_box_shown_,
91 parent_view, 91 parent_view,
92 expected_page_count, 92 expected_page_count,
93 has_selection, 93 has_selection,
94 use_overlays)); 94 margin_type));
95 } 95 }
96 96
97 void PrinterQuery::SetSettings(const DictionaryValue& new_settings, 97 void PrinterQuery::SetSettings(const DictionaryValue& new_settings,
98 CancelableTask* callback) { 98 CancelableTask* callback) {
99 if (!StartWorker(callback)) 99 if (!StartWorker(callback))
100 return; 100 return;
101 101
102 worker_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( 102 worker_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
103 worker_.get(), 103 worker_.get(),
104 &PrintJobWorker::SetSettings, 104 &PrintJobWorker::SetSettings,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 bool PrinterQuery::is_callback_pending() const { 140 bool PrinterQuery::is_callback_pending() const {
141 return callback_.get() != NULL; 141 return callback_.get() != NULL;
142 } 142 }
143 143
144 bool PrinterQuery::is_valid() const { 144 bool PrinterQuery::is_valid() const {
145 return worker_.get() != NULL; 145 return worker_.get() != NULL;
146 } 146 }
147 147
148 } // namespace printing 148 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/printer_query.h ('k') | chrome/browser/printing/printing_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698