Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1890)

Unified Diff: ppapi/thunk/ppb_printing_thunk.cc

Issue 10795051: Implement asynchronous interface/plumbing for GetDefaultPrintSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/thunk/ppb_printing_thunk.cc
diff --git a/ppapi/thunk/ppb_printing_thunk.cc b/ppapi/thunk/ppb_printing_thunk.cc
index 66021895a7a8ebdb4efc75f1c39b1f9bb34f4c37..106d84538e1d38725a4f45563c601000cbe04595 100644
--- a/ppapi/thunk/ppb_printing_thunk.cc
+++ b/ppapi/thunk/ppb_printing_thunk.cc
@@ -11,22 +11,54 @@ namespace thunk {
namespace {
-PP_Bool GetDefaultPrintSettings(PP_Instance instance,
- PP_PrintSettings_Dev* print_settings) {
- EnterInstance enter(instance);
+int32_t GetDefaultPrintSettings(PP_Instance instance,
+ PP_PrintSettings_Dev* print_settings,
+ PP_CompletionCallback callback) {
+ EnterInstance enter(instance, callback);
if (enter.failed())
- return PP_FALSE;
- return enter.functions()->GetDefaultPrintSettings(instance, print_settings);
+ return enter.retval();
+ return enter.functions()->GetDefaultPrintSettings(instance, print_settings,
+ enter.callback());
}
-const PPB_Printing_Dev g_ppb_printing_dev_thunk = {
+PP_Bool GetDefaultPrintSettings_0_6(PP_Instance instance,
+ PP_PrintSettings_Dev* print_settings) {
+ // TODO(raymes): This is obsolete now. Just return some default settings.
+ // Remove this when all versions of Flash we care about are no longer using
+ // it.
+ PP_PrintSettings_Dev default_settings = {
+ // |printable_area|: all of the sheet of paper.
+ { { 0, 0 }, { 612, 792 } },
+ // |content_area|: 0.5" margins all around.
+ { { 36, 36 }, { 540, 720 } },
+ // |paper_size|: 8.5" x 11" (US letter).
+ { 612, 792 },
+ 300, // |dpi|.
+ PP_PRINTORIENTATION_NORMAL, // |orientation|.
+ PP_PRINTSCALINGOPTION_NONE, // |print_scaling_option|.
+ PP_FALSE, // |grayscale|.
+ PP_PRINTOUTPUTFORMAT_PDF // |format|.
+ };
+ *print_settings = default_settings;
+ return PP_TRUE;
+}
+
+const PPB_Printing_Dev g_ppb_printing_dev_thunk_0_7 = {
&GetDefaultPrintSettings,
};
+const PPB_Printing_Dev_0_6 g_ppb_printing_dev_thunk_0_6 = {
+ &GetDefaultPrintSettings_0_6,
+};
+
} // namespace
const PPB_Printing_Dev_0_6* GetPPB_Printing_Dev_0_6_Thunk() {
- return &g_ppb_printing_dev_thunk;
+ return &g_ppb_printing_dev_thunk_0_6;
+}
+
+const PPB_Printing_Dev_0_7* GetPPB_Printing_Dev_0_7_Thunk() {
+ return &g_ppb_printing_dev_thunk_0_7;
}
} // namespace thunk

Powered by Google App Engine
This is Rietveld 408576698