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

Side by Side Diff: ppapi/cpp/dev/file_chooser_dev.cc

Issue 9381010: Convert resources to take an instance key instead of an Instance*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: USELESS PATCH TITLE Created 8 years, 10 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/dev/file_chooser_dev.h ('k') | ppapi/cpp/dev/find_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/cpp/dev/file_chooser_dev.h" 5 #include "ppapi/cpp/dev/file_chooser_dev.h"
6 6
7 #include "ppapi/c/dev/ppb_file_chooser_dev.h" 7 #include "ppapi/c/dev/ppb_file_chooser_dev.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/cpp/completion_callback.h" 9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/file_ref.h" 10 #include "ppapi/cpp/file_ref.h"
11 #include "ppapi/cpp/instance.h" 11 #include "ppapi/cpp/instance_handle.h"
12 #include "ppapi/cpp/module.h" 12 #include "ppapi/cpp/module.h"
13 #include "ppapi/cpp/module_impl.h" 13 #include "ppapi/cpp/module_impl.h"
14 14
15 namespace pp { 15 namespace pp {
16 16
17 namespace { 17 namespace {
18 18
19 template <> const char* interface_name<PPB_FileChooser_Dev>() { 19 template <> const char* interface_name<PPB_FileChooser_Dev>() {
20 return PPB_FILECHOOSER_DEV_INTERFACE; 20 return PPB_FILECHOOSER_DEV_INTERFACE;
21 } 21 }
22 22
23 } // namespace 23 } // namespace
24 24
25 FileChooser_Dev::FileChooser_Dev(const Instance* instance, 25 FileChooser_Dev::FileChooser_Dev(const InstanceHandle& instance,
26 PP_FileChooserMode_Dev mode, 26 PP_FileChooserMode_Dev mode,
27 const Var& accept_mime_types) { 27 const Var& accept_mime_types) {
28 if (!has_interface<PPB_FileChooser_Dev>()) 28 if (!has_interface<PPB_FileChooser_Dev>())
29 return; 29 return;
30 PassRefFromConstructor(get_interface<PPB_FileChooser_Dev>()->Create( 30 PassRefFromConstructor(get_interface<PPB_FileChooser_Dev>()->Create(
31 instance->pp_instance(), mode, accept_mime_types.pp_var())); 31 instance.pp_instance(), mode, accept_mime_types.pp_var()));
32 } 32 }
33 33
34 FileChooser_Dev::FileChooser_Dev(const FileChooser_Dev& other) 34 FileChooser_Dev::FileChooser_Dev(const FileChooser_Dev& other)
35 : Resource(other) { 35 : Resource(other) {
36 } 36 }
37 37
38 int32_t FileChooser_Dev::Show(const CompletionCallback& cc) { 38 int32_t FileChooser_Dev::Show(const CompletionCallback& cc) {
39 if (!has_interface<PPB_FileChooser_Dev>()) 39 if (!has_interface<PPB_FileChooser_Dev>())
40 return cc.MayForce(PP_ERROR_NOINTERFACE); 40 return cc.MayForce(PP_ERROR_NOINTERFACE);
41 return get_interface<PPB_FileChooser_Dev>()->Show( 41 return get_interface<PPB_FileChooser_Dev>()->Show(
42 pp_resource(), cc.pp_completion_callback()); 42 pp_resource(), cc.pp_completion_callback());
43 } 43 }
44 44
45 FileRef FileChooser_Dev::GetNextChosenFile() const { 45 FileRef FileChooser_Dev::GetNextChosenFile() const {
46 if (!has_interface<PPB_FileChooser_Dev>()) 46 if (!has_interface<PPB_FileChooser_Dev>())
47 return FileRef(); 47 return FileRef();
48 return FileRef(FileRef::PassRef(), 48 return FileRef(PASS_REF,
49 get_interface<PPB_FileChooser_Dev>()->GetNextChosenFile(pp_resource())); 49 get_interface<PPB_FileChooser_Dev>()->GetNextChosenFile(pp_resource()));
50 } 50 }
51 51
52 } // namespace pp 52 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/file_chooser_dev.h ('k') | ppapi/cpp/dev/find_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698