OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ |
6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ | 6 #define CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 | 12 |
13 class FilePath; | 13 class FilePath; |
14 class WebKitContext; | 14 class WebKitContext; |
15 | 15 |
16 namespace WebKit { | 16 namespace WebKit { |
17 class WebIDBFactory; | 17 class WebIDBFactory; |
18 class WebSecurityOrigin; | |
19 } | 18 } |
20 | 19 |
21 class IndexedDBContext { | 20 class IndexedDBContext { |
22 public: | 21 public: |
23 explicit IndexedDBContext(WebKitContext* webkit_context); | 22 explicit IndexedDBContext(WebKitContext* webkit_context); |
24 ~IndexedDBContext(); | 23 ~IndexedDBContext(); |
25 | 24 |
26 WebKit::WebIDBFactory* GetIDBFactory(); | 25 WebKit::WebIDBFactory* GetIDBFactory(); |
27 | 26 |
28 // The indexed db directory. | 27 // The indexed db directory. |
29 static const FilePath::CharType kIndexedDBDirectory[]; | 28 static const FilePath::CharType kIndexedDBDirectory[]; |
30 | 29 |
31 // The indexed db file extension. | 30 // The indexed db file extension. |
32 static const FilePath::CharType kIndexedDBExtension[]; | 31 static const FilePath::CharType kIndexedDBExtension[]; |
33 | 32 |
34 // Get the file name of the indexed db file for the given origin and database | 33 // Get the file name of the indexed db file for the given origin. |
35 // name. | 34 FilePath GetIndexedDBFilePath(const string16& origin_id) const; |
36 FilePath GetIndexedDBFilePath(const string16& database_name, | |
37 const WebKit::WebSecurityOrigin& origin) const; | |
38 | |
39 // Splits an indexed database file name into a security origin and a | |
40 // database name. | |
41 static bool SplitIndexedDBFileName( | |
42 const FilePath& file_name, | |
43 std::string* database_name, | |
44 WebKit::WebSecurityOrigin* security_origin); | |
45 | 35 |
46 private: | 36 private: |
47 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; | 37 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; |
48 | 38 |
49 // We're owned by this WebKit context. | 39 // We're owned by this WebKit context. |
50 WebKitContext* webkit_context_; | 40 WebKitContext* webkit_context_; |
51 | 41 |
52 DISALLOW_COPY_AND_ASSIGN(IndexedDBContext); | 42 DISALLOW_COPY_AND_ASSIGN(IndexedDBContext); |
53 }; | 43 }; |
54 | 44 |
55 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ | 45 #endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_ |
OLD | NEW |