| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DIRECTORY_DATABASE_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "webkit/storage/webkit_storage_export.h" | 14 #include "webkit/browser/webkit_storage_browser_export.h" |
| 15 | 15 |
| 16 namespace tracked_objects { | 16 namespace tracked_objects { |
| 17 class Location; | 17 class Location; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace leveldb { | 20 namespace leveldb { |
| 21 class DB; | 21 class DB; |
| 22 class Status; | 22 class Status; |
| 23 class WriteBatch; | 23 class WriteBatch; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace fileapi { | 26 namespace fileapi { |
| 27 | 27 |
| 28 // This class WILL NOT protect you against producing directory loops, giving an | 28 // This class WILL NOT protect you against producing directory loops, giving an |
| 29 // empty directory a backing data file, giving two files the same backing file, | 29 // empty directory a backing data file, giving two files the same backing file, |
| 30 // or pointing to a nonexistent backing file. It does no file IO other than | 30 // or pointing to a nonexistent backing file. It does no file IO other than |
| 31 // that involved with talking to its underlying database. It does not create or | 31 // that involved with talking to its underlying database. It does not create or |
| 32 // in any way touch real files; it only creates path entries in its database. | 32 // in any way touch real files; it only creates path entries in its database. |
| 33 | 33 |
| 34 // TODO(ericu): Safe mode, which does more checks such as the above on debug | 34 // TODO(ericu): Safe mode, which does more checks such as the above on debug |
| 35 // builds. | 35 // builds. |
| 36 // TODO(ericu): Add a method that will give a unique filename for a data file. | 36 // TODO(ericu): Add a method that will give a unique filename for a data file. |
| 37 class WEBKIT_STORAGE_EXPORT_PRIVATE SandboxDirectoryDatabase { | 37 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE SandboxDirectoryDatabase { |
| 38 public: | 38 public: |
| 39 typedef int64 FileId; | 39 typedef int64 FileId; |
| 40 | 40 |
| 41 struct WEBKIT_STORAGE_EXPORT_PRIVATE FileInfo { | 41 struct WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileInfo { |
| 42 FileInfo(); | 42 FileInfo(); |
| 43 ~FileInfo(); | 43 ~FileInfo(); |
| 44 | 44 |
| 45 bool is_directory() const { | 45 bool is_directory() const { |
| 46 return data_path.empty(); | 46 return data_path.empty(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 FileId parent_id; | 49 FileId parent_id; |
| 50 base::FilePath data_path; | 50 base::FilePath data_path; |
| 51 base::FilePath::StringType name; | 51 base::FilePath::StringType name; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 const base::FilePath filesystem_data_directory_; | 117 const base::FilePath filesystem_data_directory_; |
| 118 scoped_ptr<leveldb::DB> db_; | 118 scoped_ptr<leveldb::DB> db_; |
| 119 base::Time last_reported_time_; | 119 base::Time last_reported_time_; |
| 120 DISALLOW_COPY_AND_ASSIGN(SandboxDirectoryDatabase); | 120 DISALLOW_COPY_AND_ASSIGN(SandboxDirectoryDatabase); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 } // namespace fileapi | 123 } // namespace fileapi |
| 124 | 124 |
| 125 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ | 125 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ |
| OLD | NEW |