OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_SHELL_DIALOGS_PRINT_SETTINGS_DIALOG_WIN_H_ | |
6 #define UI_SHELL_DIALOGS_PRINT_SETTINGS_DIALOG_WIN_H_ | |
7 | |
8 #include <ocidl.h> | |
9 #include <commdlg.h> | |
10 | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/message_loop/message_loop.h" | |
14 #include "base/message_loop/message_loop_proxy.h" | |
15 #include "ui/shell_dialogs/base_shell_dialog_win.h" | |
16 #include "ui/shell_dialogs/shell_dialogs_export.h" | |
17 | |
18 namespace ui { | |
19 | |
20 // A thin wrapper around the native window print dialog that uses | |
21 // BaseShellDialog to have the dialog run on a background thread. | |
22 class SHELL_DIALOGS_EXPORT PrintSettingsDialogWin | |
23 : public base::RefCountedThreadSafe<PrintSettingsDialogWin>, | |
24 public BaseShellDialogImpl { | |
25 public: | |
26 class SHELL_DIALOGS_EXPORT Listener { | |
sky
2013/10/16 14:16:32
We generally use Observer.
scottmg
2013/10/16 16:06:21
Done.
| |
27 public: | |
28 virtual void PrintSettingsConfirmed(PRINTDLGEX* dialog_options) = 0; | |
29 virtual void PrintSettingsCancelled(PRINTDLGEX* dialog_options) = 0; | |
30 }; | |
sky
2013/10/16 14:16:32
virtual protected destructor.
scottmg
2013/10/16 16:06:21
Done. (PrintingContextWin implements PrintSettings
| |
31 typedef HRESULT(__stdcall* PrintDialogFunc)(PRINTDLGEX*); | |
32 | |
33 PrintSettingsDialogWin(Listener* listener); | |
sky
2013/10/16 14:16:32
explicit
scottmg
2013/10/16 16:06:21
Done.
| |
34 | |
35 void GetPrintSettings( | |
sky
2013/10/16 14:16:32
Add descriptions for functions.
scottmg
2013/10/16 16:06:21
Done.
| |
36 PrintDialogFunc print_dialog_func, | |
37 HWND owning_window, | |
38 PRINTDLGEX* dialog_options); | |
39 | |
40 private: | |
41 // Listener that's notified when the dialog is confirmed or cancelled. | |
42 Listener* listener_; | |
sky
2013/10/16 14:16:32
members last.
scottmg
2013/10/16 16:06:21
Done.
| |
43 | |
44 // A struct for holding all the state necessary for displaying the print | |
45 // settings dialog. | |
46 struct ExecutePrintSettingsParams { | |
47 ExecutePrintSettingsParams(RunState run_state, | |
48 HWND owner, | |
49 PrintDialogFunc print_dialog_func, | |
50 PRINTDLGEX* dialog_options) | |
51 : run_state(run_state), | |
52 owner(owner), | |
53 print_dialog_func(print_dialog_func), | |
54 dialog_options(dialog_options), | |
55 ui_proxy(base::MessageLoopForUI::current()->message_loop_proxy()) {} | |
56 | |
57 RunState run_state; | |
58 HWND owner; | |
59 PrintDialogFunc print_dialog_func; | |
60 PRINTDLGEX* dialog_options; | |
61 scoped_refptr<base::MessageLoopProxy> ui_proxy; | |
62 }; | |
63 | |
64 void ExecutePrintSettings(const ExecutePrintSettingsParams& params); | |
65 | |
66 void PrintSettingsCompleted(HRESULT hresult, | |
67 const ExecutePrintSettingsParams& params); | |
68 }; | |
sky
2013/10/16 14:16:32
DISALLOW...
scottmg
2013/10/16 16:06:21
Done.
| |
69 | |
70 } // namespace ui | |
71 | |
72 #endif // UI_SHELL_DIALOGS_PRINT_SETTINGS_DIALOG_WIN_H_ | |
OLD | NEW |