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

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

Issue 12817009: Add Query() support to FileRef (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 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"
11 11
12 12
13 namespace pp { 13 namespace pp {
14 14
15 namespace { 15 namespace {
16 16
17 template <> const char* interface_name<PPB_FileRef_1_0>() { 17 template <> const char* interface_name<PPB_FileRef_1_0>() {
18 return PPB_FILEREF_INTERFACE_1_0; 18 return PPB_FILEREF_INTERFACE_1_0;
19 } 19 }
20 20
21 template <> const char* interface_name<PPB_FileRef_1_1>() {
22 return PPB_FILEREF_INTERFACE_1_1;
23 }
24
21 } // namespace 25 } // namespace
22 26
23 FileRef::FileRef(PP_Resource resource) : Resource(resource) { 27 FileRef::FileRef(PP_Resource resource) : Resource(resource) {
24 } 28 }
25 29
26 FileRef::FileRef(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) { 30 FileRef::FileRef(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) {
27 } 31 }
28 32
29 FileRef::FileRef(const FileSystem& file_system, 33 FileRef::FileRef(const FileSystem& file_system,
30 const char* path) { 34 const char* path) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 106 }
103 107
104 int32_t FileRef::Rename(const FileRef& new_file_ref, 108 int32_t FileRef::Rename(const FileRef& new_file_ref,
105 const CompletionCallback& cc) { 109 const CompletionCallback& cc) {
106 if (!has_interface<PPB_FileRef_1_0>()) 110 if (!has_interface<PPB_FileRef_1_0>())
107 return cc.MayForce(PP_ERROR_NOINTERFACE); 111 return cc.MayForce(PP_ERROR_NOINTERFACE);
108 return get_interface<PPB_FileRef_1_0>()->Rename( 112 return get_interface<PPB_FileRef_1_0>()->Rename(
109 pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback()); 113 pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback());
110 } 114 }
111 115
116 int32_t FileRef::Query(PP_FileInfo* info,
117 const CompletionCallback& cc) {
118 if (!has_interface<PPB_FileRef_1_1>())
119 return cc.MayForce(PP_ERROR_NOINTERFACE);
120 return get_interface<PPB_FileRef_1_1>()->Query(
121 pp_resource(), info, cc.pp_completion_callback());
122 }
123
124
112 } // namespace pp 125 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698