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

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

Issue 12518017: Generalize migration code in WebDatabase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge of LKGR Created 7 years, 9 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
« no previous file with comments | « chrome/browser/webdata/web_database.cc ('k') | chrome/browser/webdata/web_intents_table.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DATABASE_TABLE_H_ 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_
6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_ 6 #define CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 namespace sql { 10 namespace sql {
11 class Connection; 11 class Connection;
12 class MetaTable; 12 class MetaTable;
13 } 13 }
14 14
15 // An abstract base class representing a table within a WebDatabase. 15 // An abstract base class representing a table within a WebDatabase.
16 // Each table should subclass this, adding type-specific methods as needed. 16 // Each table should subclass this, adding type-specific methods as needed.
17 class WebDatabaseTable { 17 class WebDatabaseTable {
18 protected: 18 public:
19 WebDatabaseTable(sql::Connection* db, sql::MetaTable* meta_table); 19 WebDatabaseTable(sql::Connection* db, sql::MetaTable* meta_table);
20 virtual ~WebDatabaseTable(); 20 virtual ~WebDatabaseTable();
21 21
22 // Attempts to initialize the table and returns true if successful. 22 // Attempts to initialize the table and returns true if successful.
23 virtual bool Init() = 0; 23 virtual bool Init() = 0;
24 24
25 // In order to encourage developers to think about sync when adding or 25 // In order to encourage developers to think about sync when adding or
26 // or altering new tables, this method must be implemented. Please get in 26 // or altering new tables, this method must be implemented. Please get in
27 // contact with the sync team if you believe you're making a change that they 27 // contact with the sync team if you believe you're making a change that they
28 // should be aware of (or if you could break something). 28 // should be aware of (or if you could break something).
29 // TODO(andybons): Implement something more robust. 29 // TODO(andybons): Implement something more robust.
30 virtual bool IsSyncable() = 0; 30 virtual bool IsSyncable() = 0;
31 31
32 // Migrates this table to |version|. Returns false if there was
33 // migration work to do and it failed, true otherwise.
34 //
35 // |app_locale| is the locale of the app. Passed as a parameter as
36 // |it can only be safely queried on the UI thread.
37 //
38 // Implementations may set |*update_compatible_version| to true if
39 // the compatible version should be changed to |version|.
40 // Implementations should otherwise not modify this parameter.
41 virtual bool MigrateToVersion(int version,
42 const std::string& app_locale,
43 bool* update_compatible_version) = 0;
44
45 protected:
32 sql::Connection* db_; 46 sql::Connection* db_;
33 sql::MetaTable* meta_table_; 47 sql::MetaTable* meta_table_;
34 48
35 private: 49 private:
36 DISALLOW_COPY_AND_ASSIGN(WebDatabaseTable); 50 DISALLOW_COPY_AND_ASSIGN(WebDatabaseTable);
37 }; 51 };
38 52
39 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_ 53 #endif // CHROME_BROWSER_WEBDATA_WEB_DATABASE_TABLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_database.cc ('k') | chrome/browser/webdata/web_intents_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698