| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/plugins/ppapi/ppb_file_ref_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_file_ref_impl.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 "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 97 } |
| 98 | 98 |
| 99 PPB_FileRef_API* PPB_FileRef_Impl::AsPPB_FileRef_API() { | 99 PPB_FileRef_API* PPB_FileRef_Impl::AsPPB_FileRef_API() { |
| 100 return this; | 100 return this; |
| 101 } | 101 } |
| 102 | 102 |
| 103 PPB_FileRef_Impl* PPB_FileRef_Impl::AsPPB_FileRef_Impl() { | 103 PPB_FileRef_Impl* PPB_FileRef_Impl::AsPPB_FileRef_Impl() { |
| 104 return this; | 104 return this; |
| 105 } | 105 } |
| 106 | 106 |
| 107 PP_FileSystemType_Dev PPB_FileRef_Impl::GetFileSystemType() const { | 107 PP_FileSystemType PPB_FileRef_Impl::GetFileSystemType() const { |
| 108 // When the file ref exists but there's no explicit filesystem object | 108 // When the file ref exists but there's no explicit filesystem object |
| 109 // associated with it, that means it's an "external" filesystem. | 109 // associated with it, that means it's an "external" filesystem. |
| 110 if (!file_system_) | 110 if (!file_system_) |
| 111 return PP_FILESYSTEMTYPE_EXTERNAL; | 111 return PP_FILESYSTEMTYPE_EXTERNAL; |
| 112 return file_system_->type(); | 112 return file_system_->type(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 PP_Var PPB_FileRef_Impl::GetName() const { | 115 PP_Var PPB_FileRef_Impl::GetName() const { |
| 116 std::string result; | 116 std::string result; |
| 117 if (GetFileSystemType() == PP_FILESYSTEMTYPE_EXTERNAL) { | 117 if (GetFileSystemType() == PP_FILESYSTEMTYPE_EXTERNAL) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 return GURL(file_system_->root_url().spec() + virtual_path_.substr(1)); | 249 return GURL(file_system_->root_url().spec() + virtual_path_.substr(1)); |
| 250 } | 250 } |
| 251 | 251 |
| 252 bool PPB_FileRef_Impl::IsValidNonExternalFileSystem() const { | 252 bool PPB_FileRef_Impl::IsValidNonExternalFileSystem() const { |
| 253 return file_system_ && file_system_->opened() && | 253 return file_system_ && file_system_->opened() && |
| 254 file_system_->type() != PP_FILESYSTEMTYPE_EXTERNAL; | 254 file_system_->type() != PP_FILESYSTEMTYPE_EXTERNAL; |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace ppapi | 257 } // namespace ppapi |
| 258 } // namespace webkit | 258 } // namespace webkit |
| OLD | NEW |