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.
5 #ifndef CHROME_BROWSER_HISTORY_IN_MEMORY_DATABASE_H_
6 #define CHROME_BROWSER_HISTORY_IN_MEMORY_DATABASE_H_
8 #include "base/basictypes.h"
9 #include "chrome/browser/history/url_database.h"
10 #include "sql/connection.h"
18 // Class used for a fast in-memory cache of typed URLs. Used for inline
19 // autocomplete since it is fast enough to be called synchronously as the user
21 class InMemoryDatabase : public URLDatabase {
24 virtual ~InMemoryDatabase();
26 // Creates an empty in-memory database.
27 bool InitFromScratch();
29 // Initializes the database by directly slurping the data from the given
30 // file. Conceptually, the InMemoryHistoryBackend should do the populating
31 // after this object does some common initialization, but that would be
33 bool InitFromDisk(const base::FilePath& history_name);
36 // Implemented for URLDatabase.
37 virtual sql::Connection& GetDB() OVERRIDE;
40 // Initializes the database connection, this is the shared code between
41 // InitFromScratch() and InitFromDisk() above. Returns true on success.
46 DISALLOW_COPY_AND_ASSIGN(InMemoryDatabase);
49 } // namespace history
51 #endif // CHROME_BROWSER_HISTORY_IN_MEMORY_DATABASE_H_