summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 21:15:50 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-14 21:15:50 +0000
commit772a746250daaef9e464673d8a13359ed5f34ef3 (patch)
tree14b18be45ef79bca96f04523c14dcdfc4f1dc86c /ppapi/cpp
parent43e497fd5191b24542d9a0a5ac8760a572279f4f (diff)
downloadchromium_src-772a746250daaef9e464673d8a13359ed5f34ef3.zip
chromium_src-772a746250daaef9e464673d8a13359ed5f34ef3.tar.gz
chromium_src-772a746250daaef9e464673d8a13359ed5f34ef3.tar.bz2
This returns the default print settings for the default printer. Currently this just returns some generic values until it is hooked up to the chrome printing code.
BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10544085 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r--ppapi/cpp/dev/printing_dev.cc16
-rw-r--r--ppapi/cpp/dev/printing_dev.h7
2 files changed, 21 insertions, 2 deletions
diff --git a/ppapi/cpp/dev/printing_dev.cc b/ppapi/cpp/dev/printing_dev.cc
index 72affff..15c571f 100644
--- a/ppapi/cpp/dev/printing_dev.cc
+++ b/ppapi/cpp/dev/printing_dev.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
#include "ppapi/cpp/dev/printing_dev.h"
+#include "ppapi/c/dev/ppb_printing_dev.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/instance_handle.h"
#include "ppapi/cpp/module.h"
@@ -15,6 +16,10 @@ namespace {
static const char kPPPPrintingInterface[] = PPP_PRINTING_DEV_INTERFACE;
+template <> const char* interface_name<PPB_Printing_Dev_0_6>() {
+ return PPB_PRINTING_DEV_INTERFACE_0_6;
+}
+
uint32_t QuerySupportedFormats(PP_Instance instance) {
void* object =
Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
@@ -81,4 +86,13 @@ Printing_Dev::~Printing_Dev() {
kPPPPrintingInterface, this);
}
+bool Printing_Dev::GetDefaultPrintSettings(
+ PP_PrintSettings_Dev* print_settings) {
+ if (!has_interface<PPB_Printing_Dev_0_6>())
+ return PP_FALSE;
+ return PP_ToBool(
+ get_interface<PPB_Printing_Dev_0_6>()->GetDefaultPrintSettings(
+ associated_instance_.pp_instance(), print_settings));
+}
+
} // namespace pp
diff --git a/ppapi/cpp/dev/printing_dev.h b/ppapi/cpp/dev/printing_dev.h
index 734015f..8ce981f 100644
--- a/ppapi/cpp/dev/printing_dev.h
+++ b/ppapi/cpp/dev/printing_dev.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -30,6 +30,11 @@ class Printing_Dev {
virtual void PrintEnd() = 0;
virtual bool IsPrintScalingDisabled() = 0;
+ // PPB_Printing_Dev functions.
+ // Outputs the default print settings for the default printer into
+ // |print_settings|. Returns false on error.
+ bool GetDefaultPrintSettings(PP_PrintSettings_Dev* print_settings);
+
private:
InstanceHandle associated_instance_;
};