| 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_ISOLATED_ORIGIN_DATABASE_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "webkit/browser/fileapi/sandbox_origin_database_interface.h" | 11 #include "storage/browser/fileapi/sandbox_origin_database_interface.h" |
| 12 | 12 |
| 13 namespace fileapi { | 13 namespace storage { |
| 14 | 14 |
| 15 class SandboxOriginDatabase; | 15 class SandboxOriginDatabase; |
| 16 | 16 |
| 17 // This origin database implementation supports only one origin | 17 // This origin database implementation supports only one origin |
| 18 // (therefore is expected to run very fast). | 18 // (therefore is expected to run very fast). |
| 19 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE SandboxIsolatedOriginDatabase | 19 class STORAGE_EXPORT_PRIVATE SandboxIsolatedOriginDatabase |
| 20 : public SandboxOriginDatabaseInterface { | 20 : public SandboxOriginDatabaseInterface { |
| 21 public: | 21 public: |
| 22 static const base::FilePath::CharType kObsoleteOriginDirectory[]; | 22 static const base::FilePath::CharType kObsoleteOriginDirectory[]; |
| 23 | 23 |
| 24 // Initialize this database for |origin| which makes GetPathForOrigin return | 24 // Initialize this database for |origin| which makes GetPathForOrigin return |
| 25 // |origin_directory| (in |file_system_directory|). | 25 // |origin_directory| (in |file_system_directory|). |
| 26 SandboxIsolatedOriginDatabase( | 26 SandboxIsolatedOriginDatabase(const std::string& origin, |
| 27 const std::string& origin, | 27 const base::FilePath& file_system_directory, |
| 28 const base::FilePath& file_system_directory, | 28 const base::FilePath& origin_directory); |
| 29 const base::FilePath& origin_directory); | |
| 30 virtual ~SandboxIsolatedOriginDatabase(); | 29 virtual ~SandboxIsolatedOriginDatabase(); |
| 31 | 30 |
| 32 // SandboxOriginDatabaseInterface overrides. | 31 // SandboxOriginDatabaseInterface overrides. |
| 33 virtual bool HasOriginPath(const std::string& origin) OVERRIDE; | 32 virtual bool HasOriginPath(const std::string& origin) OVERRIDE; |
| 34 virtual bool GetPathForOrigin(const std::string& origin, | 33 virtual bool GetPathForOrigin(const std::string& origin, |
| 35 base::FilePath* directory) OVERRIDE; | 34 base::FilePath* directory) OVERRIDE; |
| 36 virtual bool RemovePathForOrigin(const std::string& origin) OVERRIDE; | 35 virtual bool RemovePathForOrigin(const std::string& origin) OVERRIDE; |
| 37 virtual bool ListAllOrigins(std::vector<OriginRecord>* origins) OVERRIDE; | 36 virtual bool ListAllOrigins(std::vector<OriginRecord>* origins) OVERRIDE; |
| 38 virtual void DropDatabase() OVERRIDE; | 37 virtual void DropDatabase() OVERRIDE; |
| 39 | 38 |
| 40 // TODO(kinuko): Deprecate this after a few release cycles, e.g. around M33. | 39 // TODO(kinuko): Deprecate this after a few release cycles, e.g. around M33. |
| 41 static void MigrateBackFromObsoleteOriginDatabase( | 40 static void MigrateBackFromObsoleteOriginDatabase( |
| 42 const std::string& origin, | 41 const std::string& origin, |
| 43 const base::FilePath& file_system_directory, | 42 const base::FilePath& file_system_directory, |
| 44 SandboxOriginDatabase* origin_database); | 43 SandboxOriginDatabase* origin_database); |
| 45 | 44 |
| 46 const std::string& origin() const { return origin_; } | 45 const std::string& origin() const { return origin_; } |
| 47 | 46 |
| 48 private: | 47 private: |
| 49 void MigrateDatabaseIfNeeded(); | 48 void MigrateDatabaseIfNeeded(); |
| 50 | 49 |
| 51 bool migration_checked_; | 50 bool migration_checked_; |
| 52 const std::string origin_; | 51 const std::string origin_; |
| 53 const base::FilePath file_system_directory_; | 52 const base::FilePath file_system_directory_; |
| 54 const base::FilePath origin_directory_; | 53 const base::FilePath origin_directory_; |
| 55 | 54 |
| 56 DISALLOW_COPY_AND_ASSIGN(SandboxIsolatedOriginDatabase); | 55 DISALLOW_COPY_AND_ASSIGN(SandboxIsolatedOriginDatabase); |
| 57 }; | 56 }; |
| 58 | 57 |
| 59 } // namespace fileapi | 58 } // namespace storage |
| 60 | 59 |
| 61 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_ | 60 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_ISOLATED_ORIGIN_DATABASE_H_ |
| OLD | NEW |