Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/browser/webdata/web_database_table.h

Issue 13392014: Move c/b/webdata/ code to components/webdata/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_DATABASE_TABLE_H_
6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_
7
8 #include "base/logging.h"
9
10 namespace sql {
11 class Connection;
12 class MetaTable;
13 }
14
15 // An abstract base class representing a table within a WebDatabase.
16 // Each table should subclass this, adding type-specific methods as needed.
17 class WebDatabaseTable {
18 public:
19 // To look up a WebDatabaseTable of a certain type from WebDatabase,
20 // we use a void* key, so that we can simply use the address of one
21 // of the type's statics.
22 typedef void* TypeKey;
23
24 // The object is not ready for use until Init() has been called.
25 WebDatabaseTable();
26 virtual ~WebDatabaseTable();
27
28 // Retrieves the TypeKey for the concrete subtype.
29 virtual TypeKey GetTypeKey() const = 0;
30
31 // Attempts to initialize the table and returns true if successful.
32 //
33 // The base class stores the members passed and always return true;
34 // subclasses may perform other initialization as needed.
35 virtual bool Init(sql::Connection* db, sql::MetaTable* meta_table);
36
37 // In order to encourage developers to think about sync when adding or
38 // or altering new tables, this method must be implemented. Please get in
39 // contact with the sync team if you believe you're making a change that they
40 // should be aware of (or if you could break something).
41 // TODO(andybons): Implement something more robust.
42 virtual bool IsSyncable() = 0;
43
44 // Migrates this table to |version|. Returns false if there was
45 // migration work to do and it failed, true otherwise.
46 //
47 // Implementations may set |*update_compatible_version| to true if
48 // the compatible version should be changed to |version|.
49 // Implementations should otherwise not modify this parameter.
50 virtual bool MigrateToVersion(int version,
51 bool* update_compatible_version) = 0;
52
53 protected:
54 // Non-owning. These are owned by WebDatabase, valid as long as that
55 // class exists. Since lifetime of WebDatabaseTable objects slightly
56 // exceeds that of WebDatabase, they should not be used in
57 // ~WebDatabaseTable.
58 sql::Connection* db_;
59 sql::MetaTable* meta_table_;
60
61 private:
62 DISALLOW_COPY_AND_ASSIGN(WebDatabaseTable);
63 };
64
65 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698