| 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 COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // Returns true if successful. | 122 // Returns true if successful. |
| 123 bool DeleteFaviconBitmap(FaviconBitmapID bitmap_id); | 123 bool DeleteFaviconBitmap(FaviconBitmapID bitmap_id); |
| 124 | 124 |
| 125 // Favicons ------------------------------------------------------------------ | 125 // Favicons ------------------------------------------------------------------ |
| 126 | 126 |
| 127 // Sets the the favicon as out of date. This will set |last_updated| for all | 127 // Sets the the favicon as out of date. This will set |last_updated| for all |
| 128 // of the bitmaps for |icon_id| to be out of date. | 128 // of the bitmaps for |icon_id| to be out of date. |
| 129 bool SetFaviconOutOfDate(favicon_base::FaviconID icon_id); | 129 bool SetFaviconOutOfDate(favicon_base::FaviconID icon_id); |
| 130 | 130 |
| 131 // Returns the id of the entry in the favicon database with the specified url | 131 // Returns the id of the entry in the favicon database with the specified url |
| 132 // and icon type. If |required_icon_type| contains multiple icon types and | 132 // and icon type. |
| 133 // there are more than one matched icon in database, only one icon will be | |
| 134 // returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and | |
| 135 // FAVICON, and the icon type is returned in icon_type parameter if it is not | |
| 136 // NULL. | |
| 137 // Returns 0 if no entry exists for the specified url. | 133 // Returns 0 if no entry exists for the specified url. |
| 138 favicon_base::FaviconID GetFaviconIDForFaviconURL( | 134 favicon_base::FaviconID GetFaviconIDForFaviconURL( |
| 139 const GURL& icon_url, | 135 const GURL& icon_url, |
| 140 int required_icon_type, | 136 favicon_base::IconType icon_type); |
| 141 favicon_base::IconType* icon_type); | |
| 142 | 137 |
| 143 // Gets the icon_url, icon_type and sizes for the specified |icon_id|. | 138 // Gets the icon_url, icon_type and sizes for the specified |icon_id|. |
| 144 bool GetFaviconHeader(favicon_base::FaviconID icon_id, | 139 bool GetFaviconHeader(favicon_base::FaviconID icon_id, |
| 145 GURL* icon_url, | 140 GURL* icon_url, |
| 146 favicon_base::IconType* icon_type); | 141 favicon_base::IconType* icon_type); |
| 147 | 142 |
| 148 // Adds favicon with |icon_url|, |icon_type| and |favicon_sizes| to the | 143 // Adds favicon with |icon_url|, |icon_type| and |favicon_sizes| to the |
| 149 // favicon db, returning its id. | 144 // favicon db, returning its id. |
| 150 favicon_base::FaviconID AddFavicon(const GURL& icon_url, | 145 favicon_base::FaviconID AddFavicon(const GURL& icon_url, |
| 151 favicon_base::IconType icon_type); | 146 favicon_base::IconType icon_type); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 163 bool DeleteFavicon(favicon_base::FaviconID id); | 158 bool DeleteFavicon(favicon_base::FaviconID id); |
| 164 | 159 |
| 165 // Icon Mapping -------------------------------------------------------------- | 160 // Icon Mapping -------------------------------------------------------------- |
| 166 // | 161 // |
| 167 // Returns true if there is a matched icon mapping for the given page and | 162 // Returns true if there is a matched icon mapping for the given page and |
| 168 // icon type. | 163 // icon type. |
| 169 // The matched icon mapping is returned in the icon_mapping parameter if it is | 164 // The matched icon mapping is returned in the icon_mapping parameter if it is |
| 170 // not NULL. | 165 // not NULL. |
| 171 | 166 |
| 172 // Returns true if there are icon mappings for the given page and icon types. | 167 // Returns true if there are icon mappings for the given page and icon types. |
| 173 // If |required_icon_types| contains multiple icon types and there is more | |
| 174 // than one matched icon type in the database, icons of only a single type | |
| 175 // will be returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, | |
| 176 // and FAVICON. | |
| 177 // The matched icon mappings are returned in the |mapping_data| parameter if | 168 // The matched icon mappings are returned in the |mapping_data| parameter if |
| 178 // it is not NULL. | 169 // it is not NULL. |
| 179 bool GetIconMappingsForPageURL(const GURL& page_url, | 170 bool GetIconMappingsForPageURL(const GURL& page_url, |
| 180 int required_icon_types, | 171 int required_icon_types, |
| 181 std::vector<IconMapping>* mapping_data); | 172 std::vector<IconMapping>* mapping_data); |
| 182 | 173 |
| 183 // Returns true if there is any matched icon mapping for the given page. | 174 // Returns true if there is any matched icon mapping for the given page. |
| 184 // All matched icon mappings are returned in descent order of IconType if | 175 // The matched icon mappings are returned in the |mapping_data| parameter if |
| 185 // mapping_data is not NULL. | 176 // it is not NULL. |
| 186 bool GetIconMappingsForPageURL(const GURL& page_url, | 177 bool GetIconMappingsForPageURL(const GURL& page_url, |
| 187 std::vector<IconMapping>* mapping_data); | 178 std::vector<IconMapping>* mapping_data); |
| 188 | 179 |
| 189 // Adds a mapping between the given page_url and icon_id. | 180 // Adds a mapping between the given page_url and icon_id. |
| 190 // Returns the new mapping id if the adding succeeds, otherwise 0 is returned. | 181 // Returns the new mapping id if the adding succeeds, otherwise 0 is returned. |
| 191 IconMappingID AddIconMapping(const GURL& page_url, | 182 IconMappingID AddIconMapping(const GURL& page_url, |
| 192 favicon_base::FaviconID icon_id); | 183 favicon_base::FaviconID icon_id); |
| 193 | 184 |
| 194 // Deletes the icon mapping entries for the given page url. | 185 // Deletes the icon mapping entries for the given page url. |
| 195 // Returns true if the deletion succeeded. | 186 // Returns true if the deletion succeeded. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 263 |
| 273 sql::Connection db_; | 264 sql::Connection db_; |
| 274 sql::MetaTable meta_table_; | 265 sql::MetaTable meta_table_; |
| 275 | 266 |
| 276 HistoryBackendClient* backend_client_; | 267 HistoryBackendClient* backend_client_; |
| 277 }; | 268 }; |
| 278 | 269 |
| 279 } // namespace history | 270 } // namespace history |
| 280 | 271 |
| 281 #endif // COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ | 272 #endif // COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ |
| OLD | NEW |