diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-08 21:33:14 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-08 21:33:14 +0000 |
commit | 3c217ae1a9677660cacb51a21d88020f5bbb6047 (patch) | |
tree | 310b576bbcf02b1cb86a2d3b2f945dd75702f04f /webkit/plugins/ppapi/ppb_file_ref_impl.cc | |
parent | 5b5c27201e819227c046ef2f8a434c52865fcb7d (diff) | |
download | chromium_src-3c217ae1a9677660cacb51a21d88020f5bbb6047.zip chromium_src-3c217ae1a9677660cacb51a21d88020f5bbb6047.tar.gz chromium_src-3c217ae1a9677660cacb51a21d88020f5bbb6047.tar.bz2 |
Revert 80982, tests failing on Win XP
TBR=ericu
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/6821020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi/ppb_file_ref_impl.cc')
-rw-r--r-- | webkit/plugins/ppapi/ppb_file_ref_impl.cc | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.cc b/webkit/plugins/ppapi/ppb_file_ref_impl.cc index 872d9b0..55bf3f1 100644 --- a/webkit/plugins/ppapi/ppb_file_ref_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_ref_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -6,7 +6,6 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "googleurl/src/gurl.h" #include "ppapi/c/pp_errors.h" #include "webkit/plugins/ppapi/common.h" #include "webkit/plugins/ppapi/file_callbacks.h" @@ -127,7 +126,7 @@ int32_t MakeDirectory(PP_Resource directory_ref_id, PluginInstance* instance = file_system->instance(); if (!instance->delegate()->MakeDirectory( - directory_ref->GetFileSystemURL(), PPBoolToBool(make_ancestors), + directory_ref->GetSystemPath(), PPBoolToBool(make_ancestors), new FileCallbacks(instance->module()->AsWeakPtr(), directory_ref_id, callback, NULL, NULL, NULL))) return PP_ERROR_FAILED; @@ -151,8 +150,7 @@ int32_t Touch(PP_Resource file_ref_id, PluginInstance* instance = file_system->instance(); if (!instance->delegate()->Touch( - file_ref->GetFileSystemURL(), - base::Time::FromDoubleT(last_access_time), + file_ref->GetSystemPath(), base::Time::FromDoubleT(last_access_time), base::Time::FromDoubleT(last_modified_time), new FileCallbacks(instance->module()->AsWeakPtr(), file_ref_id, callback, NULL, NULL, NULL))) @@ -175,7 +173,7 @@ int32_t Delete(PP_Resource file_ref_id, PluginInstance* instance = file_system->instance(); if (!instance->delegate()->Delete( - file_ref->GetFileSystemURL(), + file_ref->GetSystemPath(), new FileCallbacks(instance->module()->AsWeakPtr(), file_ref_id, callback, NULL, NULL, NULL))) return PP_ERROR_FAILED; @@ -206,7 +204,7 @@ int32_t Rename(PP_Resource file_ref_id, // http://crbug.com/67624 PluginInstance* instance = file_system->instance(); if (!instance->delegate()->Rename( - file_ref->GetFileSystemURL(), new_file_ref->GetFileSystemURL(), + file_ref->GetSystemPath(), new_file_ref->GetSystemPath(), new FileCallbacks(instance->module()->AsWeakPtr(), file_ref_id, callback, NULL, NULL, NULL))) return PP_ERROR_FAILED; @@ -322,25 +320,22 @@ std::string PPB_FileRef_Impl::GetPath() const { } FilePath PPB_FileRef_Impl::GetSystemPath() const { - if (GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL) { - NOTREACHED(); - return FilePath(); - } - return system_path_; -} + if (GetFileSystemType() == PP_FILESYSTEMTYPE_EXTERNAL) + return system_path_; -GURL PPB_FileRef_Impl::GetFileSystemURL() const { - if (GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALPERSISTENT && - GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALTEMPORARY) { - NOTREACHED(); - return GURL(); - } - if (!virtual_path_.size()) - return file_system_->root_url(); - // Since |virtual_path_| starts with a '/', it looks like an absolute path. - // We need to trim off the '/' before calling Resolve, as FileSystem URLs - // start with a storage type identifier that looks like a path segment. - return file_system_->root_url().Resolve(virtual_path_.substr(1)); + // Since |virtual_path_| starts with a '/', it is considered an absolute path + // on POSIX systems. We need to remove the '/' before calling Append() or we + // will run into a DCHECK. + FilePath virtual_file_path( +#if defined(OS_WIN) + UTF8ToWide(virtual_path_.substr(1)) +#elif defined(OS_POSIX) + virtual_path_.substr(1) +#else +#error "Unsupported platform." +#endif + ); + return file_system_->root_path().Append(virtual_file_path); } } // namespace ppapi |