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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 100023: Should handle the events when no printer is detected on local machine... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after
2352 2352
2353 void RenderView::ScriptedPrint(WebFrame* frame) { 2353 void RenderView::ScriptedPrint(WebFrame* frame) {
2354 #if defined(OS_WIN) 2354 #if defined(OS_WIN)
2355 // Retrieve the default print settings to calculate the expected number of 2355 // Retrieve the default print settings to calculate the expected number of
2356 // pages. 2356 // pages.
2357 ViewMsg_Print_Params default_settings; 2357 ViewMsg_Print_Params default_settings;
2358 IPC::SyncMessage* msg = 2358 IPC::SyncMessage* msg =
2359 new ViewHostMsg_GetDefaultPrintSettings(routing_id_, &default_settings); 2359 new ViewHostMsg_GetDefaultPrintSettings(routing_id_, &default_settings);
2360 if (Send(msg)) { 2360 if (Send(msg)) {
2361 msg = NULL; 2361 msg = NULL;
2362 // Check if the printer returned any settings, if the settings is empty, we
2363 // can safely assume there are no printer drivers configured. So we safely
2364 // terminate.
2365 if (default_settings.IsEmpty()) {
2366 RunJavaScriptAlert(frame,
2367 l10n_util::GetString(IDS_DEFAULT_PRINTER_NOT_FOUND_WARNING_TITLE));
2368 return;
2369 }
2370
2362 // Continue only if the settings are valid. 2371 // Continue only if the settings are valid.
2363 if (default_settings.dpi && default_settings.document_cookie) { 2372 if (default_settings.dpi && default_settings.document_cookie) {
2364 int expected_pages_count = 0; 2373 int expected_pages_count = 0;
2365 gfx::Size canvas_size; 2374 gfx::Size canvas_size;
2366 canvas_size.set_width( 2375 canvas_size.set_width(
2367 printing::ConvertUnit(default_settings.printable_size.width(), 2376 printing::ConvertUnit(default_settings.printable_size.width(),
2368 static_cast<int>(default_settings.dpi), 2377 static_cast<int>(default_settings.dpi),
2369 default_settings.desired_dpi)); 2378 default_settings.desired_dpi));
2370 canvas_size.set_height( 2379 canvas_size.set_height(
2371 printing::ConvertUnit(default_settings.printable_size.height(), 2380 printing::ConvertUnit(default_settings.printable_size.height(),
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 } 3035 }
3027 } 3036 }
3028 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinishDoc", start_to_finish_doc); 3037 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinishDoc", start_to_finish_doc);
3029 UMA_HISTOGRAM_TIMES("Renderer.All.FinishDocToFinish", finish_doc_to_finish); 3038 UMA_HISTOGRAM_TIMES("Renderer.All.FinishDocToFinish", finish_doc_to_finish);
3030 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinish", start_to_finish); 3039 UMA_HISTOGRAM_TIMES("Renderer.All.StartToFinish", start_to_finish);
3031 if (start_to_first_layout.ToInternalValue() >= 0) { 3040 if (start_to_first_layout.ToInternalValue() >= 0) {
3032 UMA_HISTOGRAM_TIMES( 3041 UMA_HISTOGRAM_TIMES(
3033 "Renderer.All.StartToFirstLayout", start_to_first_layout); 3042 "Renderer.All.StartToFirstLayout", start_to_first_layout);
3034 } 3043 }
3035 } 3044 }
OLDNEW
« chrome/app/generated_resources.grd ('K') | « chrome/common/render_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698