From 6060b10c0db5aab66ed98323a79b239a2df0119b Mon Sep 17 00:00:00 2001 From: "wez@chromium.org" Date: Sat, 31 Mar 2012 04:24:21 +0000 Subject: 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 --- ppapi/cpp/file_ref.cc | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'ppapi/cpp/file_ref.cc') 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() { - return PPB_FILEREF_INTERFACE; +template <> const char* interface_name() { + 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()) + if (!has_interface()) return; - PassRefFromConstructor(get_interface()->Create( + PassRefFromConstructor(get_interface()->Create( file_system.pp_resource(), path)); } @@ -39,34 +39,36 @@ FileRef::FileRef(const FileRef& other) } PP_FileSystemType FileRef::GetFileSystemType() const { - if (!has_interface()) + if (!has_interface()) return PP_FILESYSTEMTYPE_EXTERNAL; - return get_interface()->GetFileSystemType(pp_resource()); + return get_interface()->GetFileSystemType(pp_resource()); } Var FileRef::GetName() const { - if (!has_interface()) + if (!has_interface()) return Var(); - return Var(PASS_REF, get_interface()->GetName(pp_resource())); + return Var(PASS_REF, + get_interface()->GetName(pp_resource())); } Var FileRef::GetPath() const { - if (!has_interface()) + if (!has_interface()) return Var(); - return Var(PASS_REF, get_interface()->GetPath(pp_resource())); + return Var(PASS_REF, + get_interface()->GetPath(pp_resource())); } FileRef FileRef::GetParent() const { - if (!has_interface()) + if (!has_interface()) return FileRef(); return FileRef(PASS_REF, - get_interface()->GetParent(pp_resource())); + get_interface()->GetParent(pp_resource())); } int32_t FileRef::MakeDirectory(const CompletionCallback& cc) { - if (!has_interface()) + if (!has_interface()) return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface()->MakeDirectory( + return get_interface()->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()) + if (!has_interface()) return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface()->MakeDirectory( + return get_interface()->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()) + if (!has_interface()) return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface()->Touch( + return get_interface()->Touch( pp_resource(), last_access_time, last_modified_time, cc.pp_completion_callback()); } int32_t FileRef::Delete(const CompletionCallback& cc) { - if (!has_interface()) + if (!has_interface()) return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface()->Delete( + return get_interface()->Delete( pp_resource(), cc.pp_completion_callback()); } int32_t FileRef::Rename(const FileRef& new_file_ref, const CompletionCallback& cc) { - if (!has_interface()) + if (!has_interface()) return cc.MayForce(PP_ERROR_NOINTERFACE); - return get_interface()->Rename( + return get_interface()->Rename( pp_resource(), new_file_ref.pp_resource(), cc.pp_completion_callback()); } -- cgit v1.1