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 CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ | 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ |
6 #define CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ | 6 #define CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "chrome/browser/webdata/web_database_table.h" | 13 #include "chrome/browser/webdata/web_database_table.h" |
14 | 14 |
15 namespace sql { | 15 namespace sql { |
16 class Connection; | 16 class Connection; |
17 class MetaTable; | 17 class MetaTable; |
18 } | 18 } |
19 | 19 |
20 struct DefaultWebIntentService; | 20 struct DefaultWebIntentService; |
| 21 class WebDatabase; |
21 | 22 |
22 // TODO(thakis): Delete this class once there's a migration that drops the | 23 // TODO(thakis): Delete this class once there's a migration that drops the |
23 // table backing it. | 24 // table backing it. |
24 | 25 |
25 // This class manages the WebIntents table within the SQLite database passed | 26 // This class manages the WebIntents table within the SQLite database passed |
26 // to the constructor. It expects the following schema: | 27 // to the constructor. It expects the following schema: |
27 // | 28 // |
28 // web_intents | 29 // web_intents |
29 // service_url URL for service invocation. | 30 // service_url URL for service invocation. |
30 // action Name of action provided by the service. | 31 // action Name of action provided by the service. |
(...skipping 12 matching lines...) Expand all Loading... |
43 // url_prefix URL prefix for which the default is invoked. | 44 // url_prefix URL prefix for which the default is invoked. |
44 // user_date Epoch time when the user made this default. | 45 // user_date Epoch time when the user made this default. |
45 // suppression Set if the default is (temporarily) suppressed. | 46 // suppression Set if the default is (temporarily) suppressed. |
46 // service_url The URL of a service in the web_intents table. | 47 // service_url The URL of a service in the web_intents table. |
47 // extension_url The URL for an extension handling intents. | 48 // extension_url The URL for an extension handling intents. |
48 // | 49 // |
49 // The defaults are scoped by action, then type, then url prefix. | 50 // The defaults are scoped by action, then type, then url prefix. |
50 // | 51 // |
51 class WebIntentsTable : public WebDatabaseTable { | 52 class WebIntentsTable : public WebDatabaseTable { |
52 public: | 53 public: |
53 WebIntentsTable(sql::Connection* db, sql::MetaTable* meta_table); | 54 WebIntentsTable(); |
54 virtual ~WebIntentsTable(); | 55 virtual ~WebIntentsTable(); |
55 | 56 |
| 57 // Retrieves the WebIntentsTable* owned by |database|. |
| 58 static WebIntentsTable* FromWebDatabase(WebDatabase* database); |
| 59 |
56 // WebDatabaseTable implementation. | 60 // WebDatabaseTable implementation. |
57 virtual bool Init() OVERRIDE; | 61 virtual WebDatabaseTable::TypeKey GetTypeKey() const OVERRIDE; |
| 62 virtual bool Init(sql::Connection* db, sql::MetaTable* meta_table) OVERRIDE; |
58 virtual bool IsSyncable() OVERRIDE; | 63 virtual bool IsSyncable() OVERRIDE; |
59 virtual bool MigrateToVersion(int version, | 64 virtual bool MigrateToVersion(int version, |
60 const std::string& app_locale, | 65 const std::string& app_locale, |
61 bool* update_compatible_version) OVERRIDE; | 66 bool* update_compatible_version) OVERRIDE; |
62 | 67 |
63 // Adds "scheme" column to the web_intents and web_intents_defaults tables. | 68 // Adds "scheme" column to the web_intents and web_intents_defaults tables. |
64 bool MigrateToVersion46AddSchemeColumn(); | 69 bool MigrateToVersion46AddSchemeColumn(); |
65 | 70 |
66 private: | 71 private: |
67 DISALLOW_COPY_AND_ASSIGN(WebIntentsTable); | 72 DISALLOW_COPY_AND_ASSIGN(WebIntentsTable); |
68 }; | 73 }; |
69 | 74 |
70 #endif // CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ | 75 #endif // CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ |
OLD | NEW |