Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: webkit/plugins/ppapi/ppb_file_ref_impl.cc

Issue 6543028: Implement the filesystem proxy. This allows the FileRef tests to pass in the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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 "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "webkit/plugins/ppapi/common.h" 10 #include "webkit/plugins/ppapi/common.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 PP_Bool IsFileRef(PP_Resource resource) { 63 PP_Bool IsFileRef(PP_Resource resource) {
64 return BoolToPPBool(!!Resource::GetAs<PPB_FileRef_Impl>(resource)); 64 return BoolToPPBool(!!Resource::GetAs<PPB_FileRef_Impl>(resource));
65 } 65 }
66 66
67 PP_FileSystemType_Dev GetFileSystemType(PP_Resource file_ref_id) { 67 PP_FileSystemType_Dev GetFileSystemType(PP_Resource file_ref_id) {
68 scoped_refptr<PPB_FileRef_Impl> file_ref( 68 scoped_refptr<PPB_FileRef_Impl> file_ref(
69 Resource::GetAs<PPB_FileRef_Impl>(file_ref_id)); 69 Resource::GetAs<PPB_FileRef_Impl>(file_ref_id));
70 if (!file_ref) 70 if (!file_ref)
71 return PP_FILESYSTEMTYPE_EXTERNAL; 71 return PP_FILESYSTEMTYPE_NONE;
72 return file_ref->GetFileSystemType(); 72 return file_ref->GetFileSystemType();
73 } 73 }
74 74
75 PP_Var GetName(PP_Resource file_ref_id) { 75 PP_Var GetName(PP_Resource file_ref_id) {
76 scoped_refptr<PPB_FileRef_Impl> file_ref( 76 scoped_refptr<PPB_FileRef_Impl> file_ref(
77 Resource::GetAs<PPB_FileRef_Impl>(file_ref_id)); 77 Resource::GetAs<PPB_FileRef_Impl>(file_ref_id));
78 if (!file_ref) 78 if (!file_ref)
79 return PP_MakeUndefined(); 79 return PP_MakeUndefined();
80 return StringVar::StringToPPVar(file_ref->instance()->module(), 80 return StringVar::StringToPPVar(file_ref->instance()->module(),
81 file_ref->GetName()); 81 file_ref->GetName());
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 PPB_FileRef_Impl* parent_ref = new PPB_FileRef_Impl(instance(), file_system_, 300 PPB_FileRef_Impl* parent_ref = new PPB_FileRef_Impl(instance(), file_system_,
301 parent_path); 301 parent_path);
302 return parent_ref; 302 return parent_ref;
303 } 303 }
304 304
305 scoped_refptr<PPB_FileSystem_Impl> PPB_FileRef_Impl::GetFileSystem() const { 305 scoped_refptr<PPB_FileSystem_Impl> PPB_FileRef_Impl::GetFileSystem() const {
306 return file_system_; 306 return file_system_;
307 } 307 }
308 308
309 PP_FileSystemType_Dev PPB_FileRef_Impl::GetFileSystemType() const { 309 PP_FileSystemType_Dev PPB_FileRef_Impl::GetFileSystemType() const {
310 // When the file ref exists but there's no explicit filesystem object
311 // associated with it, that means it's an "external" filesystem.
310 if (!file_system_) 312 if (!file_system_)
311 return PP_FILESYSTEMTYPE_EXTERNAL; 313 return PP_FILESYSTEMTYPE_EXTERNAL;
312 314
313 return file_system_->type(); 315 return file_system_->type();
314 } 316 }
315 317
316 std::string PPB_FileRef_Impl::GetPath() const { 318 std::string PPB_FileRef_Impl::GetPath() const {
317 return virtual_path_; 319 return virtual_path_;
318 } 320 }
319 321
(...skipping 12 matching lines...) Expand all
332 #else 334 #else
333 #error "Unsupported platform." 335 #error "Unsupported platform."
334 #endif 336 #endif
335 ); 337 );
336 return file_system_->root_path().Append(virtual_file_path); 338 return file_system_->root_path().Append(virtual_file_path);
337 } 339 }
338 340
339 } // namespace ppapi 341 } // namespace ppapi
340 } // namespace webkit 342 } // namespace webkit
341 343
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698