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 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 8#include <vector> 9 10#include "base/basictypes.h" 11#include "base/compiler_specific.h" 12#include "base/strings/string16.h" 13#include "components/webdata/common/web_database_table.h" 14 15namespace sql { 16class Connection; 17class MetaTable; 18} 19 20struct DefaultWebIntentService; 21class WebDatabase; 22 23// TODO(thakis): Delete this class once there's a migration that drops the 24// table backing it. 25 26// This class manages the WebIntents table within the SQLite database passed 27// to the constructor. It expects the following schema: 28// 29// web_intents 30// service_url URL for service invocation. 31// action Name of action provided by the service. 32// type MIME type of data accepted by the service. 33// title Title for the service page 34// disposition Either 'window' or 'inline' disposition. 35// 36// Web Intent Services are uniquely identified by the <service_url,action,type> 37// tuple. 38// 39// Also manages the defaults table: 40// 41// web_intents_defaults 42// action Intent action for this default. 43// type Intent type for this default. 44// url_prefix URL prefix for which the default is invoked. 45// user_date Epoch time when the user made this default. 46// suppression Set if the default is (temporarily) suppressed. 47// service_url The URL of a service in the web_intents table. 48// extension_url The URL for an extension handling intents. 49// 50// The defaults are scoped by action, then type, then url prefix. 51// 52class WebIntentsTable : public WebDatabaseTable { 53 public: 54 WebIntentsTable(); 55 virtual ~WebIntentsTable(); 56 57 // Retrieves the WebIntentsTable* owned by |database|. 58 static WebIntentsTable* FromWebDatabase(WebDatabase* database); 59 60 // WebDatabaseTable implementation. 61 virtual WebDatabaseTable::TypeKey GetTypeKey() const OVERRIDE; 62 virtual bool Init(sql::Connection* db, sql::MetaTable* meta_table) OVERRIDE; 63 virtual bool IsSyncable() OVERRIDE; 64 virtual bool MigrateToVersion(int version, 65 bool* update_compatible_version) OVERRIDE; 66 67 // Adds "scheme" column to the web_intents and web_intents_defaults tables. 68 bool MigrateToVersion46AddSchemeColumn(); 69 70 private: 71 DISALLOW_COPY_AND_ASSIGN(WebIntentsTable); 72}; 73 74#endif // CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_ 75