| 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/compiler_specific.h" |
| 12 #include "base/string16.h" | 13 #include "base/string16.h" |
| 13 #include "chrome/browser/webdata/web_database_table.h" | 14 #include "chrome/browser/webdata/web_database_table.h" |
| 14 #include "webkit/glue/web_intent_service_data.h" | 15 #include "webkit/glue/web_intent_service_data.h" |
| 15 | 16 |
| 16 namespace sql { | 17 namespace sql { |
| 17 class Connection; | 18 class Connection; |
| 18 class MetaTable; | 19 class MetaTable; |
| 19 } | 20 } |
| 20 | 21 |
| 21 // This class manages the WebIntents table within the SQLite database passed | 22 // This class manages the WebIntents table within the SQLite database passed |
| 22 // to the constructor. It expects the following schema: | 23 // to the constructor. It expects the following schema: |
| 23 // | 24 // |
| 24 // web_intents | 25 // web_intents |
| 25 // service_url URL for service invocation. | 26 // service_url URL for service invocation. |
| 26 // action Name of action provided by the service. | 27 // action Name of action provided by the service. |
| 27 // type MIME type of data accepted by the service. | 28 // type MIME type of data accepted by the service. |
| 28 // | 29 // |
| 29 // Intents are uniquely identified by the <service_url,action,type> tuple. | 30 // Intents are uniquely identified by the <service_url,action,type> tuple. |
| 30 class WebIntentsTable : public WebDatabaseTable { | 31 class WebIntentsTable : public WebDatabaseTable { |
| 31 public: | 32 public: |
| 32 WebIntentsTable(sql::Connection* db, sql::MetaTable* meta_table); | 33 WebIntentsTable(sql::Connection* db, sql::MetaTable* meta_table); |
| 33 virtual ~WebIntentsTable(); | 34 virtual ~WebIntentsTable(); |
| 34 | 35 |
| 35 // WebDatabaseTable implementation. | 36 // WebDatabaseTable implementation. |
| 36 virtual bool Init(); | 37 virtual bool Init() OVERRIDE; |
| 37 virtual bool IsSyncable(); | 38 virtual bool IsSyncable() OVERRIDE; |
| 38 | 39 |
| 39 // Adds a web intent service to the WebIntents table. | 40 // Adds a web intent service to the WebIntents table. |
| 40 // If |service| already exists, replaces it. | 41 // If |service| already exists, replaces it. |
| 41 bool SetWebIntentService(const webkit_glue::WebIntentServiceData& service); | 42 bool SetWebIntentService(const webkit_glue::WebIntentServiceData& service); |
| 42 | 43 |
| 43 // Retrieve all |services| from WebIntents table that match |action|. | 44 // Retrieve all |services| from WebIntents table that match |action|. |
| 44 bool GetWebIntentServices( | 45 bool GetWebIntentServices( |
| 45 const string16& action, | 46 const string16& action, |
| 46 std::vector<webkit_glue::WebIntentServiceData>* services); | 47 std::vector<webkit_glue::WebIntentServiceData>* services); |
| 47 | 48 |
| 48 // Retrieves all |services| from WebIntents table that match |service_url|. | 49 // Retrieves all |services| from WebIntents table that match |service_url|. |
| 49 bool GetWebIntentServicesForURL( | 50 bool GetWebIntentServicesForURL( |
| 50 const string16& service_url, | 51 const string16& service_url, |
| 51 std::vector<webkit_glue::WebIntentServiceData>* services); | 52 std::vector<webkit_glue::WebIntentServiceData>* services); |
| 52 | 53 |
| 53 // Retrieve all |services| from WebIntents table. | 54 // Retrieve all |services| from WebIntents table. |
| 54 bool GetAllWebIntentServices( | 55 bool GetAllWebIntentServices( |
| 55 std::vector<webkit_glue::WebIntentServiceData>* services); | 56 std::vector<webkit_glue::WebIntentServiceData>* services); |
| 56 | 57 |
| 57 // Removes |service| from WebIntents table - must match all parameters | 58 // Removes |service| from WebIntents table - must match all parameters |
| 58 // exactly. | 59 // exactly. |
| 59 bool RemoveWebIntentService(const webkit_glue::WebIntentServiceData& service); | 60 bool RemoveWebIntentService(const webkit_glue::WebIntentServiceData& service); |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 DISALLOW_COPY_AND_ASSIGN(WebIntentsTable); | 63 DISALLOW_COPY_AND_ASSIGN(WebIntentsTable); |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 #endif // CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ | 66 #endif // CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ |
| OLD | NEW |