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

Side by Side Diff: ppapi/cpp/file_ref.cc

Issue 14188019: CRX FileSystem Pepper private API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/file_ref.h" 5 #include "ppapi/cpp/file_ref.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/cpp/completion_callback.h" 8 #include "ppapi/cpp/completion_callback.h"
9 #include "ppapi/cpp/file_system.h" 9 #include "ppapi/cpp/file_system.h"
10 #include "ppapi/cpp/module_impl.h" 10 #include "ppapi/cpp/module_impl.h"
(...skipping 14 matching lines...) Expand all
25 } // namespace 25 } // namespace
26 26
27 FileRef::FileRef(PP_Resource resource) : Resource(resource) { 27 FileRef::FileRef(PP_Resource resource) : Resource(resource) {
28 } 28 }
29 29
30 FileRef::FileRef(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) { 30 FileRef::FileRef(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) {
31 } 31 }
32 32
33 FileRef::FileRef(const FileSystem& file_system, 33 FileRef::FileRef(const FileSystem& file_system,
34 const char* path) { 34 const char* path) {
35 if (has_interface<PPB_FileRef_1_1>()) { 35 CommonCreate(file_system.pp_resource(), path);
36 PassRefFromConstructor(get_interface<PPB_FileRef_1_1>()->Create(
37 file_system.pp_resource(), path));
38 } else if (has_interface<PPB_FileRef_1_0>()) {
39 PassRefFromConstructor(get_interface<PPB_FileRef_1_0>()->Create(
40 file_system.pp_resource(), path));
41 }
42 } 36 }
43 37
44 FileRef::FileRef(const FileRef& other) 38 FileRef::FileRef(const FileRef& other)
45 : Resource(other) { 39 : Resource(other) {
46 } 40 }
47 41
42 void FileRef::CommonCreate(PP_Resource file_system_resource, const char* path) {
43 if (has_interface<PPB_FileRef_1_1>()) {
44 PassRefFromConstructor(get_interface<PPB_FileRef_1_1>()->Create(
45 file_system_resource, path));
46 } else if (has_interface<PPB_FileRef_1_0>()) {
47 PassRefFromConstructor(get_interface<PPB_FileRef_1_0>()->Create(
48 file_system_resource, path));
49 }
50 }
51
48 PP_FileSystemType FileRef::GetFileSystemType() const { 52 PP_FileSystemType FileRef::GetFileSystemType() const {
49 if (has_interface<PPB_FileRef_1_1>()) 53 if (has_interface<PPB_FileRef_1_1>())
50 return get_interface<PPB_FileRef_1_1>()->GetFileSystemType(pp_resource()); 54 return get_interface<PPB_FileRef_1_1>()->GetFileSystemType(pp_resource());
51 if (has_interface<PPB_FileRef_1_0>()) 55 if (has_interface<PPB_FileRef_1_0>())
52 return get_interface<PPB_FileRef_1_0>()->GetFileSystemType(pp_resource()); 56 return get_interface<PPB_FileRef_1_0>()->GetFileSystemType(pp_resource());
53 return PP_FILESYSTEMTYPE_EXTERNAL; 57 return PP_FILESYSTEMTYPE_EXTERNAL;
54 } 58 }
55 59
56 Var FileRef::GetName() const { 60 Var FileRef::GetName() const {
57 if (has_interface<PPB_FileRef_1_1>()) { 61 if (has_interface<PPB_FileRef_1_1>()) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 169
166 int32_t FileRef::Query(const CompletionCallbackWithOutput<PP_FileInfo>& cc) { 170 int32_t FileRef::Query(const CompletionCallbackWithOutput<PP_FileInfo>& cc) {
167 if (!has_interface<PPB_FileRef_1_1>()) 171 if (!has_interface<PPB_FileRef_1_1>())
168 return cc.MayForce(PP_ERROR_NOINTERFACE); 172 return cc.MayForce(PP_ERROR_NOINTERFACE);
169 return get_interface<PPB_FileRef_1_1>()->Query( 173 return get_interface<PPB_FileRef_1_1>()->Query(
170 pp_resource(), cc.output(), cc.pp_completion_callback()); 174 pp_resource(), cc.output(), cc.pp_completion_callback());
171 } 175 }
172 176
173 177
174 } // namespace pp 178 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698