summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-11 01:49:20 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-11 01:49:20 +0000
commit5aa7ee99e27b136edd8ef784752e31f89105caa4 (patch)
tree3009e7988016dc9bc31c039e74dbc95b49f89e7c /ppapi
parent4ee2939a0ee2792a09df73c96c2b1e5a00e99693 (diff)
downloadchromium_src-5aa7ee99e27b136edd8ef784752e31f89105caa4.zip
chromium_src-5aa7ee99e27b136edd8ef784752e31f89105caa4.tar.gz
chromium_src-5aa7ee99e27b136edd8ef784752e31f89105caa4.tar.bz2
Ensure the Printing_Dev::GetDefaultPrintSettings callback is run even if no interface is available.
This is ensures that optional/required callbacks are handled correctly. BUG=none Review URL: https://chromiumcodereview.appspot.com/11088041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161261 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/cpp/dev/printing_dev.cc8
-rw-r--r--ppapi/cpp/dev/printing_dev.h4
2 files changed, 5 insertions, 7 deletions
diff --git a/ppapi/cpp/dev/printing_dev.cc b/ppapi/cpp/dev/printing_dev.cc
index 00bb15b..8e07194 100644
--- a/ppapi/cpp/dev/printing_dev.cc
+++ b/ppapi/cpp/dev/printing_dev.cc
@@ -102,18 +102,18 @@ bool Printing_Dev::IsAvailable() {
}
-void Printing_Dev::GetDefaultPrintSettings(
+int32_t Printing_Dev::GetDefaultPrintSettings(
const CompletionCallbackWithOutput<PP_PrintSettings_Dev>& callback) const {
if (has_interface<PPB_Printing_Dev_0_7>()) {
- get_interface<PPB_Printing_Dev_0_7>()->GetDefaultPrintSettings(
+ return get_interface<PPB_Printing_Dev_0_7>()->GetDefaultPrintSettings(
pp_resource(), callback.output(), callback.pp_completion_callback());
} else if (has_interface<PPB_Printing_Dev_0_6>()) {
bool success = PP_ToBool(get_interface<PPB_Printing_Dev_0_6>()->
GetDefaultPrintSettings(associated_instance_.pp_instance(),
callback.output()));
- Module::Get()->core()->CallOnMainThread(0, callback,
- success ? PP_OK : PP_ERROR_FAILED);
+ return callback.MayForce(success ? PP_OK : PP_ERROR_FAILED);
}
+ return callback.MayForce(PP_ERROR_NOINTERFACE);
}
} // namespace pp
diff --git a/ppapi/cpp/dev/printing_dev.h b/ppapi/cpp/dev/printing_dev.h
index 9d5a7db..b219b13 100644
--- a/ppapi/cpp/dev/printing_dev.h
+++ b/ppapi/cpp/dev/printing_dev.h
@@ -37,9 +37,7 @@ class Printing_Dev : public Resource {
static bool IsAvailable();
// Get the default print settings and store them in the output of |callback|.
- // This method always runs asynchronously and the callback will always be
- // triggered.
- void GetDefaultPrintSettings(
+ int32_t GetDefaultPrintSettings(
const CompletionCallbackWithOutput<PP_PrintSettings_Dev>& callback) const;
private: