17d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 27d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 37d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// found in the LICENSE file. 47d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 57d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#ifndef PPAPI_SHARED_IMPL_FILE_REF_UTIL_H_ 67d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#define PPAPI_SHARED_IMPL_FILE_REF_UTIL_H_ 77d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 87d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include <string> 97d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 107d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "ppapi/shared_impl/ppapi_shared_export.h" 117d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 12eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochnamespace base { 13eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochclass FilePath; 14eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch} 15eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 167d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)namespace ppapi { 177d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 187d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Routines to generate display names for internal and external file paths. 197d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)PPAPI_SHARED_EXPORT std::string GetNameForInternalFilePath( 207d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const std::string& path); 217d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)PPAPI_SHARED_EXPORT std::string GetNameForExternalFilePath( 227d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const base::FilePath& path); 237d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 247d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Determines whether an internal file path is valid. 257d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)PPAPI_SHARED_EXPORT bool IsValidInternalPath(const std::string& path); 267d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 27eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch// Determines whether an external file path is valid. 28eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen MurdochPPAPI_SHARED_EXPORT bool IsValidExternalPath(const base::FilePath& path); 29eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 307d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// If path ends with a slash, normalize it away unless it's the root path. 317d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)PPAPI_SHARED_EXPORT void NormalizeInternalPath(std::string* path); 327d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 337d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)} // namespace ppapi 347d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 357d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#endif // PPAPI_SHARED_IMPL_FILE_REF_UTIL_H_ 36