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

Side by Side Diff: printing/printing_context_win.cc

Issue 740983002: Implement window.print() on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « printing/printing_context_win.h ('k') | printing/printing_context_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "printing/printing_context_win.h" 5 #include "printing/printing_context_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 : PrintingContext(delegate), context_(NULL) { 47 : PrintingContext(delegate), context_(NULL) {
48 } 48 }
49 49
50 PrintingContextWin::~PrintingContextWin() { 50 PrintingContextWin::~PrintingContextWin() {
51 ReleaseContext(); 51 ReleaseContext();
52 } 52 }
53 53
54 void PrintingContextWin::AskUserForSettings( 54 void PrintingContextWin::AskUserForSettings(
55 int max_pages, 55 int max_pages,
56 bool has_selection, 56 bool has_selection,
57 bool is_scripted,
57 const PrintSettingsCallback& callback) { 58 const PrintSettingsCallback& callback) {
58 NOTIMPLEMENTED(); 59 NOTIMPLEMENTED();
59 } 60 }
60 61
61 PrintingContext::Result PrintingContextWin::UseDefaultSettings() { 62 PrintingContext::Result PrintingContextWin::UseDefaultSettings() {
62 DCHECK(!in_print_job_); 63 DCHECK(!in_print_job_);
63 64
64 scoped_refptr<PrintBackend> backend = PrintBackend::CreateInstance(NULL); 65 scoped_refptr<PrintBackend> backend = PrintBackend::CreateInstance(NULL);
65 base::string16 default_printer = 66 base::string16 default_printer =
66 base::UTF8ToWide(backend->GetDefaultPrinterName()); 67 base::UTF8ToWide(backend->GetDefaultPrinterName());
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 dev_mode->dmFields |= DM_PAPERWIDTH; 202 dev_mode->dmFields |= DM_PAPERWIDTH;
202 dev_mode->dmPaperWidth = width; 203 dev_mode->dmPaperWidth = width;
203 dev_mode->dmFields |= DM_PAPERLENGTH; 204 dev_mode->dmFields |= DM_PAPERLENGTH;
204 dev_mode->dmPaperLength = height; 205 dev_mode->dmPaperLength = height;
205 } 206 }
206 } 207 }
207 208
208 // Update data using DocumentProperties. 209 // Update data using DocumentProperties.
209 if (show_system_dialog) { 210 if (show_system_dialog) {
210 PrintingContext::Result result = PrintingContext::FAILED; 211 PrintingContext::Result result = PrintingContext::FAILED;
211 AskUserForSettings(0, false, base::Bind(&AssingResult, &result)); 212 AskUserForSettings(0, false, false, base::Bind(&AssingResult, &result));
212 return result; 213 return result;
213 } else { 214 } else {
214 scoped_dev_mode = CreateDevMode(printer.Get(), scoped_dev_mode.get()); 215 scoped_dev_mode = CreateDevMode(printer.Get(), scoped_dev_mode.get());
215 } 216 }
216 // Set printer then refresh printer settings. 217 // Set printer then refresh printer settings.
217 return InitializeSettings(settings_.device_name(), scoped_dev_mode.get()); 218 return InitializeSettings(settings_.device_name(), scoped_dev_mode.get());
218 } 219 }
219 220
220 PrintingContext::Result PrintingContextWin::InitWithSettings( 221 PrintingContext::Result PrintingContextWin::InitWithSettings(
221 const PrintSettings& settings) { 222 const PrintSettings& settings) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 400
400 if (canceled) { 401 if (canceled) {
401 result.reset(); 402 result.reset();
402 abort_printing_ = true; 403 abort_printing_ = true;
403 } 404 }
404 405
405 return result.Pass(); 406 return result.Pass();
406 } 407 }
407 408
408 } // namespace printing 409 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printing_context_win.h ('k') | printing/printing_context_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698