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

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

Issue 10802066: Adds support for saving favicon size into history database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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) 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_THUMBNAIL_DATABASE_H_ 5 #ifndef CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_
6 #define CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ 6 #define CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_
7 7
8 #include <vector> 8 #include <vector>
9 #include <utility>
9 10
10 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/history/history_types.h" 13 #include "chrome/browser/history/history_types.h"
13 #include "sql/connection.h" 14 #include "sql/connection.h"
14 #include "sql/init_status.h" 15 #include "sql/init_status.h"
15 #include "sql/meta_table.h" 16 #include "sql/meta_table.h"
16 #include "sql/statement.h" 17 #include "sql/statement.h"
17 18
18 class FilePath; 19 class FilePath;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Sets the bits for a favicon. This should be png encoded data. 103 // Sets the bits for a favicon. This should be png encoded data.
103 // The time indicates the access time, and is used to detect when the favicon 104 // The time indicates the access time, and is used to detect when the favicon
104 // should be refreshed. 105 // should be refreshed.
105 bool SetFavicon(FaviconID icon_id, 106 bool SetFavicon(FaviconID icon_id,
106 scoped_refptr<base::RefCountedMemory> icon_data, 107 scoped_refptr<base::RefCountedMemory> icon_data,
107 base::Time time); 108 base::Time time);
108 109
109 // Sets the time the favicon was last updated. 110 // Sets the time the favicon was last updated.
110 bool SetFaviconLastUpdateTime(FaviconID icon_id, base::Time time); 111 bool SetFaviconLastUpdateTime(FaviconID icon_id, base::Time time);
111 112
112 // Returns the id of the entry in the favicon database with the specified url 113 // Returns list of favicon ids and the sizes of their associated bitmaps in
113 // and icon type. If |required_icon_type| contains multiple icon types and 114 // the favicon database with the specified url and icon type. If
114 // there are more than one matched icon in database, only one icon will be 115 // |required_icon_types| contains multiple icon types and there is more than
115 // returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and 116 // one matched icon type in the database, icons of only a single icon type
116 // FAVICON, and the icon type is returned in icon_type parameter if it is not 117 // will be returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON,
117 // NULL. 118 // and FAVICON.
118 // Returns 0 if no entry exists for the specified url. 119 void GetFaviconIDsForFaviconURL(
119 FaviconID GetFaviconIDForFaviconURL(const GURL& icon_url, 120 const GURL& icon_url,
120 int required_icon_type, 121 const int required_icon_types,
121 IconType* icon_type); 122 std::vector<FaviconIDAndSize>* id_size_listing);
122 123
123 // Gets the png encoded favicon, last updated time, icon_url and icon_type for 124 // Gets the png encoded favicon, last updated time, icon_url and icon_type for
124 // the specified favicon id. 125 // the specified favicon id.
125 bool GetFavicon(FaviconID icon_id, 126 bool GetFavicon(FaviconID icon_id,
126 base::Time* last_updated, 127 base::Time* last_updated,
127 std::vector<unsigned char>* png_icon_data, 128 std::vector<unsigned char>* png_icon_data,
128 GURL* icon_url, 129 GURL* icon_url,
130 gfx::Size* pixel_size,
129 IconType* icon_type); 131 IconType* icon_type);
130 132
131 // Adds the favicon URL and icon type to the favicon db, returning its id. 133 // Adds the favicon URL and icon type to the favicon db, returning its id.
132 FaviconID AddFavicon(const GURL& icon_url, IconType icon_type); 134 FaviconID AddFavicon(const GURL& icon_url,
135 const gfx::Size& pixel_size,
136 IconType icon_type);
133 137
134 // Delete the favicon with the provided id. Returns false on failure 138 // Delete the favicon with the provided id. Returns false on failure
135 bool DeleteFavicon(FaviconID id); 139 bool DeleteFavicon(FaviconID id);
136 140
137 // Icon Mapping -------------------------------------------------------------- 141 // Icon Mapping --------------------------------------------------------------
138 // 142 //
139 // Returns true if there is a matched icon mapping for the given page and 143 // Returns true if there are icon mappings for the given page and icon type.
140 // icon type. 144 // If |required_icon_types| contains multiple icon types and there is more
141 // The matched icon mapping is returned in the icon_mapping parameter if it is 145 // than on matched icon type in the database, icons of only a single type
142 // not NULL. 146 // will be returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON,
143 bool GetIconMappingForPageURL(const GURL& page_url, 147 // and FAVICON.
144 IconType required_icon_type, 148 // The matched icon mappings are returned in the icon_mappings parameter if
145 IconMapping* icon_mapping); 149 // it is not NULL.
150 bool GetIconMappingsForPageURL(const GURL& page_url,
151 int required_icon_types,
152 std::vector<IconMapping>* icon_mappings);
146 153
147 // Returns true if there is any matched icon mapping for the given page. 154 // Returns true if there is any matched icon mapping for the given page.
148 // All matched icon mappings are returned in descent order of IconType if 155 // All matched icon mappings are returned in descent order of IconType if
149 // mapping_data is not NULL. 156 // mapping_data is not NULL.
150 bool GetIconMappingsForPageURL(const GURL& page_url, 157 bool GetIconMappingsForPageURL(const GURL& page_url,
151 std::vector<IconMapping>* mapping_data); 158 std::vector<IconMapping>* mapping_data);
152 159
153 // Adds a mapping between the given page_url and icon_id. 160 // Adds a mapping between the given page_url and icon_id.
154 // Returns the new mapping id if the adding succeeds, otherwise 0 is returned. 161 // Returns the new mapping id if the adding succeeds, otherwise 0 is returned.
155 IconMappingID AddIconMapping(const GURL& page_url, FaviconID icon_id); 162 IconMappingID AddIconMapping(const GURL& page_url, FaviconID icon_id);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 const HistoryPublisher* history_publisher_; 336 const HistoryPublisher* history_publisher_;
330 337
331 // True if migration to TopSites has been done and the thumbnails 338 // True if migration to TopSites has been done and the thumbnails
332 // table should not be used. 339 // table should not be used.
333 bool use_top_sites_; 340 bool use_top_sites_;
334 }; 341 };
335 342
336 } // namespace history 343 } // namespace history
337 344
338 #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_ 345 #endif // CHROME_BROWSER_HISTORY_THUMBNAIL_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698