diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-31 04:24:21 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-31 04:24:21 +0000 |
commit | 6060b10c0db5aab66ed98323a79b239a2df0119b (patch) | |
tree | ad0a7620497204eb6f63c5aecbc70b0d4c289171 /ppapi/cpp/file_ref.cc | |
parent | f0b437f60f00985fca65e5095be3eed1402489f8 (diff) | |
download | chromium_src-6060b10c0db5aab66ed98323a79b239a2df0119b.zip chromium_src-6060b10c0db5aab66ed98323a79b239a2df0119b.tar.gz chromium_src-6060b10c0db5aab66ed98323a79b239a2df0119b.tar.bz2 |
Check explicitly for version 1.0 PPB_File* interfaces in pp::File* wrappers.
BUG=107398
Review URL: http://codereview.chromium.org/9712001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/file_ref.cc')
-rw-r--r-- | ppapi/cpp/file_ref.cc | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/ppapi/cpp/file_ref.cc b/ppapi/cpp/file_ref.cc index 864e646..fbfd49b 100644 --- a/ppapi/cpp/file_ref.cc +++ b/ppapi/cpp/file_ref.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -14,8 +14,8 @@ namespace pp { namespace { -template <> const char* interface_name<PPB_FileRef>() { - return PPB_FILEREF_INTERFACE; +template <> const char* interface_name<PPB_FileRef_1_0>() { + return PPB_FILEREF_INTERFACE_1_0; } } // namespace @@ -28,9 +28,9 @@ FileRef::FileRef(PassRef, PP_Resource resource) : Resource(PASS_REF, resource) { FileRef::FileRef(const FileSystem& file_system, const char* path) { - if (!has_interface<PPB_FileRef>()) + if (!has_interface<PPB_FileRef_1_0>()) return; - PassRefFromConstructor(get_interface<PPB_FileRef>()->Create( + PassRefFromConstructor(get_interface<PPB_FileRef_1_0>()->Create( file_system.pp_resource(), path)); } @@ -39,34 +39,36 @@ FileRef::FileRef(const FileRef& other) } PP_FileSystemType FileRef::GetFileSystemType() const { - if (!has_interface<PPB_FileRef>()) + if (!has_interface<PPB_FileRef_1_0>()) return PP_FILESYSTEMTYPE_EXTERNAL; - return get_interface<PPB_FileRef>()->GetFileSystemType(pp_resource()); + return get_interface<PPB_FileRef_1_0>()->GetFileSystemType(pp_resource()); } Var FileRef::GetName() const { - if (!has_interface<PPB_FileRef>()) + if (!has_interface<PPB_FileRef_1_0>()) return Var(); - return Var(PASS_REF, get_interface<PPB_FileRef>()->GetName(pp_resource())); + return Var(PASS_REF, + get_interface<PPB_FileRef_1_0>()->GetName(pp_resource())); } Var FileRef::GetPath() const { - if (!has_interface<PPB_FileRef>()) + if (!has_interface<PPB_FileRef_1_0>()) return Var(); - return Var(PASS_REF, get_interface<PPB_FileRef>()->GetPath(pp_resource())); + return Var(PASS_REF, + get_interface<PPB_FileRef_1_0>()->GetPath(pp_resource())); } FileRef FileRef::GetParent() const { - if (!has_interface<PPB_FileRef>()) + if (!has_interface<PPB_FileRef_1_0>()) return FileRef(); return FileRef(PASS_REF, - get_interface<PPB_FileRef>()->GetParent(pp_resource())); + get_interface<PPB_FileRef_1_0>()->GetParent(pp_resource())); } int32_t FileRef::MakeDirectory(const CompletionCallback& cc) { - if (!has_interface<PPB_FileRef>()) + if (!has_interface<PPB_FileRef_1_0>()) return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileRef>()->MakeDirectory( + return get_interface<PPB_FileRef_1_0>()->MakeDirectory( pp_resource(), PP_FALSE, // make_ancestors cc.pp_completion_callback()); @@ -74,9 +76,9 @@ int32_t FileRef::MakeDirectory(const CompletionCallback& cc) { int32_t FileRef::MakeDirectoryIncludingAncestors( const CompletionCallback& cc) { - if (!has_interface<PPB_FileRef>()) + if (!has_interface<PPB_FileRef_1_0>()) return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileRef>()->MakeDirectory( + return get_interface<PPB_FileRef_1_0>()->MakeDirectory( pp_resource(), PP_TRUE, // make_ancestors cc.pp_completion_callback()); @@ -85,25 +87,25 @@ int32_t FileRef::MakeDirectoryIncludingAncestors( int32_t FileRef::Touch(PP_Time last_access_time, PP_Time last_modified_time, const CompletionCallback& cc) { - if (!has_interface<PPB_FileRef>()) + if (!has_interface<PPB_FileRef_1_0>()) return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileRef>()->Touch( + return get_interface<PPB_FileRef_1_0>()->Touch( pp_resource(), last_access_time, last_modified_time, cc.pp_completion_callback()); } int32_t FileRef::Delete(const CompletionCallback& cc) { - if (!has_interface<PPB_FileRef>()) + if (!has_interface<PPB_FileRef_1_0>()) return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileRef>()->Delete( + return get_interface<PPB_FileRef_1_0>()->Delete( pp_resource(), cc.pp_completion_callback()); } int32_t FileRef::Rename(const FileRef& new_file_ref, const CompletionCallback& cc) { - if (!has_interface<PPB_FileRef>()) + if (!has_interface<PPB_FileRef_1_0>()) return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface<PPB_FileRef>()->Rename( + return get_interface<PPB_FileRef_1_0>()->Rename( pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback()); } |