From 128bec3cd249be7675fec39d184da047d7fbab76 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Thu, 20 Jan 2011 22:57:35 +0000 Subject: Use the existing PRINTPAGERANGE rather than allocating a new one. BUG=68307 TEST=Dr. Memory no longer complains. Review URL: http://codereview.chromium.org/5998010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72032 0039d316-1c4b-4281-b951-d872f2087c98 --- printing/printing_context_win.cc | 12 +++++------- printing/printing_context_win_unittest.cc | 3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'printing') diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc index 9afa511..c5130c0 100644 --- a/printing/printing_context_win.cc +++ b/printing/printing_context_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,6 @@ #include -#include "base/file_util.h" #include "base/i18n/file_util_icu.h" #include "base/i18n/time_formatting.h" #include "base/message_loop.h" @@ -188,12 +187,11 @@ void PrintingContextWin::AskUserForSettings(HWND view, dialog_options.Flags |= PD_NOPAGENUMS; } - { - if ((*print_dialog_func_)(&dialog_options) != S_OK) { - ResetSettings(); - callback->Run(FAILED); - } + if ((*print_dialog_func_)(&dialog_options) != S_OK) { + ResetSettings(); + callback->Run(FAILED); } + // TODO(maruel): Support PD_PRINTTOFILE. callback->Run(ParseDialogResultEx(dialog_options)); } diff --git a/printing/printing_context_win_unittest.cc b/printing/printing_context_win_unittest.cc index 874c62d..802ba44 100644 --- a/printing/printing_context_win_unittest.cc +++ b/printing/printing_context_win_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -38,7 +38,6 @@ HRESULT WINAPI PrintDlgExMock(LPPRINTDLGEX lppd) { // Pretend the page range is 1-5, but since lppd->Flags does not have // PD_SELECTION set, this really shouldn't matter. lppd->nPageRanges = 1; - lppd->lpPageRanges = new PRINTPAGERANGE[1]; lppd->lpPageRanges[0].nFromPage = 1; lppd->lpPageRanges[0].nToPage = 5; -- cgit v1.1