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_HISTORY_BACKEND_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 278 |
279 // Gets the number of URLs as seen in chrome://history within the time range | 279 // Gets the number of URLs as seen in chrome://history within the time range |
280 // [|begin_time|, |end_time|). Each URL is counted only once per day. For | 280 // [|begin_time|, |end_time|). Each URL is counted only once per day. For |
281 // determination of the date, timestamps are converted to dates using local | 281 // determination of the date, timestamps are converted to dates using local |
282 // time. | 282 // time. |
283 HistoryCountResult GetHistoryCount(const base::Time& begin_time, | 283 HistoryCountResult GetHistoryCount(const base::Time& begin_time, |
284 const base::Time& end_time); | 284 const base::Time& end_time); |
285 | 285 |
286 // Favicon ------------------------------------------------------------------- | 286 // Favicon ------------------------------------------------------------------- |
287 | 287 |
288 void GetFavicons( | 288 void GetFavicon( |
289 const std::vector<GURL>& icon_urls, | 289 const GURL& icon_url, |
290 int icon_types, | 290 favicon_base::IconType icon_type, |
291 const std::vector<int>& desired_sizes, | 291 const std::vector<int>& desired_sizes, |
292 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); | 292 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); |
293 | 293 |
294 void GetLargestFaviconForURL( | 294 void GetLargestFaviconForURL( |
295 const GURL& page_url, | 295 const GURL& page_url, |
296 const std::vector<int>& icon_types, | 296 const std::vector<int>& icon_types, |
297 int minimum_size_in_pixels, | 297 int minimum_size_in_pixels, |
298 favicon_base::FaviconRawBitmapResult* bitmap_result); | 298 favicon_base::FaviconRawBitmapResult* bitmap_result); |
299 | 299 |
300 void GetFaviconsForURL( | 300 void GetFaviconsForURL( |
301 const GURL& page_url, | 301 const GURL& page_url, |
302 int icon_types, | 302 int icon_types, |
303 const std::vector<int>& desired_sizes, | 303 const std::vector<int>& desired_sizes, |
304 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); | 304 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); |
305 | 305 |
306 void GetFaviconForID( | 306 void GetFaviconForID( |
307 favicon_base::FaviconID favicon_id, | 307 favicon_base::FaviconID favicon_id, |
308 int desired_size, | 308 int desired_size, |
309 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); | 309 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); |
310 | 310 |
311 void UpdateFaviconMappingsAndFetch( | 311 void UpdateFaviconMappingsAndFetch( |
312 const GURL& page_url, | 312 const GURL& page_url, |
313 const std::vector<GURL>& icon_urls, | 313 const GURL& icon_url, |
314 int icon_types, | 314 favicon_base::IconType icon_type, |
315 const std::vector<int>& desired_sizes, | 315 const std::vector<int>& desired_sizes, |
316 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); | 316 std::vector<favicon_base::FaviconRawBitmapResult>* bitmap_results); |
317 | 317 |
318 void MergeFavicon(const GURL& page_url, | 318 void MergeFavicon(const GURL& page_url, |
319 const GURL& icon_url, | 319 const GURL& icon_url, |
320 favicon_base::IconType icon_type, | 320 favicon_base::IconType icon_type, |
321 scoped_refptr<base::RefCountedMemory> bitmap_data, | 321 scoped_refptr<base::RefCountedMemory> bitmap_data, |
322 const gfx::Size& pixel_size); | 322 const gfx::Size& pixel_size); |
323 | 323 |
324 void SetFavicons(const GURL& page_url, | 324 void SetFavicons(const GURL& page_url, |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 // If |bitmaps_are_expired| is true, the icon for |icon_url| will be modified | 677 // If |bitmaps_are_expired| is true, the icon for |icon_url| will be modified |
678 // only if it's not present in the database. In that case, it will be | 678 // only if it's not present in the database. In that case, it will be |
679 // initially set as expired. Returns whether the new bitmaps were actually | 679 // initially set as expired. Returns whether the new bitmaps were actually |
680 // written. | 680 // written. |
681 bool SetFaviconsImpl(const GURL& page_url, | 681 bool SetFaviconsImpl(const GURL& page_url, |
682 favicon_base::IconType icon_type, | 682 favicon_base::IconType icon_type, |
683 const GURL& icon_url, | 683 const GURL& icon_url, |
684 const std::vector<SkBitmap>& bitmaps, | 684 const std::vector<SkBitmap>& bitmaps, |
685 bool bitmaps_are_expired); | 685 bool bitmaps_are_expired); |
686 | 686 |
687 // Used by both UpdateFaviconMappingsAndFetch and GetFavicons. | 687 // Used by both UpdateFaviconMappingsAndFetch() and GetFavicon(). |
688 // If |page_url| is non-null, the icon urls for |page_url| (and all | 688 // If |page_url| is non-null and there is a favicon stored in the database |
689 // redirects) are set to the subset of |icon_urls| for which icons are | 689 // for |icon_url|, a mapping is added to the database from |page_url| (and all |
690 // already stored in the database. | 690 // redirects) to |icon_url|. |
691 // If |page_url| is non-null, |icon_types| can be multiple icon types | |
692 // only if |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON. | |
693 // If multiple icon types are specified, |page_url| will be mapped to the | |
694 // icon URLs of the largest type available in the database. | |
695 void UpdateFaviconMappingsAndFetchImpl( | 691 void UpdateFaviconMappingsAndFetchImpl( |
696 const GURL* page_url, | 692 const GURL* page_url, |
697 const std::vector<GURL>& icon_urls, | 693 const GURL& icon_url, |
698 int icon_types, | 694 favicon_base::IconType icon_type, |
699 const std::vector<int>& desired_sizes, | 695 const std::vector<int>& desired_sizes, |
700 std::vector<favicon_base::FaviconRawBitmapResult>* results); | 696 std::vector<favicon_base::FaviconRawBitmapResult>* results); |
701 | 697 |
702 // Set the favicon bitmaps for |icon_id|. | 698 // Set the favicon bitmaps for |icon_id|. |
703 // For each entry in |bitmaps|, if a favicon bitmap already exists at the | 699 // For each entry in |bitmaps|, if a favicon bitmap already exists at the |
704 // entry's pixel size, replace the favicon bitmap's data with the entry's | 700 // entry's pixel size, replace the favicon bitmap's data with the entry's |
705 // bitmap data. Otherwise add a new favicon bitmap. | 701 // bitmap data. Otherwise add a new favicon bitmap. |
706 // Any favicon bitmaps already mapped to |icon_id| whose pixel size does not | 702 // Any favicon bitmaps already mapped to |icon_id| whose pixel size does not |
707 // match the pixel size of one of |bitmaps| is deleted. | 703 // match the pixel size of one of |bitmaps| is deleted. |
708 // Returns true if any of the bitmap data at |icon_id| is changed as a result | 704 // Returns true if any of the bitmap data at |icon_id| is changed as a result |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 // it unregisters itself as observer during destruction. | 916 // it unregisters itself as observer during destruction. |
921 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; | 917 std::unique_ptr<TypedUrlSyncableService> typed_url_syncable_service_; |
922 std::unique_ptr<TypedURLSyncBridge> typed_url_sync_bridge_; | 918 std::unique_ptr<TypedURLSyncBridge> typed_url_sync_bridge_; |
923 | 919 |
924 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 920 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
925 }; | 921 }; |
926 | 922 |
927 } // namespace history | 923 } // namespace history |
928 | 924 |
929 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ | 925 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ |
OLD | NEW |