-void PrintPreviewHandler::PrintWithCloudPrintDialog() {
- // Record the number of times the user asks to print via cloud print
- // instead of the print preview dialog.
- ReportStats();
-
- scoped_refptr<base::RefCountedBytes> data;
- base::string16 title;
- if (!GetPreviewDataAndTitle(&data, &title)) {
- // Nothing to print, no preview available.
- return;
- }
-
- gfx::NativeWindow modal_parent = platform_util::GetTopLevel(
- preview_web_contents()->GetNativeView());
- print_dialog_cloud::CreatePrintDialogForBytes(
- preview_web_contents()->GetBrowserContext(),
- modal_parent,
- data.get(),
- title,
- base::string16(),
- std::string("application/pdf"));
-
- // Once the cloud print dialog comes up we're no longer in a background
- // printing situation. Close the print preview.
- // TODO(abodenha@chromium.org) The flow should be changed as described in
- // http://code.google.com/p/chromium/issues/detail?id=44093
- ClosePreviewDialog();
-}
-