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

Unified Diff: ui/shell_dialogs/print_settings_dialog_win.h

Issue 27441003: Use BaseShellDialog for print dialog on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/shell_dialogs.gypi ('k') | ui/shell_dialogs/print_settings_dialog_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/shell_dialogs/print_settings_dialog_win.h
diff --git a/ui/shell_dialogs/print_settings_dialog_win.h b/ui/shell_dialogs/print_settings_dialog_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..8551f9fa9ed60a48bebd02f2219ac9f4e67d85c8
--- /dev/null
+++ b/ui/shell_dialogs/print_settings_dialog_win.h
@@ -0,0 +1,72 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_SHELL_DIALOGS_PRINT_SETTINGS_DIALOG_WIN_H_
+#define UI_SHELL_DIALOGS_PRINT_SETTINGS_DIALOG_WIN_H_
+
+#include <ocidl.h>
+#include <commdlg.h>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "base/message_loop/message_loop_proxy.h"
+#include "ui/shell_dialogs/base_shell_dialog_win.h"
+#include "ui/shell_dialogs/shell_dialogs_export.h"
+
+namespace ui {
+
+// A thin wrapper around the native window print dialog that uses
+// BaseShellDialog to have the dialog run on a background thread.
+class SHELL_DIALOGS_EXPORT PrintSettingsDialogWin
+ : public base::RefCountedThreadSafe<PrintSettingsDialogWin>,
+ public BaseShellDialogImpl {
+ public:
+ class SHELL_DIALOGS_EXPORT Listener {
sky 2013/10/16 14:16:32 We generally use Observer.
scottmg 2013/10/16 16:06:21 Done.
+ public:
+ virtual void PrintSettingsConfirmed(PRINTDLGEX* dialog_options) = 0;
+ virtual void PrintSettingsCancelled(PRINTDLGEX* dialog_options) = 0;
+ };
sky 2013/10/16 14:16:32 virtual protected destructor.
scottmg 2013/10/16 16:06:21 Done. (PrintingContextWin implements PrintSettings
+ typedef HRESULT(__stdcall* PrintDialogFunc)(PRINTDLGEX*);
+
+ PrintSettingsDialogWin(Listener* listener);
sky 2013/10/16 14:16:32 explicit
scottmg 2013/10/16 16:06:21 Done.
+
+ void GetPrintSettings(
sky 2013/10/16 14:16:32 Add descriptions for functions.
scottmg 2013/10/16 16:06:21 Done.
+ PrintDialogFunc print_dialog_func,
+ HWND owning_window,
+ PRINTDLGEX* dialog_options);
+
+ private:
+ // Listener that's notified when the dialog is confirmed or cancelled.
+ Listener* listener_;
sky 2013/10/16 14:16:32 members last.
scottmg 2013/10/16 16:06:21 Done.
+
+ // A struct for holding all the state necessary for displaying the print
+ // settings dialog.
+ struct ExecutePrintSettingsParams {
+ ExecutePrintSettingsParams(RunState run_state,
+ HWND owner,
+ PrintDialogFunc print_dialog_func,
+ PRINTDLGEX* dialog_options)
+ : run_state(run_state),
+ owner(owner),
+ print_dialog_func(print_dialog_func),
+ dialog_options(dialog_options),
+ ui_proxy(base::MessageLoopForUI::current()->message_loop_proxy()) {}
+
+ RunState run_state;
+ HWND owner;
+ PrintDialogFunc print_dialog_func;
+ PRINTDLGEX* dialog_options;
+ scoped_refptr<base::MessageLoopProxy> ui_proxy;
+ };
+
+ void ExecutePrintSettings(const ExecutePrintSettingsParams& params);
+
+ void PrintSettingsCompleted(HRESULT hresult,
+ const ExecutePrintSettingsParams& params);
+};
sky 2013/10/16 14:16:32 DISALLOW...
scottmg 2013/10/16 16:06:21 Done.
+
+} // namespace ui
+
+#endif // UI_SHELL_DIALOGS_PRINT_SETTINGS_DIALOG_WIN_H_
« no previous file with comments | « ui/shell_dialogs.gypi ('k') | ui/shell_dialogs/print_settings_dialog_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698