Skip to content

Commit

Permalink
Send request to show print system dialog to Metro.
Browse files Browse the repository at this point in the history
BUG=134256
TEST=Make sure there are no way to open the system's print dialog in Chrome when running in Metro. The print device charm should be shown instead.


Review URL: https://chromiumcodereview.appspot.com/10701155

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146399 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
mad@chromium.org committed Jul 12, 2012
1 parent 2d97319 commit 06186a3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions printing/printing_context_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "base/win/metro.h"
#include "printing/backend/win_helper.h"
#include "printing/print_job_constants.h"
#include "printing/print_settings_initializer_win.h"
Expand Down Expand Up @@ -219,6 +220,21 @@ void PrintingContextWin::AskUserForSettings(
const PrintSettingsCallback& callback) {
#if !defined(USE_AURA)
DCHECK(!in_print_job_);

if (base::win::IsMetroProcess()) {
// The system dialog can not be opened while running in Metro.
// But we can programatically launch the Metro print device charm though.
HMODULE metro_module = base::win::GetMetroModule();
if (metro_module != NULL) {
typedef void (*MetroShowPrintUI)();
MetroShowPrintUI metro_show_print_ui =
reinterpret_cast<MetroShowPrintUI>(
::GetProcAddress(metro_module, "MetroShowPrintUI"));
if (metro_show_print_ui)
metro_show_print_ui();
}
return callback.Run(CANCEL);
}
dialog_box_dismissed_ = false;

HWND window;
Expand Down

0 comments on commit 06186a3

Please sign in to comment.