Move c/b/webdata/code which does not depend on chrome/ to components/webdata/
[chromium-blink-merge.git] / chrome / browser / webdata / web_intents_table.h
blob4dd48e323610912510a931dfc265f2fa3673c337
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.
5 #ifndef CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_
6 #define CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/string16.h"
13 #include "components/webdata/common/web_database_table.h"
15 namespace sql {
16 class Connection;
17 class MetaTable;
20 struct DefaultWebIntentService;
21 class WebDatabase;
23 // TODO(thakis): Delete this class once there's a migration that drops the
24 // table backing it.
26 // This class manages the WebIntents table within the SQLite database passed
27 // to the constructor. It expects the following schema:
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.
36 // Web Intent Services are uniquely identified by the <service_url,action,type>
37 // tuple.
39 // Also manages the defaults table:
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.
50 // The defaults are scoped by action, then type, then url prefix.
52 class WebIntentsTable : public WebDatabaseTable {
53 public:
54 WebIntentsTable();
55 virtual ~WebIntentsTable();
57 // Retrieves the WebIntentsTable* owned by |database|.
58 static WebIntentsTable* FromWebDatabase(WebDatabase* database);
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;
67 // Adds "scheme" column to the web_intents and web_intents_defaults tables.
68 bool MigrateToVersion46AddSchemeColumn();
70 private:
71 DISALLOW_COPY_AND_ASSIGN(WebIntentsTable);
74 #endif // CHROME_BROWSER_WEBDATA_WEB_INTENTS_TABLE_H_