OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/glue/plugins/pepper_file_ref.h" | 5 #include "webkit/glue/plugins/pepper_file_ref.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "webkit/glue/plugins/pepper_common.h" | 10 #include "webkit/glue/plugins/pepper_common.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 258 } |
259 | 259 |
260 FileRef::~FileRef() { | 260 FileRef::~FileRef() { |
261 } | 261 } |
262 | 262 |
263 // static | 263 // static |
264 const PPB_FileRef_Dev* FileRef::GetInterface() { | 264 const PPB_FileRef_Dev* FileRef::GetInterface() { |
265 return &ppb_fileref; | 265 return &ppb_fileref; |
266 } | 266 } |
267 | 267 |
| 268 FileRef* FileRef::AsFileRef() { |
| 269 return this; |
| 270 } |
| 271 |
268 std::string FileRef::GetName() const { | 272 std::string FileRef::GetName() const { |
269 if (GetFileSystemType() == PP_FILESYSTEMTYPE_EXTERNAL) { | 273 if (GetFileSystemType() == PP_FILESYSTEMTYPE_EXTERNAL) { |
270 FilePath::StringType path = system_path_.value(); | 274 FilePath::StringType path = system_path_.value(); |
271 size_t pos = path.rfind(FilePath::kSeparators[0]); | 275 size_t pos = path.rfind(FilePath::kSeparators[0]); |
272 DCHECK(pos != FilePath::StringType::npos); | 276 DCHECK(pos != FilePath::StringType::npos); |
273 #if defined(OS_WIN) | 277 #if defined(OS_WIN) |
274 return WideToUTF8(path.substr(pos + 1)); | 278 return WideToUTF8(path.substr(pos + 1)); |
275 #elif defined(OS_POSIX) | 279 #elif defined(OS_POSIX) |
276 return path.substr(pos + 1); | 280 return path.substr(pos + 1); |
277 #else | 281 #else |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 #elif defined(OS_POSIX) | 338 #elif defined(OS_POSIX) |
335 virtual_path_.substr(1) | 339 virtual_path_.substr(1) |
336 #else | 340 #else |
337 #error "Unsupported platform." | 341 #error "Unsupported platform." |
338 #endif | 342 #endif |
339 ); | 343 ); |
340 return file_system_->root_path().Append(virtual_file_path); | 344 return file_system_->root_path().Append(virtual_file_path); |
341 } | 345 } |
342 | 346 |
343 } // namespace pepper | 347 } // namespace pepper |
OLD | NEW |