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

Side by Side Diff: storage/browser/fileapi/external_mount_points.h

Issue 669603008: Standardize usage of virtual/override/final in storage/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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) 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 #ifndef STORAGE_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_ 5 #ifndef STORAGE_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_
6 #define STORAGE_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_ 6 #define STORAGE_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // empty, but |GetVirtualPath| will not work for those mount points. 58 // empty, but |GetVirtualPath| will not work for those mount points.
59 // 59 //
60 // An external file system registered by this method can be revoked 60 // An external file system registered by this method can be revoked
61 // by calling RevokeFileSystem with |mount_name|. 61 // by calling RevokeFileSystem with |mount_name|.
62 bool RegisterFileSystem(const std::string& mount_name, 62 bool RegisterFileSystem(const std::string& mount_name,
63 FileSystemType type, 63 FileSystemType type,
64 const FileSystemMountOption& mount_option, 64 const FileSystemMountOption& mount_option,
65 const base::FilePath& path); 65 const base::FilePath& path);
66 66
67 // MountPoints overrides. 67 // MountPoints overrides.
68 virtual bool HandlesFileSystemMountType(FileSystemType type) const override; 68 bool HandlesFileSystemMountType(FileSystemType type) const override;
69 virtual bool RevokeFileSystem(const std::string& mount_name) override; 69 bool RevokeFileSystem(const std::string& mount_name) override;
70 virtual bool GetRegisteredPath(const std::string& mount_name, 70 bool GetRegisteredPath(const std::string& mount_name,
71 base::FilePath* path) const override; 71 base::FilePath* path) const override;
72 virtual bool CrackVirtualPath( 72 bool CrackVirtualPath(const base::FilePath& virtual_path,
73 const base::FilePath& virtual_path, 73 std::string* mount_name,
74 std::string* mount_name, 74 FileSystemType* type,
75 FileSystemType* type, 75 std::string* cracked_id,
76 std::string* cracked_id, 76 base::FilePath* path,
77 base::FilePath* path, 77 FileSystemMountOption* mount_option) const override;
78 FileSystemMountOption* mount_option) const override; 78 FileSystemURL CrackURL(const GURL& url) const override;
79 virtual FileSystemURL CrackURL(const GURL& url) const override; 79 FileSystemURL CreateCrackedFileSystemURL(
80 virtual FileSystemURL CreateCrackedFileSystemURL(
81 const GURL& origin, 80 const GURL& origin,
82 FileSystemType type, 81 FileSystemType type,
83 const base::FilePath& path) const override; 82 const base::FilePath& path) const override;
84 83
85 // Returns a list of registered MountPointInfos (of <mount_name, path>). 84 // Returns a list of registered MountPointInfos (of <mount_name, path>).
86 void AddMountPointInfosTo(std::vector<MountPointInfo>* mount_points) const; 85 void AddMountPointInfosTo(std::vector<MountPointInfo>* mount_points) const;
87 86
88 // Converts a path on a registered file system to virtual path relative to the 87 // Converts a path on a registered file system to virtual path relative to the
89 // file system root. E.g. if 'Downloads' file system is mapped to 88 // file system root. E.g. if 'Downloads' file system is mapped to
90 // '/usr/local/home/Downloads', and |absolute| path is set to 89 // '/usr/local/home/Downloads', and |absolute| path is set to
(...skipping 28 matching lines...) Expand all
119 // Represents each file system instance (defined in the .cc). 118 // Represents each file system instance (defined in the .cc).
120 class Instance; 119 class Instance;
121 120
122 typedef std::map<std::string, Instance*> NameToInstance; 121 typedef std::map<std::string, Instance*> NameToInstance;
123 122
124 // Reverse map from registered path to its corresponding mount name. 123 // Reverse map from registered path to its corresponding mount name.
125 typedef std::map<base::FilePath, std::string> PathToName; 124 typedef std::map<base::FilePath, std::string> PathToName;
126 125
127 // Use |GetSystemInstance| of |CreateRefCounted| to get an instance. 126 // Use |GetSystemInstance| of |CreateRefCounted| to get an instance.
128 ExternalMountPoints(); 127 ExternalMountPoints();
129 virtual ~ExternalMountPoints(); 128 ~ExternalMountPoints() override;
130 129
131 // MountPoint overrides. 130 // MountPoint overrides.
132 virtual FileSystemURL CrackFileSystemURL( 131 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const override;
133 const FileSystemURL& url) const override;
134 132
135 // Performs sanity checks on the new mount point. 133 // Performs sanity checks on the new mount point.
136 // Checks the following: 134 // Checks the following:
137 // - there is no registered mount point with mount_name 135 // - there is no registered mount point with mount_name
138 // - path does not contain a reference to a parent 136 // - path does not contain a reference to a parent
139 // - path is absolute 137 // - path is absolute
140 // - path does not overlap with an existing mount point path unless it is a 138 // - path does not overlap with an existing mount point path unless it is a
141 // media gallery type. 139 // media gallery type.
142 // 140 //
143 // |lock_| should be taken before calling this method. 141 // |lock_| should be taken before calling this method.
144 bool ValidateNewMountPoint(const std::string& mount_name, 142 bool ValidateNewMountPoint(const std::string& mount_name,
145 FileSystemType type, 143 FileSystemType type,
146 const base::FilePath& path); 144 const base::FilePath& path);
147 145
148 // This lock needs to be obtained when accessing the instance_map_. 146 // This lock needs to be obtained when accessing the instance_map_.
149 mutable base::Lock lock_; 147 mutable base::Lock lock_;
150 148
151 NameToInstance instance_map_; 149 NameToInstance instance_map_;
152 PathToName path_to_name_map_; 150 PathToName path_to_name_map_;
153 151
154 DISALLOW_COPY_AND_ASSIGN(ExternalMountPoints); 152 DISALLOW_COPY_AND_ASSIGN(ExternalMountPoints);
155 }; 153 };
156 154
157 } // namespace storage 155 } // namespace storage
158 156
159 #endif // STORAGE_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_ 157 #endif // STORAGE_BROWSER_FILEAPI_EXTERNAL_MOUNT_POINTS_H_
OLDNEW
« no previous file with comments | « storage/browser/fileapi/dragged_file_util.cc ('k') | storage/browser/fileapi/file_system_dir_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698