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_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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "chrome/browser/intents/web_intent_data.h" | 13 #include "chrome/browser/intents/web_intent_data.h" |
14 #include "chrome/browser/webdata/web_database_table.h" | 14 #include "chrome/browser/webdata/web_database_table.h" |
15 | 15 |
16 class GURL; | 16 class GURL; |
17 | 17 |
| 18 namespace sql { |
| 19 class Connection; |
| 20 class MetaTable; |
| 21 } |
| 22 |
18 // This class manages the WebIntents table within the SQLite database passed | 23 // This class manages the WebIntents table within the SQLite database passed |
19 // to the constructor. It expects the following schema: | 24 // to the constructor. It expects the following schema: |
20 // | 25 // |
21 // web_intents | 26 // web_intents |
22 // service_url URL for service invocation. | 27 // service_url URL for service invocation. |
23 // action Name of action provided by the service. | 28 // action Name of action provided by the service. |
24 // type MIME type of data accepted by the service. | 29 // type MIME type of data accepted by the service. |
25 // | 30 // |
26 // Intents are uniquely identified by the <service_url,action,type> tuple. | 31 // Intents are uniquely identified by the <service_url,action,type> tuple. |
27 class WebIntentsTable : public WebDatabaseTable { | 32 class WebIntentsTable : public WebDatabaseTable { |
28 public: | 33 public: |
29 WebIntentsTable(sql::Connection* db, sql::MetaTable* meta_table); | 34 WebIntentsTable(sql::Connection* db, sql::MetaTable* meta_table); |
30 virtual ~WebIntentsTable(); | 35 virtual ~WebIntentsTable(); |
31 | 36 |
32 // WebDatabaseTable implementation. | 37 // WebDatabaseTable implementation. |
33 virtual bool Init(); | 38 virtual bool Init(); |
34 virtual bool IsSyncable(); | 39 virtual bool IsSyncable(); |
35 | 40 |
36 // Adds a web intent to the WebIntents table. If intent already exists, | 41 // Adds a web intent to the WebIntents table. If intent already exists, |
37 // replaces it. | 42 // replaces it. |
38 bool SetWebIntent(const string16& action, | 43 bool SetWebIntent(const WebIntentData& intent); |
39 const string16& type, | |
40 const GURL& service_url); | |
41 | 44 |
42 // Retrieve all intents from WebIntents table that match |action|. | 45 // Retrieve all intents from WebIntents table that match |action|. |
43 bool GetWebIntents(const string16& action, | 46 bool GetWebIntents(const string16& action, |
44 std::vector<WebIntentData>* intents); | 47 std::vector<WebIntentData>* intents); |
45 | 48 |
46 // Removes intent from WebIntents table - must match all parameters exactly. | 49 // Removes intent from WebIntents table - must match all parameters exactly. |
47 bool RemoveWebIntent(const string16& action, | 50 bool RemoveWebIntent(const WebIntentData& intent); |
48 const string16& type, | |
49 const GURL& service_url); | |
50 | 51 |
51 private: | 52 private: |
52 DISALLOW_COPY_AND_ASSIGN(WebIntentsTable); | 53 DISALLOW_COPY_AND_ASSIGN(WebIntentsTable); |
53 }; | 54 }; |
54 | 55 |
55 #endif // CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ | 56 #endif // CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ |
OLD | NEW |