summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-28 15:27:12 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-28 15:27:12 +0000
commit378f0e82d196573004b1f0efe58ccc067774368d (patch)
treee7c6b4b13dc4a7940d2ceb4afbfe1e39450b6fe3 /chrome/renderer
parent7f0f68158d4c9806ac5f093d17007b1d6cbd0db2 (diff)
downloadchromium_src-378f0e82d196573004b1f0efe58ccc067774368d.zip
chromium_src-378f0e82d196573004b1f0efe58ccc067774368d.tar.gz
chromium_src-378f0e82d196573004b1f0efe58ccc067774368d.tar.bz2
Should handle the events when no printer is detected on local
machineGetDefaultPrintSettings was returning an empty struct because no printer is installed. Checking when its empty will allow us to know that a printer is missing on that system. There is clearly no other way to do this, unless we do not do all those dchecks on dpi and other struct members.BUG=6835TEST=Tested only on windows, since linux/mac printing not even implemented. Removed all printer drivers, opened chromium, and ran a print job, popup dialog appeared stating no printer installed. Installed my printer drivers again, print dialog appeared. Patch contributed by Mohamed Mansour <m0.interactive@gmail.com> Review: http://codereview.chromium.org/100023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/render_view.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 0f5b80e..bce6d4c 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2340,6 +2340,15 @@ void RenderView::ScriptedPrint(WebFrame* frame) {
new ViewHostMsg_GetDefaultPrintSettings(routing_id_, &default_settings);
if (Send(msg)) {
msg = NULL;
+ // Check if the printer returned any settings, if the settings is empty, we
+ // can safely assume there are no printer drivers configured. So we safely
+ // terminate.
+ if (default_settings.IsEmpty()) {
+ RunJavaScriptAlert(frame,
+ l10n_util::GetString(IDS_DEFAULT_PRINTER_NOT_FOUND_WARNING_TITLE));
+ return;
+ }
+
// Continue only if the settings are valid.
if (default_settings.dpi && default_settings.document_cookie) {
int expected_pages_count = 0;