summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorvitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 23:55:15 +0000
committervitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 23:55:15 +0000
commit6b7bfd23fb27eb797f2fc06dd707e154d8306893 (patch)
treeece21fac2bb8fb67a265dd1128b32936fb5895bf /printing
parent42bf7b4b1d9ef5a00dc989328687fdd4df598a7a (diff)
downloadchromium_src-6b7bfd23fb27eb797f2fc06dd707e154d8306893.zip
chromium_src-6b7bfd23fb27eb797f2fc06dd707e154d8306893.tar.gz
chromium_src-6b7bfd23fb27eb797f2fc06dd707e154d8306893.tar.bz2
Enabled system print dialog on Windows Aura.
Temprarily workaround that needs to be replaced by ui::BaseShellDialog. BUG=180997 Review URL: https://chromiumcodereview.appspot.com/15817004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/DEPS1
-rw-r--r--printing/printing.gyp16
-rw-r--r--printing/printing_context_win.cc38
3 files changed, 39 insertions, 16 deletions
diff --git a/printing/DEPS b/printing/DEPS
index b8c8649..9b4c48e 100644
--- a/printing/DEPS
+++ b/printing/DEPS
@@ -2,6 +2,7 @@ include_rules = [
"+skia/ext",
"+third_party/icu",
"+third_party/skia",
+ "+ui/aura",
"+ui/base/text",
"+ui/gfx",
"+win8/util",
diff --git a/printing/printing.gyp b/printing/printing.gyp
index be4d8835..2ec1209 100644
--- a/printing/printing.gyp
+++ b/printing/printing.gyp
@@ -97,6 +97,11 @@
['exclude', '.'],
],
}],
+ ['use_aura==1', {
+ 'dependencies': [
+ '<(DEPTH)/ui/aura/aura.gyp:aura',
+ ],
+ }],
['toolkit_uses_gtk == 0',{
'sources/': [['exclude', '_cairo\\.cc$']]
}],
@@ -132,10 +137,9 @@
'../win8/win8.gyp:win8_util',
],
'conditions': [
- ['use_aura==0', {
- 'sources': [
- 'printing_context_win.cc',
- 'printing_context_win.h',
+ ['use_aura==1', {
+ 'dependencies': [
+ '<(DEPTH)/ui/aura/aura.gyp:aura',
],
}]],
'defines': [
@@ -147,12 +151,14 @@
'backend/win_helper.cc',
'backend/win_helper.h',
'backend/print_backend_win.cc',
+ 'printing_context_win.cc',
+ 'printing_context_win.h',
],
'sources!': [
'print_destination_none.cc',
],
}],
- ['chromeos==1 or use_aura==1',{
+ ['chromeos==1 or (use_aura==1 and OS!="win")',{
'sources': [
'printing_context_no_system_dialog.cc',
'printing_context_no_system_dialog.h',
diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc
index d0205ea..e5e6151 100644
--- a/printing/printing_context_win.cc
+++ b/printing/printing_context_win.cc
@@ -26,6 +26,12 @@
#include "skia/ext/platform_device.h"
#include "win8/util/win8_util.h"
+#if defined(USE_AURA)
+#include "ui/aura/remote_root_window_host_win.h"
+#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
+#endif
+
using base::Time;
namespace {
@@ -45,6 +51,23 @@ const int kPDFA4Height = 11.69 * kPDFDpi;
const int kPDFA3Width = 11.69 * kPDFDpi;
const int kPDFA3Height = 16.54 * kPDFDpi;
+HWND GetRootWindow(gfx::NativeView view) {
+ HWND window = NULL;
+#if defined(USE_AURA)
+ if (view)
+ window = view->GetRootWindow()->GetAcceleratedWidget();
+#else
+ if (view && IsWindow(view)) {
+ window = GetAncestor(view, GA_ROOTOWNER);
+ }
+#endif
+ if (!window) {
+ // TODO(maruel): bug 1214347 Get the right browser window instead.
+ return GetDesktopWindow();
+ }
+ return window;
+}
+
} // anonymous namespace
namespace printing {
@@ -166,12 +189,11 @@ PrintingContextWin::~PrintingContextWin() {
ReleaseContext();
}
+// TODO(vitalybuka): Implement as ui::BaseShellDialog crbug.com/180997.
void PrintingContextWin::AskUserForSettings(
gfx::NativeView view, int max_pages, bool has_selection,
const PrintSettingsCallback& callback) {
-#if !defined(USE_AURA)
DCHECK(!in_print_job_);
-
if (win8::IsSingleWindowMetroMode()) {
// The system dialog can not be opened while running in Metro.
// But we can programatically launch the Metro print device charm though.
@@ -192,13 +214,7 @@ void PrintingContextWin::AskUserForSettings(
}
dialog_box_dismissed_ = false;
- HWND window;
- if (!view || !IsWindow(view)) {
- // TODO(maruel): bug 1214347 Get the right browser window instead.
- window = GetDesktopWindow();
- } else {
- window = GetAncestor(view, GA_ROOTOWNER);
- }
+ HWND window = GetRootWindow(view);
DCHECK(window);
// Show the OS-dependent dialog box.
@@ -236,14 +252,14 @@ void PrintingContextWin::AskUserForSettings(
dialog_options.Flags |= PD_NOPAGENUMS;
}
- if ((*print_dialog_func_)(&dialog_options) != S_OK) {
+ HRESULT hr = (*print_dialog_func_)(&dialog_options);
+ if (hr != S_OK) {
ResetSettings();
callback.Run(FAILED);
}
// TODO(maruel): Support PD_PRINTTOFILE.
callback.Run(ParseDialogResultEx(dialog_options));
-#endif
}
PrintingContext::Result PrintingContextWin::UseDefaultSettings() {