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

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

Issue 14188019: CRX FileSystem Pepper private API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/platform_file.h" 7 #include "base/platform_file.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 const std::string& path) { 170 const std::string& path) {
171 PluginInstance* plugin_instance = 171 PluginInstance* plugin_instance =
172 ResourceHelper::PPInstanceToPluginInstance(instance); 172 ResourceHelper::PPInstanceToPluginInstance(instance);
173 if (!plugin_instance || !plugin_instance->delegate()) 173 if (!plugin_instance || !plugin_instance->delegate())
174 return 0; 174 return 0;
175 175
176 PP_FileSystemType type = 176 PP_FileSystemType type =
177 plugin_instance->delegate()->GetFileSystemType(instance, pp_file_system); 177 plugin_instance->delegate()->GetFileSystemType(instance, pp_file_system);
178 if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && 178 if (type != PP_FILESYSTEMTYPE_LOCALPERSISTENT &&
179 type != PP_FILESYSTEMTYPE_LOCALTEMPORARY && 179 type != PP_FILESYSTEMTYPE_LOCALTEMPORARY &&
180 type != PP_FILESYSTEMTYPE_EXTERNAL) 180 type != PP_FILESYSTEMTYPE_EXTERNAL &&
181 type != PP_FILESYSTEMTYPE_ISOLATED)
181 return 0; 182 return 0;
182 183
183 PPB_FileRef_CreateInfo info; 184 PPB_FileRef_CreateInfo info;
184 info.resource = HostResource::MakeInstanceOnly(instance); 185 info.resource = HostResource::MakeInstanceOnly(instance);
185 info.file_system_plugin_resource = pp_file_system; 186 info.file_system_plugin_resource = pp_file_system;
186 info.file_system_type = type; 187 info.file_system_type = type;
187 188
188 // Validate the path. 189 // Validate the path.
189 info.path = path; 190 info.path = path;
190 if (!IsValidLocalPath(info.path)) 191 if (!IsValidLocalPath(info.path))
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 if (GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL) { 325 if (GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL) {
325 NOTREACHED(); 326 NOTREACHED();
326 return base::FilePath(); 327 return base::FilePath();
327 } 328 }
328 return external_file_system_path_; 329 return external_file_system_path_;
329 } 330 }
330 331
331 GURL PPB_FileRef_Impl::GetFileSystemURL() const { 332 GURL PPB_FileRef_Impl::GetFileSystemURL() const {
332 if (GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALPERSISTENT && 333 if (GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALPERSISTENT &&
333 GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALTEMPORARY && 334 GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALTEMPORARY &&
334 GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL) { 335 GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL &&
336 GetFileSystemType() != PP_FILESYSTEMTYPE_ISOLATED) {
335 NOTREACHED(); 337 NOTREACHED();
336 return GURL(); 338 return GURL();
337 } 339 }
338 340
339 const std::string& virtual_path = GetCreateInfo().path; 341 const std::string& virtual_path = GetCreateInfo().path;
340 CHECK(!virtual_path.empty()); // Should always be at least "/". 342 CHECK(!virtual_path.empty()); // Should always be at least "/".
341 343
342 // Since |virtual_path_| starts with a '/', it looks like an absolute path. 344 // Since |virtual_path_| starts with a '/', it looks like an absolute path.
343 // We need to trim off the '/' before calling Resolve, as FileSystem URLs 345 // We need to trim off the '/' before calling Resolve, as FileSystem URLs
344 // start with a storage type identifier that looks like a path segment. 346 // start with a storage type identifier that looks like a path segment.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 444
443 if (!plugin_instance->delegate()->ReadDirectoryEntries( 445 if (!plugin_instance->delegate()->ReadDirectoryEntries(
444 GetFileSystemURL(), 446 GetFileSystemURL(),
445 new FileCallbacks(this, callback, params))) 447 new FileCallbacks(this, callback, params)))
446 return PP_ERROR_FAILED; 448 return PP_ERROR_FAILED;
447 return PP_OK_COMPLETIONPENDING; 449 return PP_OK_COMPLETIONPENDING;
448 } 450 }
449 451
450 } // namespace ppapi 452 } // namespace ppapi
451 } // namespace webkit 453 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/plugins/ppapi/resource_creation_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698