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

Side by Side Diff: webkit/browser/fileapi/external_mount_points.cc

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 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
« no previous file with comments | « webkit/browser/fileapi/external_mount_points.h ('k') | webkit/browser/fileapi/file_observers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/browser/fileapi/external_mount_points.h" 5 #include "webkit/browser/fileapi/external_mount_points.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 12 matching lines...) Expand all
23 if (path.empty()) 23 if (path.empty())
24 return path; 24 return path;
25 25
26 base::FilePath::StringType path_str = path.StripTrailingSeparators().value(); 26 base::FilePath::StringType path_str = path.StripTrailingSeparators().value();
27 if (!base::FilePath::IsSeparator(path_str[path_str.length() - 1])) 27 if (!base::FilePath::IsSeparator(path_str[path_str.length() - 1]))
28 path_str.append(FILE_PATH_LITERAL("/")); 28 path_str.append(FILE_PATH_LITERAL("/"));
29 29
30 return base::FilePath(path_str).NormalizePathSeparators(); 30 return base::FilePath(path_str).NormalizePathSeparators();
31 } 31 }
32 32
33 bool IsOverlappingMountPathForbidden(fileapi::FileSystemType type) { 33 bool IsOverlappingMountPathForbidden(storage::FileSystemType type) {
34 return type != fileapi::kFileSystemTypeNativeMedia && 34 return type != storage::kFileSystemTypeNativeMedia &&
35 type != fileapi::kFileSystemTypeDeviceMedia; 35 type != storage::kFileSystemTypeDeviceMedia;
36 } 36 }
37 37
38 // Wrapper around ref-counted ExternalMountPoints that will be used to lazily 38 // Wrapper around ref-counted ExternalMountPoints that will be used to lazily
39 // create and initialize LazyInstance system ExternalMountPoints. 39 // create and initialize LazyInstance system ExternalMountPoints.
40 class SystemMountPointsLazyWrapper { 40 class SystemMountPointsLazyWrapper {
41 public: 41 public:
42 SystemMountPointsLazyWrapper() 42 SystemMountPointsLazyWrapper()
43 : system_mount_points_(fileapi::ExternalMountPoints::CreateRefCounted()) { 43 : system_mount_points_(storage::ExternalMountPoints::CreateRefCounted()) {
44 } 44 }
45 45
46 ~SystemMountPointsLazyWrapper() {} 46 ~SystemMountPointsLazyWrapper() {}
47 47
48 fileapi::ExternalMountPoints* get() { 48 storage::ExternalMountPoints* get() { return system_mount_points_.get(); }
49 return system_mount_points_.get();
50 }
51 49
52 private: 50 private:
53 scoped_refptr<fileapi::ExternalMountPoints> system_mount_points_; 51 scoped_refptr<storage::ExternalMountPoints> system_mount_points_;
54 }; 52 };
55 53
56 base::LazyInstance<SystemMountPointsLazyWrapper>::Leaky 54 base::LazyInstance<SystemMountPointsLazyWrapper>::Leaky
57 g_external_mount_points = LAZY_INSTANCE_INITIALIZER; 55 g_external_mount_points = LAZY_INSTANCE_INITIALIZER;
58 56
59 } // namespace 57 } // namespace
60 58
61 namespace fileapi { 59 namespace storage {
62 60
63 class ExternalMountPoints::Instance { 61 class ExternalMountPoints::Instance {
64 public: 62 public:
65 Instance(FileSystemType type, 63 Instance(FileSystemType type,
66 const base::FilePath& path, 64 const base::FilePath& path,
67 const FileSystemMountOption& mount_option) 65 const FileSystemMountOption& mount_option)
68 : type_(type), 66 : type_(type),
69 path_(path.StripTrailingSeparators()), 67 path_(path.StripTrailingSeparators()),
70 mount_option_(mount_option) {} 68 mount_option_(mount_option) {}
71 ~Instance() {} 69 ~Instance() {}
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const std::string& mount_name) const { 238 const std::string& mount_name) const {
241 return base::FilePath().AppendASCII(mount_name); 239 return base::FilePath().AppendASCII(mount_name);
242 } 240 }
243 241
244 FileSystemURL ExternalMountPoints::CreateExternalFileSystemURL( 242 FileSystemURL ExternalMountPoints::CreateExternalFileSystemURL(
245 const GURL& origin, 243 const GURL& origin,
246 const std::string& mount_name, 244 const std::string& mount_name,
247 const base::FilePath& path) const { 245 const base::FilePath& path) const {
248 return CreateCrackedFileSystemURL( 246 return CreateCrackedFileSystemURL(
249 origin, 247 origin,
250 fileapi::kFileSystemTypeExternal, 248 storage::kFileSystemTypeExternal,
251 // Avoid using FilePath::Append as path may be an absolute path. 249 // Avoid using FilePath::Append as path may be an absolute path.
252 base::FilePath( 250 base::FilePath(CreateVirtualRootPath(mount_name).value() +
253 CreateVirtualRootPath(mount_name).value() + 251 base::FilePath::kSeparators[0] + path.value()));
254 base::FilePath::kSeparators[0] + path.value()));
255 } 252 }
256 253
257 void ExternalMountPoints::RevokeAllFileSystems() { 254 void ExternalMountPoints::RevokeAllFileSystems() {
258 NameToInstance instance_map_copy; 255 NameToInstance instance_map_copy;
259 { 256 {
260 base::AutoLock locker(lock_); 257 base::AutoLock locker(lock_);
261 instance_map_copy = instance_map_; 258 instance_map_copy = instance_map_;
262 instance_map_.clear(); 259 instance_map_.clear();
263 path_to_name_map_.clear(); 260 path_to_name_map_.clear();
264 } 261 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 if (potential_child->first == path || 347 if (potential_child->first == path ||
351 path.IsParent(potential_child->first)) { 348 path.IsParent(potential_child->first)) {
352 return false; 349 return false;
353 } 350 }
354 } 351 }
355 } 352 }
356 353
357 return true; 354 return true;
358 } 355 }
359 356
360 } // namespace fileapi 357 } // namespace storage
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/external_mount_points.h ('k') | webkit/browser/fileapi/file_observers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698