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

Side by Side Diff: chrome/browser/printing/print_dialog_cloud.cc

Issue 8585017: PrintPreview: Honor the print media page size and margin values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 9 years 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) 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 "chrome/browser/printing/print_dialog_cloud.h" 5 #include "chrome/browser/printing/print_dialog_cloud.h"
6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h"
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // working so that we can get the default values from there. Fix up 398 // working so that we can get the default values from there. Fix up
399 // PrintWebViewHelper to do the same. 399 // PrintWebViewHelper to do the same.
400 const int kDPI = 72; 400 const int kDPI = 72;
401 const int kWidth = static_cast<int>((8.5-0.25-0.25)*kDPI); 401 const int kWidth = static_cast<int>((8.5-0.25-0.25)*kDPI);
402 const int kHeight = static_cast<int>((11-0.25-0.56)*kDPI); 402 const int kHeight = static_cast<int>((11-0.25-0.56)*kDPI);
403 const double kMinPageShrink = 1.25; 403 const double kMinPageShrink = 1.25;
404 const double kMaxPageShrink = 2.0; 404 const double kMaxPageShrink = 2.0;
405 405
406 PrintMsg_Print_Params default_settings; 406 PrintMsg_Print_Params default_settings;
407 default_settings.printable_size = gfx::Size(kWidth, kHeight); 407 default_settings.printable_size = gfx::Size(kWidth, kHeight);
408 default_settings.printable_area = gfx::Rect(0, 0, kWidth, kHeight);
408 default_settings.dpi = kDPI; 409 default_settings.dpi = kDPI;
409 default_settings.min_shrink = kMinPageShrink; 410 default_settings.min_shrink = kMinPageShrink;
410 default_settings.max_shrink = kMaxPageShrink; 411 default_settings.max_shrink = kMaxPageShrink;
411 default_settings.desired_dpi = kDPI; 412 default_settings.desired_dpi = kDPI;
412 default_settings.document_cookie = 0; 413 default_settings.document_cookie = 0;
413 default_settings.selection_only = false; 414 default_settings.selection_only = false;
414 default_settings.preview_request_id = 0; 415 default_settings.preview_request_id = 0;
415 default_settings.is_first_request = true; 416 default_settings.is_first_request = true;
417 default_settings.print_to_pdf = false;
416 418
417 if (!GetPageSetupParameters(json, default_settings)) { 419 if (!GetPageSetupParameters(json, default_settings)) {
418 NOTREACHED(); 420 NOTREACHED();
419 return; 421 return;
420 } 422 }
421 423
422 // TODO(scottbyer) - Here is where we would kick the originating 424 // TODO(scottbyer) - Here is where we would kick the originating
423 // renderer thread with these new parameters in order to get it to 425 // renderer thread with these new parameters in order to get it to
424 // re-generate the PDF data and hand it back to us. window.print() is 426 // re-generate the PDF data and hand it back to us. window.print() is
425 // currently synchronous, so there's a lot of work to do to get to 427 // currently synchronous, so there's a lot of work to do to get to
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 file_type, 718 file_type,
717 false, 719 false,
718 delete_on_close); 720 delete_on_close);
719 return true; 721 return true;
720 } 722 }
721 } 723 }
722 return false; 724 return false;
723 } 725 }
724 726
725 } // end namespace 727 } // end namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698