OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ | 5 #ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ |
6 #define STORAGE_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ | 6 #define STORAGE_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 virtual ~SandboxPrioritizedOriginDatabase(); | 29 virtual ~SandboxPrioritizedOriginDatabase(); |
30 | 30 |
31 // Sets |origin| as primary origin in this database (e.g. may | 31 // Sets |origin| as primary origin in this database (e.g. may |
32 // allow faster access). | 32 // allow faster access). |
33 // Returns false if this database already has a primary origin | 33 // Returns false if this database already has a primary origin |
34 // which is different from |origin|. | 34 // which is different from |origin|. |
35 bool InitializePrimaryOrigin(const std::string& origin); | 35 bool InitializePrimaryOrigin(const std::string& origin); |
36 std::string GetPrimaryOrigin(); | 36 std::string GetPrimaryOrigin(); |
37 | 37 |
38 // SandboxOriginDatabaseInterface overrides. | 38 // SandboxOriginDatabaseInterface overrides. |
39 virtual bool HasOriginPath(const std::string& origin) OVERRIDE; | 39 virtual bool HasOriginPath(const std::string& origin) override; |
40 virtual bool GetPathForOrigin(const std::string& origin, | 40 virtual bool GetPathForOrigin(const std::string& origin, |
41 base::FilePath* directory) OVERRIDE; | 41 base::FilePath* directory) override; |
42 virtual bool RemovePathForOrigin(const std::string& origin) OVERRIDE; | 42 virtual bool RemovePathForOrigin(const std::string& origin) override; |
43 virtual bool ListAllOrigins(std::vector<OriginRecord>* origins) OVERRIDE; | 43 virtual bool ListAllOrigins(std::vector<OriginRecord>* origins) override; |
44 virtual void DropDatabase() OVERRIDE; | 44 virtual void DropDatabase() override; |
45 | 45 |
46 const base::FilePath& primary_origin_file() const { | 46 const base::FilePath& primary_origin_file() const { |
47 return primary_origin_file_; | 47 return primary_origin_file_; |
48 } | 48 } |
49 | 49 |
50 private: | 50 private: |
51 bool MaybeLoadPrimaryOrigin(); | 51 bool MaybeLoadPrimaryOrigin(); |
52 bool ResetPrimaryOrigin(const std::string& origin); | 52 bool ResetPrimaryOrigin(const std::string& origin); |
53 void MaybeMigrateDatabase(const std::string& origin); | 53 void MaybeMigrateDatabase(const std::string& origin); |
54 void MaybeInitializeDatabases(bool create); | 54 void MaybeInitializeDatabases(bool create); |
55 void MaybeInitializeNonPrimaryDatabase(bool create); | 55 void MaybeInitializeNonPrimaryDatabase(bool create); |
56 | 56 |
57 // For migration. | 57 // For migration. |
58 friend class ObfuscatedFileUtil; | 58 friend class ObfuscatedFileUtil; |
59 SandboxOriginDatabase* GetSandboxOriginDatabase(); | 59 SandboxOriginDatabase* GetSandboxOriginDatabase(); |
60 | 60 |
61 const base::FilePath file_system_directory_; | 61 const base::FilePath file_system_directory_; |
62 leveldb::Env* env_override_; | 62 leveldb::Env* env_override_; |
63 const base::FilePath primary_origin_file_; | 63 const base::FilePath primary_origin_file_; |
64 scoped_ptr<SandboxOriginDatabase> origin_database_; | 64 scoped_ptr<SandboxOriginDatabase> origin_database_; |
65 scoped_ptr<SandboxIsolatedOriginDatabase> primary_origin_database_; | 65 scoped_ptr<SandboxIsolatedOriginDatabase> primary_origin_database_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(SandboxPrioritizedOriginDatabase); | 67 DISALLOW_COPY_AND_ASSIGN(SandboxPrioritizedOriginDatabase); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace storage | 70 } // namespace storage |
71 | 71 |
72 #endif // STORAGE_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ | 72 #endif // STORAGE_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ |
OLD | NEW |