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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/trusted/file_chooser_trusted.h ('k') | ppapi/ppapi_cpp.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/cpp/trusted/file_chooser_trusted.h"
6
7 #include "ppapi/c/pp_bool.h"
8 #include "ppapi/cpp/completion_callback.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/cpp/module_impl.h"
11 #include "ppapi/cpp/var.h"
12 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
13
14 namespace pp {
15
16 namespace {
17
18 template <> const char* interface_name<PPB_FileChooserTrusted>() {
19 return PPB_FILECHOOSER_TRUSTED_INTERFACE;
20 }
21
22 } // namespace
23
24 FileChooser_Trusted::FileChooser_Trusted() : save_as_(false) {
25 }
26
27 FileChooser_Trusted::FileChooser_Trusted(const Instance* instance,
28 PP_FileChooserMode_Dev mode,
29 const Var& accept_mime_types,
30 bool save_as,
31 const std::string& suggested_file_name)
32 : FileChooser_Dev(instance, mode, accept_mime_types),
33 save_as_(save_as),
34 suggested_file_name_(suggested_file_name) {
35 }
36
37 FileChooser_Trusted::FileChooser_Trusted(const FileChooser_Trusted& other)
38 : FileChooser_Dev(other),
39 save_as_(other.save_as_),
40 suggested_file_name_(other.suggested_file_name_) {
41 }
42
43 int32_t FileChooser_Trusted::Show(const CompletionCallback& cc) {
44 if (!has_interface<PPB_FileChooserTrusted>())
45 return cc.MayForce(PP_ERROR_NOINTERFACE);
46 return get_interface<PPB_FileChooserTrusted>()->ShowWithoutUserGesture(
47 pp_resource(),
48 PP_FromBool(save_as_),
49 Var(suggested_file_name_).pp_var(),
50 cc.pp_completion_callback());
51 }
52
53 } // namespace pp
OLDNEW
« 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