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

Side by Side Diff: components/webdata/common/web_database.h

Issue 2107493002: Offer user to send feedback from profile error dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pkasting's & droger's Created 4 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ 5 #ifndef COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_
6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ 6 #define COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 23 matching lines...) Expand all
34 virtual ~WebDatabase(); 34 virtual ~WebDatabase();
35 35
36 // Adds a database table. Ownership remains with the caller, which 36 // Adds a database table. Ownership remains with the caller, which
37 // must ensure that the lifetime of |table| exceeds this object's 37 // must ensure that the lifetime of |table| exceeds this object's
38 // lifetime. Must only be called before Init. 38 // lifetime. Must only be called before Init.
39 void AddTable(WebDatabaseTable* table); 39 void AddTable(WebDatabaseTable* table);
40 40
41 // Retrieves a table based on its |key|. 41 // Retrieves a table based on its |key|.
42 WebDatabaseTable* GetTable(WebDatabaseTable::TypeKey key); 42 WebDatabaseTable* GetTable(WebDatabaseTable::TypeKey key);
43 43
44 // Call before Init() to set the error callback to be used for the
45 // underlying database connection.
46 void set_error_callback(
47 const sql::Connection::ErrorCallback& error_callback) {
48 db_.set_error_callback(error_callback);
49 }
50
44 // Initialize the database given a name. The name defines where the SQLite 51 // Initialize the database given a name. The name defines where the SQLite
45 // file is. If this returns an error code, no other method should be called. 52 // file is. If this returns an error code, no other method should be called.
46 // 53 //
47 // Before calling this method, you must call AddTable for any 54 // Before calling this method, you must call AddTable for any
48 // WebDatabaseTable objects that are supposed to participate in 55 // WebDatabaseTable objects that are supposed to participate in
49 // managing the database. 56 // managing the database.
50 sql::InitStatus Init(const base::FilePath& db_name); 57 sql::InitStatus Init(const base::FilePath& db_name);
51 58
52 // Transactions management 59 // Transactions management
53 void BeginTransaction(); 60 void BeginTransaction();
54 void CommitTransaction(); 61 void CommitTransaction();
55 62
63 std::string GetDiagnosticInfo(int extended_error, sql::Statement* statement);
64
56 // Exposed for testing only. 65 // Exposed for testing only.
57 sql::Connection* GetSQLConnection(); 66 sql::Connection* GetSQLConnection();
58 67
59 private: 68 private:
60 // Used by |Init()| to migration database schema from older versions to 69 // Used by |Init()| to migration database schema from older versions to
61 // current version. 70 // current version.
62 sql::InitStatus MigrateOldVersionsAsNeeded(); 71 sql::InitStatus MigrateOldVersionsAsNeeded();
63 72
64 // Migrates this database to |version|. Returns false if there was 73 // Migrates this database to |version|. Returns false if there was
65 // migration work to do and it failed, true otherwise. 74 // migration work to do and it failed, true otherwise.
(...skipping 12 matching lines...) Expand all
78 87
79 // Map of all the different tables that have been added to this 88 // Map of all the different tables that have been added to this
80 // object. Non-owning. 89 // object. Non-owning.
81 typedef std::map<WebDatabaseTable::TypeKey, WebDatabaseTable*> TableMap; 90 typedef std::map<WebDatabaseTable::TypeKey, WebDatabaseTable*> TableMap;
82 TableMap tables_; 91 TableMap tables_;
83 92
84 DISALLOW_COPY_AND_ASSIGN(WebDatabase); 93 DISALLOW_COPY_AND_ASSIGN(WebDatabase);
85 }; 94 };
86 95
87 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_ 96 #endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_H_
OLDNEW
« no previous file with comments | « components/webdata/common/web_data_service_base.h ('k') | components/webdata/common/web_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698