1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_
6 #define STORAGE_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_
11 #include "base/files/file_path.h"
12 #include "storage/browser/storage_browser_export.h"
16 class STORAGE_EXPORT_PRIVATE SandboxOriginDatabaseInterface
{
18 struct STORAGE_EXPORT_PRIVATE OriginRecord
{
23 OriginRecord(const std::string
& origin
, const base::FilePath
& path
);
27 virtual ~SandboxOriginDatabaseInterface() {}
29 // Returns true if the origin's path is included in this database.
30 virtual bool HasOriginPath(const std::string
& origin
) = 0;
32 // This will produce a unique path and add it to its database, if it's not
34 virtual bool GetPathForOrigin(const std::string
& origin
,
35 base::FilePath
* directory
) = 0;
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;
43 // Lists all origins in this database.
44 virtual bool ListAllOrigins(std::vector
<OriginRecord
>* origins
) = 0;
46 // This will release all database resources in use; call it to save memory.
47 virtual void DropDatabase() = 0;
50 SandboxOriginDatabaseInterface() {}
53 } // namespace storage
55 #endif // STORAGE_BROWSER_FILEAPI_SANDBOX_ORIGIN_DATABASE_INTERFACE_H_