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

Side by Side Diff: printing/printing_context_win.cc

Issue 8122006: Fix lack of preview when GCP printer is selected. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 9 years, 2 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
« no previous file with comments | « printing/printing_context_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "printing/printing_context_win.h" 5 #include "printing/printing_context_win.h"
6 6
7 #include <winspool.h> 7 #include <winspool.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 PrintingContext::Result PrintingContextWin::UpdatePrinterSettings( 324 PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
325 const DictionaryValue& job_settings, 325 const DictionaryValue& job_settings,
326 const PageRanges& ranges) { 326 const PageRanges& ranges) {
327 DCHECK(!in_print_job_); 327 DCHECK(!in_print_job_);
328 328
329 bool collate; 329 bool collate;
330 int color; 330 int color;
331 bool landscape; 331 bool landscape;
332 bool print_to_pdf; 332 bool print_to_pdf;
333 bool is_cloud_dialog;
333 int copies; 334 int copies;
334 int duplex_mode; 335 int duplex_mode;
335 string16 device_name; 336 string16 device_name;
336 337
337 if (!job_settings.GetBoolean(kSettingLandscape, &landscape) || 338 if (!job_settings.GetBoolean(kSettingLandscape, &landscape) ||
338 !job_settings.GetBoolean(kSettingCollate, &collate) || 339 !job_settings.GetBoolean(kSettingCollate, &collate) ||
339 !job_settings.GetInteger(kSettingColor, &color) || 340 !job_settings.GetInteger(kSettingColor, &color) ||
340 !job_settings.GetBoolean(kSettingPrintToPDF, &print_to_pdf) || 341 !job_settings.GetBoolean(kSettingPrintToPDF, &print_to_pdf) ||
341 !job_settings.GetInteger(kSettingDuplexMode, &duplex_mode) || 342 !job_settings.GetInteger(kSettingDuplexMode, &duplex_mode) ||
342 !job_settings.GetInteger(kSettingCopies, &copies) || 343 !job_settings.GetInteger(kSettingCopies, &copies) ||
343 !job_settings.GetString(kSettingDeviceName, &device_name)) { 344 !job_settings.GetString(kSettingDeviceName, &device_name) ||
345 !job_settings.GetBoolean(kSettingCloudPrintDialog, &is_cloud_dialog)) {
344 return OnError(); 346 return OnError();
345 } 347 }
346 348
347 bool print_to_cloud = job_settings.HasKey(printing::kSettingCloudPrintId); 349 bool print_to_cloud = job_settings.HasKey(printing::kSettingCloudPrintId);
348 350
349 if (print_to_pdf || print_to_cloud) { 351 if (print_to_pdf || print_to_cloud || is_cloud_dialog) {
350 // Default fallback to Letter size. 352 // Default fallback to Letter size.
351 gfx::Size paper_size; 353 gfx::Size paper_size;
352 gfx::Rect paper_rect; 354 gfx::Rect paper_rect;
353 paper_size.SetSize(kPDFLetterWidth, kPDFLetterHeight); 355 paper_size.SetSize(kPDFLetterWidth, kPDFLetterHeight);
354 356
355 // Get settings from locale. Paper type buffer length is at most 4. 357 // Get settings from locale. Paper type buffer length is at most 4.
356 const int paper_type_buffer_len = 4; 358 const int paper_type_buffer_len = 4;
357 wchar_t paper_type_buffer[paper_type_buffer_len] = {0}; 359 wchar_t paper_type_buffer[paper_type_buffer_len] = {0};
358 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IPAPERSIZE, paper_type_buffer, 360 GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IPAPERSIZE, paper_type_buffer,
359 paper_type_buffer_len); 361 paper_type_buffer_len);
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 if (buf_size) { 811 if (buf_size) {
810 buffer->reset(new uint8[buf_size]); 812 buffer->reset(new uint8[buf_size]);
811 memset(buffer->get(), 0, buf_size); 813 memset(buffer->get(), 0, buf_size);
812 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) { 814 if (!GetPrinter(printer, level, buffer->get(), buf_size, &buf_size)) {
813 buffer->reset(); 815 buffer->reset();
814 } 816 }
815 } 817 }
816 } 818 }
817 819
818 } // namespace printing 820 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printing_context_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698