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

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

Issue 740983002: Implement window.print() on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle printing disabled or not supported Created 6 years 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
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/printer_query.h" 5 #include "chrome/browser/printing/printer_query.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/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 int expected_page_count, 68 int expected_page_count,
69 bool has_selection, 69 bool has_selection,
70 MarginType margin_type, 70 MarginType margin_type,
71 const base::Closure& callback) { 71 const base::Closure& callback) {
72 DCHECK(RunsTasksOnCurrentThread()); 72 DCHECK(RunsTasksOnCurrentThread());
73 DCHECK(!is_print_dialog_box_shown_); 73 DCHECK(!is_print_dialog_box_shown_);
74 74
75 StartWorker(callback); 75 StartWorker(callback);
76 76
77 // Real work is done in PrintJobWorker::GetSettings(). 77 // Real work is done in PrintJobWorker::GetSettings().
78 is_print_dialog_box_shown_ = ask_user_for_settings == ASK_USER;
79 worker_->PostTask(FROM_HERE, 78 worker_->PostTask(FROM_HERE,
80 base::Bind(&PrintJobWorker::GetSettings, 79 base::Bind(&PrintJobWorker::GetSettings,
81 base::Unretained(worker_.get()), 80 base::Unretained(worker_.get()),
82 is_print_dialog_box_shown_, 81 ask_user_for_settings,
83 expected_page_count, 82 expected_page_count,
84 has_selection, 83 has_selection,
85 margin_type)); 84 margin_type));
86 } 85 }
87 86
88 void PrinterQuery::SetSettings(scoped_ptr<base::DictionaryValue> new_settings, 87 void PrinterQuery::SetSettings(scoped_ptr<base::DictionaryValue> new_settings,
89 const base::Closure& callback) { 88 const base::Closure& callback) {
90 StartWorker(callback); 89 StartWorker(callback);
91 90
92 worker_->PostTask(FROM_HERE, 91 worker_->PostTask(FROM_HERE,
(...skipping 26 matching lines...) Expand all
119 118
120 bool PrinterQuery::is_callback_pending() const { 119 bool PrinterQuery::is_callback_pending() const {
121 return !callback_.is_null(); 120 return !callback_.is_null();
122 } 121 }
123 122
124 bool PrinterQuery::is_valid() const { 123 bool PrinterQuery::is_valid() const {
125 return worker_.get() != NULL; 124 return worker_.get() != NULL;
126 } 125 }
127 126
128 } // namespace printing 127 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698