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 CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ |
6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ | 6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/webdata/autofill_table.h" | 10 #include "chrome/browser/webdata/autofill_table.h" |
11 #include "chrome/browser/webdata/keyword_table.h" | 11 #include "chrome/browser/webdata/keyword_table.h" |
12 #include "chrome/browser/webdata/logins_table.h" | 12 #include "chrome/browser/webdata/logins_table.h" |
13 #include "chrome/browser/webdata/token_service_table.h" | 13 #include "chrome/browser/webdata/token_service_table.h" |
14 #include "chrome/browser/webdata/web_apps_table.h" | 14 #include "chrome/browser/webdata/web_apps_table.h" |
| 15 #include "chrome/browser/webdata/web_intents_table.h" |
15 #include "sql/connection.h" | 16 #include "sql/connection.h" |
16 #include "sql/init_status.h" | 17 #include "sql/init_status.h" |
17 #include "sql/meta_table.h" | 18 #include "sql/meta_table.h" |
18 | 19 |
19 class FilePath; | 20 class FilePath; |
20 class NotificationService; | 21 class NotificationService; |
21 | 22 |
22 // This class manages a SQLite database that stores various web page meta data. | 23 // This class manages a SQLite database that stores various web page meta data. |
23 class WebDatabase { | 24 class WebDatabase { |
24 public: | 25 public: |
25 WebDatabase(); | 26 WebDatabase(); |
26 virtual ~WebDatabase(); | 27 virtual ~WebDatabase(); |
27 | 28 |
28 // Initialize the database given a name. The name defines where the SQLite | 29 // Initialize the database given a name. The name defines where the SQLite |
29 // file is. If this returns an error code, no other method should be called. | 30 // file is. If this returns an error code, no other method should be called. |
30 sql::InitStatus Init(const FilePath& db_name); | 31 sql::InitStatus Init(const FilePath& db_name); |
31 | 32 |
32 // Transactions management | 33 // Transactions management |
33 void BeginTransaction(); | 34 void BeginTransaction(); |
34 void CommitTransaction(); | 35 void CommitTransaction(); |
35 | 36 |
36 virtual AutofillTable* GetAutofillTable(); | 37 virtual AutofillTable* GetAutofillTable(); |
37 virtual KeywordTable* GetKeywordTable(); | 38 virtual KeywordTable* GetKeywordTable(); |
38 virtual LoginsTable* GetLoginsTable(); | 39 virtual LoginsTable* GetLoginsTable(); |
39 virtual TokenServiceTable* GetTokenServiceTable(); | 40 virtual TokenServiceTable* GetTokenServiceTable(); |
40 virtual WebAppsTable* GetWebAppsTable(); | 41 virtual WebAppsTable* GetWebAppsTable(); |
| 42 virtual WebIntentsTable* GetWebIntentsTable(); |
41 | 43 |
42 // Exposed for testing only. | 44 // Exposed for testing only. |
43 sql::Connection* GetSQLConnection(); | 45 sql::Connection* GetSQLConnection(); |
44 | 46 |
45 private: | 47 private: |
46 // Used by |Init()| to migration database schema from older versions to | 48 // Used by |Init()| to migration database schema from older versions to |
47 // current version. | 49 // current version. |
48 sql::InitStatus MigrateOldVersionsAsNeeded(); | 50 sql::InitStatus MigrateOldVersionsAsNeeded(); |
49 | 51 |
50 sql::Connection db_; | 52 sql::Connection db_; |
51 sql::MetaTable meta_table_; | 53 sql::MetaTable meta_table_; |
52 | 54 |
53 scoped_ptr<AutofillTable> autofill_table_; | 55 scoped_ptr<AutofillTable> autofill_table_; |
54 scoped_ptr<KeywordTable> keyword_table_; | 56 scoped_ptr<KeywordTable> keyword_table_; |
55 scoped_ptr<LoginsTable> logins_table_; | 57 scoped_ptr<LoginsTable> logins_table_; |
56 scoped_ptr<TokenServiceTable> token_service_table_; | 58 scoped_ptr<TokenServiceTable> token_service_table_; |
57 scoped_ptr<WebAppsTable> web_apps_table_; | 59 scoped_ptr<WebAppsTable> web_apps_table_; |
| 60 scoped_ptr<WebIntentsTable> web_intents_table_; |
58 | 61 |
59 scoped_ptr<NotificationService> notification_service_; | 62 scoped_ptr<NotificationService> notification_service_; |
60 | 63 |
61 DISALLOW_COPY_AND_ASSIGN(WebDatabase); | 64 DISALLOW_COPY_AND_ASSIGN(WebDatabase); |
62 }; | 65 }; |
63 | 66 |
64 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ | 67 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_H_ |
OLD | NEW |