| 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 WEBKIT_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "webkit/browser/fileapi/sandbox_origin_database_interface.h" | 12 #include "webkit/browser/fileapi/sandbox_origin_database_interface.h" |
| 13 | 13 |
| 14 namespace leveldb { |
| 15 class Env; |
| 16 } |
| 17 |
| 14 namespace fileapi { | 18 namespace fileapi { |
| 15 | 19 |
| 16 class ObfuscatedFileUtil; | 20 class ObfuscatedFileUtil; |
| 17 class SandboxIsolatedOriginDatabase; | 21 class SandboxIsolatedOriginDatabase; |
| 18 class SandboxOriginDatabase; | 22 class SandboxOriginDatabase; |
| 19 | 23 |
| 20 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE SandboxPrioritizedOriginDatabase | 24 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE SandboxPrioritizedOriginDatabase |
| 21 : public SandboxOriginDatabaseInterface { | 25 : public SandboxOriginDatabaseInterface { |
| 22 public: | 26 public: |
| 23 explicit SandboxPrioritizedOriginDatabase( | 27 SandboxPrioritizedOriginDatabase(const base::FilePath& file_system_directory, |
| 24 const base::FilePath& file_system_directory); | 28 leveldb::Env* env_override); |
| 25 virtual ~SandboxPrioritizedOriginDatabase(); | 29 virtual ~SandboxPrioritizedOriginDatabase(); |
| 26 | 30 |
| 27 // Sets |origin| as primary origin in this database (e.g. may | 31 // Sets |origin| as primary origin in this database (e.g. may |
| 28 // allow faster access). | 32 // allow faster access). |
| 29 // Returns false if this database already has a primary origin | 33 // Returns false if this database already has a primary origin |
| 30 // which is different from |origin|. | 34 // which is different from |origin|. |
| 31 bool InitializePrimaryOrigin(const std::string& origin); | 35 bool InitializePrimaryOrigin(const std::string& origin); |
| 32 std::string GetPrimaryOrigin(); | 36 std::string GetPrimaryOrigin(); |
| 33 | 37 |
| 34 // SandboxOriginDatabaseInterface overrides. | 38 // SandboxOriginDatabaseInterface overrides. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 48 bool ResetPrimaryOrigin(const std::string& origin); | 52 bool ResetPrimaryOrigin(const std::string& origin); |
| 49 void MaybeMigrateDatabase(const std::string& origin); | 53 void MaybeMigrateDatabase(const std::string& origin); |
| 50 void MaybeInitializeDatabases(bool create); | 54 void MaybeInitializeDatabases(bool create); |
| 51 void MaybeInitializeNonPrimaryDatabase(bool create); | 55 void MaybeInitializeNonPrimaryDatabase(bool create); |
| 52 | 56 |
| 53 // For migration. | 57 // For migration. |
| 54 friend class ObfuscatedFileUtil; | 58 friend class ObfuscatedFileUtil; |
| 55 SandboxOriginDatabase* GetSandboxOriginDatabase(); | 59 SandboxOriginDatabase* GetSandboxOriginDatabase(); |
| 56 | 60 |
| 57 const base::FilePath file_system_directory_; | 61 const base::FilePath file_system_directory_; |
| 62 leveldb::Env* env_override_; |
| 58 const base::FilePath primary_origin_file_; | 63 const base::FilePath primary_origin_file_; |
| 59 scoped_ptr<SandboxOriginDatabase> origin_database_; | 64 scoped_ptr<SandboxOriginDatabase> origin_database_; |
| 60 scoped_ptr<SandboxIsolatedOriginDatabase> primary_origin_database_; | 65 scoped_ptr<SandboxIsolatedOriginDatabase> primary_origin_database_; |
| 61 | 66 |
| 62 DISALLOW_COPY_AND_ASSIGN(SandboxPrioritizedOriginDatabase); | 67 DISALLOW_COPY_AND_ASSIGN(SandboxPrioritizedOriginDatabase); |
| 63 }; | 68 }; |
| 64 | 69 |
| 65 } // namespace fileapi | 70 } // namespace fileapi |
| 66 | 71 |
| 67 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ | 72 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_PRIORITIZED_ORIGIN_DATABASE_H_ |
| OLD | NEW |