diff options
author | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-22 20:12:10 +0000 |
---|---|---|
committer | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-22 20:12:10 +0000 |
commit | af3255e696087130aefab29ae187209718b88897 (patch) | |
tree | 1e3da6d756155e7f752b94fa1923cd30d3c6b7fb /content | |
parent | c79c3861b24db70fd2c30dcf89e19bc2ff774443 (diff) | |
download | chromium_src-af3255e696087130aefab29ae187209718b88897.zip chromium_src-af3255e696087130aefab29ae187209718b88897.tar.gz chromium_src-af3255e696087130aefab29ae187209718b88897.tar.bz2 |
Handle error cases when failing to get print settings or the print settings are invalid.
This handles the cases where we fail to get the default print settings in PepperPrintSettingsManager and returns a pepper error code in those cases.
BUG=156832
TEST=Ran pepper printing tests.
TBR=brettw
Review URL: https://chromiumcodereview.appspot.com/11236011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/pepper/pepper_print_settings_manager.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/content/browser/renderer_host/pepper/pepper_print_settings_manager.cc b/content/browser/renderer_host/pepper/pepper_print_settings_manager.cc index d2a18b1..9fcba03 100644 --- a/content/browser/renderer_host/pepper/pepper_print_settings_manager.cc +++ b/content/browser/renderer_host/pepper/pepper_print_settings_manager.cc @@ -48,15 +48,19 @@ PepperPrintSettingsManager::Result ComputeDefaultPrintSettings() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); scoped_ptr<printing::PrintingContext> context( printing::PrintingContext::Create(std::string())); - if (!context.get()) { + if (!context.get() || + context->UseDefaultSettings() != printing::PrintingContext::OK) { return PepperPrintSettingsManager::Result(PP_PrintSettings_Dev(), PP_ERROR_FAILED); } - context->UseDefaultSettings(); const printing::PrintSettings& print_settings = context->settings(); const printing::PageSetup& page_setup = print_settings.page_setup_device_units(); int device_units_per_inch = print_settings.device_units_per_inch(); + if (device_units_per_inch <= 0) { + return PepperPrintSettingsManager::Result(PP_PrintSettings_Dev(), + PP_ERROR_FAILED); + } PP_PrintSettings_Dev settings; settings.printable_area = PrintAreaToPPPrintArea( page_setup.printable_area(), device_units_per_inch); |