Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_HISTORY_ANDROID_ANDROID_CACHE_DATABASE_H_ | |
| 6 #define CHROME_BROWSER_HISTORY_ANDROID_ANDROID_CACHE_DATABASE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/file_path.h" | |
| 10 #include "base/gtest_prod_util.h" | |
| 11 #include "base/time.h" | |
| 12 #include "chrome/browser/history/android/android_history_types.h" | |
| 13 #include "sql/connection.h" | |
| 14 #include "sql/init_status.h" | |
| 15 | |
| 16 namespace history { | |
| 17 | |
| 18 // This database is used to support Android ContentProvider APIs. | |
| 19 // It will be created only when it used, and deleted when history | |
| 20 // system shutdown. | |
| 21 class AndroidCacheDatabase { | |
|
sky
2012/03/02 15:59:50
Be sure and document the return value of all metho
michaelbai
2012/03/02 20:04:43
Done.
| |
| 22 public: | |
| 23 AndroidCacheDatabase(); | |
| 24 virtual ~AndroidCacheDatabase(); | |
| 25 | |
| 26 // Create the database, delete existing one if any; Also attach it to the | |
| 27 // database returned by GetDB(). | |
| 28 sql::InitStatus InitAndroidCacheDatabase(const FilePath& db_name); | |
| 29 | |
| 30 // Add a row in bookmark_cache table. | |
|
sky
2012/03/02 15:59:50
'Adds a row to the ...'
michaelbai
2012/03/02 20:04:43
Done.
| |
| 31 bool AddBookmarkCacheRow(const base::Time& created_time, | |
| 32 const base::Time& last_visit_time, | |
| 33 URLID url_id); | |
| 34 | |
| 35 // Clear all rows in bookmark_cache table. | |
| 36 bool ClearAllBookmarkCacheRow(); | |
|
sky
2012/03/02 15:59:50
Either ClearAllBookmarkCacheRows or just ClearBook
michaelbai
2012/03/02 20:04:43
Done.
| |
| 37 | |
| 38 // Set the bookmark column as 1 for the given |url_ids| rows. | |
|
sky
2012/03/02 15:59:50
Set -> Sets. Document return value.
michaelbai
2012/03/02 20:04:43
Done.
| |
| 39 bool CacheBookmarkBits(const std::vector<URLID>& url_id); | |
|
sky
2012/03/02 15:59:50
This description doesn't match that I thought the
michaelbai
2012/03/02 20:04:43
Done.
| |
| 40 | |
| 41 // Set the favicon column to |favicon_id| for the given |url_id| row. | |
|
sky
2012/03/02 15:59:50
Set -> Sets
michaelbai
2012/03/02 20:04:43
Done.
| |
| 42 bool CacheFaviconID(URLID url_id, FaviconID favicon_id); | |
|
sky
2012/03/02 15:59:50
Name this to match your description: SetFaviconID.
michaelbai
2012/03/02 20:04:43
Done.
| |
| 43 | |
| 44 protected: | |
| 45 // Returns the database for the functions in this interface. The decendent of | |
| 46 // this class implements these functions to return its objects. | |
| 47 virtual sql::Connection& GetDB() = 0; | |
| 48 | |
| 49 private: | |
| 50 FRIEND_TEST_ALL_PREFIXES(AndroidCacheDatabaseTest, | |
| 51 CreateDatabase); | |
| 52 | |
| 53 // Create the database and make it ready for attaching. | |
| 54 bool CreateDatabase(const FilePath& db_name); | |
| 55 | |
| 56 // Create the bookmark_cache table in attached DB. | |
| 57 bool CreateBookmarkCacheTable(); | |
| 58 | |
| 59 // Attach to history database. | |
| 60 bool Attach(); | |
| 61 | |
| 62 FilePath db_name_; | |
| 63 bool db_attached_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(AndroidCacheDatabase); | |
| 66 }; | |
| 67 | |
| 68 } // namespace history | |
| 69 | |
| 70 #endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_CACHE_DATABASE_H_ | |
| OLD | NEW |