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

Side by Side Diff: printing/printing_context_system_dialog_win.cc

Issue 932543003: Remove unused code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mon Feb 23 10:34:33 PST 2015 Created 5 years, 10 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
« no previous file with comments | « printing/printing_context_system_dialog_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_system_dialog_win.h" 5 #include "printing/printing_context_system_dialog_win.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "printing/backend/win_helper.h" 9 #include "printing/backend/win_helper.h"
10 #include "printing/print_settings_initializer_win.h" 10 #include "printing/print_settings_initializer_win.h"
11 #include "skia/ext/platform_device.h" 11 #include "skia/ext/platform_device.h"
12 12
13 namespace printing { 13 namespace printing {
14 14
15 PrintingContextSytemDialogWin::PrintingContextSytemDialogWin(Delegate* delegate) 15 PrintingContextSytemDialogWin::PrintingContextSytemDialogWin(Delegate* delegate)
16 : PrintingContextWin(delegate), dialog_box_(NULL) { 16 : PrintingContextWin(delegate) {
17 } 17 }
18 18
19 PrintingContextSytemDialogWin::~PrintingContextSytemDialogWin() { 19 PrintingContextSytemDialogWin::~PrintingContextSytemDialogWin() {
20 } 20 }
21 21
22 void PrintingContextSytemDialogWin::AskUserForSettings( 22 void PrintingContextSytemDialogWin::AskUserForSettings(
23 int max_pages, 23 int max_pages,
24 bool has_selection, 24 bool has_selection,
25 bool is_scripted, 25 bool is_scripted,
26 const PrintSettingsCallback& callback) { 26 const PrintSettingsCallback& callback) {
27 DCHECK(!in_print_job_); 27 DCHECK(!in_print_job_);
28 dialog_box_dismissed_ = false;
29 28
30 HWND window = GetRootWindow(delegate_->GetParentView()); 29 HWND window = GetRootWindow(delegate_->GetParentView());
31 DCHECK(window); 30 DCHECK(window);
32 31
33 // Show the OS-dependent dialog box. 32 // Show the OS-dependent dialog box.
34 // If the user press 33 // If the user press
35 // - OK, the settings are reset and reinitialized with the new settings. OK 34 // - OK, the settings are reset and reinitialized with the new settings. OK
36 // is 35 // is
37 // returned. 36 // returned.
38 // - Apply then Cancel, the settings are reset and reinitialized with the 37 // - Apply then Cancel, the settings are reset and reinitialized with the
(...skipping 30 matching lines...) Expand all
69 68
70 if (ShowPrintDialog(&dialog_options) != S_OK) { 69 if (ShowPrintDialog(&dialog_options) != S_OK) {
71 ResetSettings(); 70 ResetSettings();
72 callback.Run(FAILED); 71 callback.Run(FAILED);
73 } 72 }
74 73
75 // TODO(maruel): Support PD_PRINTTOFILE. 74 // TODO(maruel): Support PD_PRINTTOFILE.
76 callback.Run(ParseDialogResultEx(dialog_options)); 75 callback.Run(ParseDialogResultEx(dialog_options));
77 } 76 }
78 77
79 void PrintingContextSytemDialogWin::Cancel() {
80 PrintingContextWin::Cancel();
81 if (dialog_box_) {
82 DestroyWindow(dialog_box_);
83 dialog_box_dismissed_ = true;
84 }
85 }
86
87 HRESULT PrintingContextSytemDialogWin::ShowPrintDialog(PRINTDLGEX* options) { 78 HRESULT PrintingContextSytemDialogWin::ShowPrintDialog(PRINTDLGEX* options) {
88 // Runs always on the UI thread. 79 // Runs always on the UI thread.
89 static bool is_dialog_shown = false; 80 static bool is_dialog_shown = false;
90 if (is_dialog_shown) 81 if (is_dialog_shown)
91 return E_FAIL; 82 return E_FAIL;
92 // Block opening dialog from nested task. It crashes PrintDlgEx. 83 // Block opening dialog from nested task. It crashes PrintDlgEx.
93 base::AutoReset<bool> auto_reset(&is_dialog_shown, true); 84 base::AutoReset<bool> auto_reset(&is_dialog_shown, true);
94 85
95 // Note that this cannot use ui::BaseShellDialog as the print dialog is 86 // Note that this cannot use ui::BaseShellDialog as the print dialog is
96 // system modal: opening it from a background thread can cause Windows to 87 // system modal: opening it from a background thread can cause Windows to
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 260
270 if (dialog_options.hDevMode != NULL) 261 if (dialog_options.hDevMode != NULL)
271 GlobalFree(dialog_options.hDevMode); 262 GlobalFree(dialog_options.hDevMode);
272 if (dialog_options.hDevNames != NULL) 263 if (dialog_options.hDevNames != NULL)
273 GlobalFree(dialog_options.hDevNames); 264 GlobalFree(dialog_options.hDevNames);
274 265
275 return context() ? OK : FAILED; 266 return context() ? OK : FAILED;
276 } 267 }
277 268
278 } // namespace printing 269 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printing_context_system_dialog_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698