Index: chrome/browser/history/android/android_cache_database.h |
diff --git a/chrome/browser/history/android/android_cache_database.h b/chrome/browser/history/android/android_cache_database.h |
new file mode 100755 |
index 0000000000000000000000000000000000000000..d0ff3e2a660229c0ac2c28b1210642911b75303f |
--- /dev/null |
+++ b/chrome/browser/history/android/android_cache_database.h |
@@ -0,0 +1,70 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_HISTORY_ANDROID_ANDROID_CACHE_DATABASE_H_ |
+#define CHROME_BROWSER_HISTORY_ANDROID_ANDROID_CACHE_DATABASE_H_ |
+#pragma once |
+ |
+#include "base/file_path.h" |
+#include "base/gtest_prod_util.h" |
+#include "base/time.h" |
+#include "chrome/browser/history/android/android_history_types.h" |
+#include "sql/connection.h" |
+#include "sql/init_status.h" |
+ |
+namespace history { |
+ |
+// This database is used to support Android ContentProvider APIs. |
+// It will be created only when it used, and deleted when history |
+// system shutdown. |
+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.
|
+ public: |
+ AndroidCacheDatabase(); |
+ virtual ~AndroidCacheDatabase(); |
+ |
+ // Create the database, delete existing one if any; Also attach it to the |
+ // database returned by GetDB(). |
+ sql::InitStatus InitAndroidCacheDatabase(const FilePath& db_name); |
+ |
+ // 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.
|
+ bool AddBookmarkCacheRow(const base::Time& created_time, |
+ const base::Time& last_visit_time, |
+ URLID url_id); |
+ |
+ // Clear all rows in bookmark_cache table. |
+ bool ClearAllBookmarkCacheRow(); |
sky
2012/03/02 15:59:50
Either ClearAllBookmarkCacheRows or just ClearBook
michaelbai
2012/03/02 20:04:43
Done.
|
+ |
+ // 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.
|
+ 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.
|
+ |
+ // 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.
|
+ 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.
|
+ |
+ protected: |
+ // Returns the database for the functions in this interface. The decendent of |
+ // this class implements these functions to return its objects. |
+ virtual sql::Connection& GetDB() = 0; |
+ |
+ private: |
+ FRIEND_TEST_ALL_PREFIXES(AndroidCacheDatabaseTest, |
+ CreateDatabase); |
+ |
+ // Create the database and make it ready for attaching. |
+ bool CreateDatabase(const FilePath& db_name); |
+ |
+ // Create the bookmark_cache table in attached DB. |
+ bool CreateBookmarkCacheTable(); |
+ |
+ // Attach to history database. |
+ bool Attach(); |
+ |
+ FilePath db_name_; |
+ bool db_attached_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AndroidCacheDatabase); |
+}; |
+ |
+} // namespace history |
+ |
+#endif // CHROME_BROWSER_HISTORY_ANDROID_ANDROID_CACHE_DATABASE_H_ |