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

Unified Diff: ppapi/thunk/ppb_file_chooser_thunk.cc

Issue 9113044: Convert to new enter method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: PATCH DESCRIPTIONS ARE A STUPID WASTE OF TIME Created 8 years, 11 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
« no previous file with comments | « ppapi/thunk/ppb_directory_reader_thunk.cc ('k') | ppapi/thunk/ppb_file_io_thunk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_file_chooser_thunk.cc
diff --git a/ppapi/thunk/ppb_file_chooser_thunk.cc b/ppapi/thunk/ppb_file_chooser_thunk.cc
index 1e783f998a8323a6f616c78d1b1b1cb9d1b6f587..b43b06a873919e7c7838fd0289d19371afda95ae 100644
--- a/ppapi/thunk/ppb_file_chooser_thunk.cc
+++ b/ppapi/thunk/ppb_file_chooser_thunk.cc
@@ -7,7 +7,6 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
#include "ppapi/shared_impl/var.h"
-#include "ppapi/thunk/common.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
#include "ppapi/thunk/ppb_file_chooser_api.h"
@@ -21,7 +20,7 @@ namespace {
PP_Resource Create(PP_Instance instance,
PP_FileChooserMode_Dev mode,
struct PP_Var accept_mime_types) {
- EnterFunction<ResourceCreationAPI> enter(instance, true);
+ EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
scoped_refptr<StringVar> string_var =
@@ -36,11 +35,10 @@ PP_Bool IsFileChooser(PP_Resource resource) {
}
int32_t Show(PP_Resource chooser, PP_CompletionCallback callback) {
- EnterResource<PPB_FileChooser_API> enter(chooser, true);
+ EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
if (enter.failed())
- return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
- int32_t result = enter.object()->Show(callback);
- return MayForceCallback(callback, result);
+ return enter.retval();
+ return enter.SetResult(enter.object()->Show(callback));
}
PP_Resource GetNextChosenFile(PP_Resource chooser) {
@@ -54,15 +52,14 @@ int32_t ShowWithoutUserGesture(PP_Resource chooser,
PP_Bool save_as,
PP_Var suggested_file_name,
PP_CompletionCallback callback) {
- EnterResource<PPB_FileChooser_API> enter(chooser, true);
+ EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
if (enter.failed())
- return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
+ return enter.retval();
scoped_refptr<StringVar> string_var =
StringVar::FromPPVar(suggested_file_name);
std::string str = string_var ? string_var->value() : std::string();
- int32_t result = enter.object()->ShowWithoutUserGesture(
- save_as == PP_TRUE, str.c_str(), callback);
- return MayForceCallback(callback, result);
+ return enter.SetResult(enter.object()->ShowWithoutUserGesture(
+ save_as == PP_TRUE, str.c_str(), callback));
}
const PPB_FileChooser_Dev g_ppb_file_chooser_thunk = {
« no previous file with comments | « ppapi/thunk/ppb_directory_reader_thunk.cc ('k') | ppapi/thunk/ppb_file_io_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698