OLD | NEW |
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 CHROME_BROWSER_HISTORY_TOP_SITES_DATABASE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_DATABASE_H_ |
6 #define CHROME_BROWSER_HISTORY_TOP_SITES_DATABASE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_DATABASE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "components/history/core/browser/history_types.h" | 12 #include "components/history/core/browser/history_types.h" |
13 #include "sql/meta_table.h" | 13 #include "sql/meta_table.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class FilePath; | 16 class FilePath; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Adds a new URL to the database. | 79 // Adds a new URL to the database. |
80 void AddPageThumbnail(const MostVisitedURL& url, | 80 void AddPageThumbnail(const MostVisitedURL& url, |
81 int new_rank, | 81 int new_rank, |
82 const Images& thumbnail); | 82 const Images& thumbnail); |
83 | 83 |
84 // Sets the page rank. Should be called within an open transaction. | 84 // Sets the page rank. Should be called within an open transaction. |
85 void UpdatePageRankNoTransaction(const MostVisitedURL& url, int new_rank); | 85 void UpdatePageRankNoTransaction(const MostVisitedURL& url, int new_rank); |
86 | 86 |
87 // Updates thumbnail of a URL that's already in the database. | 87 // Updates thumbnail of a URL that's already in the database. |
88 // Returns true if the database query succeeds. | 88 // Returns true if the database query succeeds. |
89 bool UpdatePageThumbnail(const MostVisitedURL& url, | 89 bool UpdatePageThumbnail(const MostVisitedURL& url, const Images& thumbnail); |
90 const Images& thumbnail); | |
91 | 90 |
92 // Returns |url|'s current rank or kRankOfNonExistingURL if not present. | 91 // Returns |url|'s current rank or kRankOfNonExistingURL if not present. |
93 int GetURLRank(const MostVisitedURL& url); | 92 int GetURLRank(const MostVisitedURL& url); |
94 | 93 |
95 // Helper function to implement internals of Init(). This allows | 94 // Helper function to implement internals of Init(). This allows |
96 // Init() to retry in case of failure, since some failures will | 95 // Init() to retry in case of failure, since some failures will |
97 // invoke recovery code. | 96 // invoke recovery code. |
98 bool InitImpl(const base::FilePath& db_name); | 97 bool InitImpl(const base::FilePath& db_name); |
99 | 98 |
100 sql::Connection* CreateDB(const base::FilePath& db_name); | 99 sql::Connection* CreateDB(const base::FilePath& db_name); |
101 | 100 |
102 scoped_ptr<sql::Connection> db_; | 101 scoped_ptr<sql::Connection> db_; |
103 sql::MetaTable meta_table_; | 102 sql::MetaTable meta_table_; |
104 | 103 |
105 DISALLOW_COPY_AND_ASSIGN(TopSitesDatabase); | 104 DISALLOW_COPY_AND_ASSIGN(TopSitesDatabase); |
106 }; | 105 }; |
107 | 106 |
108 } // namespace history | 107 } // namespace history |
109 | 108 |
110 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_DATABASE_H_ | 109 #endif // COMPONENTS_HISTORY_CORE_BROWSER_TOP_SITES_DATABASE_H_ |
OLD | NEW |