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

Unified Diff: chrome/browser/dom_ui/print_preview_handler.cc

Issue 6533006: Print Preview: Hook up the print button to initiate printing without displaying a print dialog. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 years, 10 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
Index: chrome/browser/dom_ui/print_preview_handler.cc
diff --git a/chrome/browser/dom_ui/print_preview_handler.cc b/chrome/browser/dom_ui/print_preview_handler.cc
index 45d4eacc312c8e52ccf5ce17a8e769eb2f645b80..519bf815503ac4d4efcf84f053a5ca4b91326c9f 100644
--- a/chrome/browser/dom_ui/print_preview_handler.cc
+++ b/chrome/browser/dom_ui/print_preview_handler.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/dom_ui/print_preview_handler.h"
#include "base/values.h"
+#include "chrome/browser/webui/web_ui_util.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "printing/backend/print_backend.h"
@@ -35,6 +36,12 @@ void PrintPreviewHandler::HandleGetPrinters(const ListValue*) {
web_ui_->CallJavascriptFunction(L"setPrinters", printers);
}
-void PrintPreviewHandler::HandlePrint(const ListValue*) {
- web_ui_->GetRenderViewHost()->PrintForPrintPreview();
+void PrintPreviewHandler::HandlePrint(const ListValue* args) {
+ std::string json_str(
+ web_ui_util::GetJsonResponseFromFirstArgumentInList(args));
arv (Not doing code reviews) 2011/02/21 02:00:05 This looks wrong. Why does GetJSONResponseFromFirs
kmadhusu 2011/02/22 02:56:34 From my understanding, GetJSONResponseFromFirstArg
arv (Not doing code reviews) 2011/02/23 19:38:52 A separate CL is fine.
+ if (json_str.empty()) {
+ NOTREACHED() << "Empty print job settings";
+ return;
+ }
+ web_ui_->GetRenderViewHost()->PrintForPrintPreview(json_str);
}

Powered by Google App Engine
This is Rietveld 408576698