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

Side by Side Diff: chrome/browser/history/top_sites_database.h

Issue 9071014: Database usage adjustment for .../history (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify SQL Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_HISTORY_TOP_SITES_DATABASE_H_
6 #define CHROME_BROWSER_HISTORY_TOP_SITES_DATABASE_H_ 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_DATABASE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 // Adds a new URL to the database. 78 // Adds a new URL to the database.
79 void AddPageThumbnail(const MostVisitedURL& url, 79 void AddPageThumbnail(const MostVisitedURL& url,
80 int new_rank, 80 int new_rank,
81 const Images& thumbnail); 81 const Images& thumbnail);
82 82
83 // Sets the page rank. Should be called within an open transaction. 83 // Sets the page rank. Should be called within an open transaction.
84 void UpdatePageRankNoTransaction(const MostVisitedURL& url, int new_rank); 84 void UpdatePageRankNoTransaction(const MostVisitedURL& url, int new_rank);
85 85
86 // Updates thumbnail of a URL that's already in the database. 86 // Updates thumbnail of a URL that's already in the database.
87 void UpdatePageThumbnail(const MostVisitedURL& url, 87 // Returns true if the database query succeeds.
88 bool UpdatePageThumbnail(const MostVisitedURL& url,
88 const Images& thumbnail); 89 const Images& thumbnail);
89 90
90 // Returns the URL's current rank or -1 if it is not present. 91 // Returns the URL's current rank or -1 if it is not present.
91 int GetURLRank(const MostVisitedURL& url); 92 int GetURLRank(const MostVisitedURL& url);
92 93
93 // Returns the number of URLs (rows) in the database. 94 // Returns the number of URLs (rows) in the database.
94 int GetRowCount(); 95 int GetRowCount();
95 96
96 sql::Connection* CreateDB(const FilePath& db_name); 97 sql::Connection* CreateDB(const FilePath& db_name);
97 98
98 // Encodes redirects into a string. 99 // Encodes redirects into a string.
99 static std::string GetRedirects(const MostVisitedURL& url); 100 static std::string GetRedirects(const MostVisitedURL& url);
100 101
101 // Decodes redirects from a string and sets them for the url. 102 // Decodes redirects from a string and sets them for the url.
102 static void SetRedirects(const std::string& redirects, MostVisitedURL* url); 103 static void SetRedirects(const std::string& redirects, MostVisitedURL* url);
103 104
104 scoped_ptr<sql::Connection> db_; 105 scoped_ptr<sql::Connection> db_;
105 sql::MetaTable meta_table_; 106 sql::MetaTable meta_table_;
106 107
107 // See description above class. 108 // See description above class.
108 bool may_need_history_migration_; 109 bool may_need_history_migration_;
109 110
110 DISALLOW_COPY_AND_ASSIGN(TopSitesDatabase); 111 DISALLOW_COPY_AND_ASSIGN(TopSitesDatabase);
111 }; 112 };
112 113
113 } // namespace history 114 } // namespace history
114 115
115 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_DATABASE_H_ 116 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_DATABASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/thumbnail_database.cc ('k') | chrome/browser/history/top_sites_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698