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

Side by Side Diff: printing/printing_context_win.cc

Issue 2714073002: Eliminate PS printing edge cases (Closed)
Patch Set: Fix compile errors Created 3 years, 9 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
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 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 CancelDC(context_); 317 CancelDC(context_);
318 } 318 }
319 319
320 void PrintingContextWin::ReleaseContext() { 320 void PrintingContextWin::ReleaseContext() {
321 if (context_) { 321 if (context_) {
322 DeleteDC(context_); 322 DeleteDC(context_);
323 context_ = nullptr; 323 context_ = nullptr;
324 } 324 }
325 } 325 }
326 326
327 void PrintingContextWin::SetPostScriptEnabled(bool is_enabled) {
328 is_postscript_enabled_ = is_enabled;
329 }
330
327 skia::NativeDrawingContext PrintingContextWin::context() const { 331 skia::NativeDrawingContext PrintingContextWin::context() const {
328 return context_; 332 return context_;
329 } 333 }
330 334
331 // static 335 // static
332 BOOL PrintingContextWin::AbortProc(HDC hdc, int nCode) { 336 BOOL PrintingContextWin::AbortProc(HDC hdc, int nCode) {
333 if (nCode) { 337 if (nCode) {
334 // TODO(maruel): Need a way to find the right instance to set. Should 338 // TODO(maruel): Need a way to find the right instance to set. Should
335 // leverage PrintJobManager here? 339 // leverage PrintJobManager here?
336 // abort_printing_ = true; 340 // abort_printing_ = true;
(...skipping 10 matching lines...) Expand all
347 ReleaseContext(); 351 ReleaseContext();
348 context_ = CreateDC(L"WINSPOOL", device_name.c_str(), nullptr, dev_mode); 352 context_ = CreateDC(L"WINSPOOL", device_name.c_str(), nullptr, dev_mode);
349 if (!context_) 353 if (!context_)
350 return OnError(); 354 return OnError();
351 355
352 skia::InitializeDC(context_); 356 skia::InitializeDC(context_);
353 357
354 DCHECK(!in_print_job_); 358 DCHECK(!in_print_job_);
355 settings_.set_device_name(device_name); 359 settings_.set_device_name(device_name);
356 PrintSettingsInitializerWin::InitPrintSettings( 360 PrintSettingsInitializerWin::InitPrintSettings(
357 context_, *dev_mode, &settings_); 361 context_, *dev_mode, &settings_, postscript_enabled());
358 362
359 return OK; 363 return OK;
360 } 364 }
361 365
362 HWND PrintingContextWin::GetRootWindow(gfx::NativeView view) { 366 HWND PrintingContextWin::GetRootWindow(gfx::NativeView view) {
363 HWND window = nullptr; 367 HWND window = nullptr;
364 if (view && view->GetHost()) 368 if (view && view->GetHost())
365 window = view->GetHost()->GetAcceleratedWidget(); 369 window = view->GetHost()->GetAcceleratedWidget();
366 if (!window) { 370 if (!window) {
367 // TODO(maruel): b/1214347 Get the right browser window instead. 371 // TODO(maruel): b/1214347 Get the right browser window instead.
368 return GetDesktopWindow(); 372 return GetDesktopWindow();
369 } 373 }
370 return window; 374 return window;
371 } 375 }
372 376
373 } // namespace printing 377 } // namespace printing
OLDNEW
« printing/printing_context_win.h ('K') | « printing/printing_context_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698