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

Side by Side Diff: webkit/browser/fileapi/sandbox_prioritized_origin_database.h

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
OLDNEW
(Empty)
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.
4
5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_
6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/memory/scoped_ptr.h"
12 #include "webkit/browser/fileapi/sandbox_origin_database_interface.h"
13
14 namespace leveldb {
15 class Env;
16 }
17
18 namespace fileapi {
19
20 class ObfuscatedFileUtil;
21 class SandboxIsolatedOriginDatabase;
22 class SandboxOriginDatabase;
23
24 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE SandboxPrioritizedOriginDatabase
25 : public SandboxOriginDatabaseInterface {
26 public:
27 SandboxPrioritizedOriginDatabase(const base::FilePath& file_system_directory,
28 leveldb::Env* env_override);
29 virtual ~SandboxPrioritizedOriginDatabase();
30
31 // Sets |origin| as primary origin in this database (e.g. may
32 // allow faster access).
33 // Returns false if this database already has a primary origin
34 // which is different from |origin|.
35 bool InitializePrimaryOrigin(const std::string& origin);
36 std::string GetPrimaryOrigin();
37
38 // SandboxOriginDatabaseInterface overrides.
39 virtual bool HasOriginPath(const std::string& origin) OVERRIDE;
40 virtual bool GetPathForOrigin(const std::string& origin,
41 base::FilePath* directory) OVERRIDE;
42 virtual bool RemovePathForOrigin(const std::string& origin) OVERRIDE;
43 virtual bool ListAllOrigins(std::vector<OriginRecord>* origins) OVERRIDE;
44 virtual void DropDatabase() OVERRIDE;
45
46 const base::FilePath& primary_origin_file() const {
47 return primary_origin_file_;
48 }
49
50 private:
51 bool MaybeLoadPrimaryOrigin();
52 bool ResetPrimaryOrigin(const std::string& origin);
53 void MaybeMigrateDatabase(const std::string& origin);
54 void MaybeInitializeDatabases(bool create);
55 void MaybeInitializeNonPrimaryDatabase(bool create);
56
57 // For migration.
58 friend class ObfuscatedFileUtil;
59 SandboxOriginDatabase* GetSandboxOriginDatabase();
60
61 const base::FilePath file_system_directory_;
62 leveldb::Env* env_override_;
63 const base::FilePath primary_origin_file_;
64 scoped_ptr<SandboxOriginDatabase> origin_database_;
65 scoped_ptr<SandboxIsolatedOriginDatabase> primary_origin_database_;
66
67 DISALLOW_COPY_AND_ASSIGN(SandboxPrioritizedOriginDatabase);
68 };
69
70 } // namespace fileapi
71
72 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698