OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 WEBKIT_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_ | 5 #include "storage/browser/fileapi/sandbox_origin_database_interface.h" |
6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/files/file_path.h" | |
12 #include "webkit/browser/storage_browser_export.h" | |
13 | |
14 namespace storage { | |
15 | |
16 class STORAGE_EXPORT_PRIVATE SandboxOriginDatabaseInterface { | |
17 public: | |
18 struct STORAGE_EXPORT_PRIVATE OriginRecord { | |
19 std::string origin; | |
20 base::FilePath path; | |
21 | |
22 OriginRecord(); | |
23 OriginRecord(const std::string& origin, const base::FilePath& path); | |
24 ~OriginRecord(); | |
25 }; | |
26 | |
27 virtual ~SandboxOriginDatabaseInterface() {} | |
28 | |
29 // Returns true if the origin's path is included in this database. | |
30 virtual bool HasOriginPath(const std::string& origin) = 0; | |
31 | |
32 // This will produce a unique path and add it to its database, if it's not | |
33 // already present. | |
34 virtual bool GetPathForOrigin(const std::string& origin, | |
35 base::FilePath* directory) = 0; | |
36 | |
37 // Removes the origin's path from the database. | |
38 // Returns success if the origin has been successfully removed, or | |
39 // the origin is not found. | |
40 // (This doesn't remove the actual path). | |
41 virtual bool RemovePathForOrigin(const std::string& origin) = 0; | |
42 | |
43 // Lists all origins in this database. | |
44 virtual bool ListAllOrigins(std::vector<OriginRecord>* origins) = 0; | |
45 | |
46 // This will release all database resources in use; call it to save memory. | |
47 virtual void DropDatabase() = 0; | |
48 | |
49 protected: | |
50 SandboxOriginDatabaseInterface() {} | |
51 }; | |
52 | |
53 } // namespace storage | |
54 | |
55 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_ | |
OLD | NEW |