OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "third_party/leveldb/include/leveldb/db.h" | 14 #include "third_party/leveldb/include/leveldb/db.h" |
15 | 15 |
16 namespace fileapi { | 16 namespace fileapi { |
17 | 17 |
18 // All methods of this class other than the constructor may be used only from | 18 // All methods of this class other than the constructor may be used only from |
19 // the browser's FILE thread. The constructor may be used on any thread. | 19 // the browser's FILE thread. The constructor may be used on any thread. |
20 class FileSystemOriginDatabase { | 20 class FileSystemOriginDatabase { |
21 public: | 21 public: |
22 typedef std::pair<std::string, FilePath> OriginRecord; | 22 struct OriginRecord { |
| 23 std::string origin; |
| 24 FilePath path; |
| 25 |
| 26 OriginRecord(); |
| 27 OriginRecord(const std::string& origin, const FilePath& path); |
| 28 ~OriginRecord(); |
| 29 }; |
23 | 30 |
24 // Only one instance of FileSystemOriginDatabase should exist for a given path | 31 // Only one instance of FileSystemOriginDatabase should exist for a given path |
25 // at a given time. | 32 // at a given time. |
26 FileSystemOriginDatabase(const FilePath& path); | 33 FileSystemOriginDatabase(const FilePath& path); |
27 ~FileSystemOriginDatabase(); | 34 ~FileSystemOriginDatabase(); |
28 | 35 |
29 bool HasOriginPath(const std::string& origin); | 36 bool HasOriginPath(const std::string& origin); |
30 | 37 |
31 // This will produce a unique path and add it to its database, if it's not | 38 // This will produce a unique path and add it to its database, if it's not |
32 // already present. | 39 // already present. |
(...skipping 13 matching lines...) Expand all Loading... |
46 bool GetLastPathNumber(int* number); | 53 bool GetLastPathNumber(int* number); |
47 | 54 |
48 std::string path_; | 55 std::string path_; |
49 scoped_ptr<leveldb::DB> db_; | 56 scoped_ptr<leveldb::DB> db_; |
50 DISALLOW_COPY_AND_ASSIGN(FileSystemOriginDatabase); | 57 DISALLOW_COPY_AND_ASSIGN(FileSystemOriginDatabase); |
51 }; | 58 }; |
52 | 59 |
53 } // namespace fileapi | 60 } // namespace fileapi |
54 | 61 |
55 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_ | 62 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_ |
OLD | NEW |