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

Unified Diff: ppapi/cpp/trusted/file_chooser_trusted.cc

Issue 8275013: Pepper: Add a C++ wrapper for the trusted file chooser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update copyright Created 9 years, 2 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/cpp/trusted/file_chooser_trusted.h ('k') | ppapi/ppapi_cpp.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/trusted/file_chooser_trusted.cc
diff --git a/ppapi/cpp/trusted/file_chooser_trusted.cc b/ppapi/cpp/trusted/file_chooser_trusted.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d0c6c50679e099bf94042174637d92646c080c9a
--- /dev/null
+++ b/ppapi/cpp/trusted/file_chooser_trusted.cc
@@ -0,0 +1,53 @@
+// Copyright (c) 2011 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/trusted/file_chooser_trusted.h"
+
+#include "ppapi/c/pp_bool.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/var.h"
+#include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_FileChooserTrusted>() {
+ return PPB_FILECHOOSER_TRUSTED_INTERFACE;
+}
+
+} // namespace
+
+FileChooser_Trusted::FileChooser_Trusted() : save_as_(false) {
+}
+
+FileChooser_Trusted::FileChooser_Trusted(const Instance* instance,
+ PP_FileChooserMode_Dev mode,
+ const Var& accept_mime_types,
+ bool save_as,
+ const std::string& suggested_file_name)
+ : FileChooser_Dev(instance, mode, accept_mime_types),
+ save_as_(save_as),
+ suggested_file_name_(suggested_file_name) {
+}
+
+FileChooser_Trusted::FileChooser_Trusted(const FileChooser_Trusted& other)
+ : FileChooser_Dev(other),
+ save_as_(other.save_as_),
+ suggested_file_name_(other.suggested_file_name_) {
+}
+
+int32_t FileChooser_Trusted::Show(const CompletionCallback& cc) {
+ if (!has_interface<PPB_FileChooserTrusted>())
+ return cc.MayForce(PP_ERROR_NOINTERFACE);
+ return get_interface<PPB_FileChooserTrusted>()->ShowWithoutUserGesture(
+ pp_resource(),
+ PP_FromBool(save_as_),
+ Var(suggested_file_name_).pp_var(),
+ cc.pp_completion_callback());
+}
+
+} // namespace pp
« no previous file with comments | « ppapi/cpp/trusted/file_chooser_trusted.h ('k') | ppapi/ppapi_cpp.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698