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