From 7337c81c95ffe93c2f9370952a0cf8b8bf3d104d Mon Sep 17 00:00:00 2001
From: "viettrungluu@chromium.org"
 <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 15 Jun 2012 17:11:04 +0000
Subject: PPAPI: Add a Printing_Dev::IsAvailable()  (static) method.

As a drive-by, also fix a return value in GetDefaultPrintSettings().

Review URL: https://chromiumcodereview.appspot.com/10553006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142412 0039d316-1c4b-4281-b951-d872f2087c98
---
 ppapi/cpp/dev/printing_dev.cc | 7 ++++++-
 ppapi/cpp/dev/printing_dev.h  | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

(limited to 'ppapi/cpp/dev')

diff --git a/ppapi/cpp/dev/printing_dev.cc b/ppapi/cpp/dev/printing_dev.cc
index 15c571f..ee2f381 100644
--- a/ppapi/cpp/dev/printing_dev.cc
+++ b/ppapi/cpp/dev/printing_dev.cc
@@ -86,10 +86,15 @@ Printing_Dev::~Printing_Dev() {
                                     kPPPPrintingInterface, this);
 }
 
+// static
+bool Printing_Dev::IsAvailable() {
+  return has_interface<PPB_Printing_Dev_0_6>();
+}
+
 bool Printing_Dev::GetDefaultPrintSettings(
     PP_PrintSettings_Dev* print_settings) {
   if (!has_interface<PPB_Printing_Dev_0_6>())
-    return PP_FALSE;
+    return false;
   return PP_ToBool(
       get_interface<PPB_Printing_Dev_0_6>()->GetDefaultPrintSettings(
           associated_instance_.pp_instance(), print_settings));
diff --git a/ppapi/cpp/dev/printing_dev.h b/ppapi/cpp/dev/printing_dev.h
index 8ce981f..b26216d 100644
--- a/ppapi/cpp/dev/printing_dev.h
+++ b/ppapi/cpp/dev/printing_dev.h
@@ -31,6 +31,10 @@ class Printing_Dev {
   virtual bool IsPrintScalingDisabled() = 0;
 
   // PPB_Printing_Dev functions.
+  // Returns true if the browser supports the required PPB_Printing_Dev
+  // interface.
+  static bool IsAvailable();
+
   // Outputs the default print settings for the default printer into
   // |print_settings|. Returns false on error.
   bool GetDefaultPrintSettings(PP_PrintSettings_Dev* print_settings);
-- 
cgit v1.1