| 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_HISTORY_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 // Favicon ------------------------------------------------------------------- | 641 // Favicon ------------------------------------------------------------------- |
| 642 | 642 |
| 643 // These favicon methods are exposed to the FaviconService. Instead of calling | 643 // These favicon methods are exposed to the FaviconService. Instead of calling |
| 644 // these methods directly you should call the respective method on the | 644 // these methods directly you should call the respective method on the |
| 645 // FaviconService. | 645 // FaviconService. |
| 646 | 646 |
| 647 // Used by FaviconService to get the favicon bitmaps from the history backend | 647 // Used by FaviconService to get the favicon bitmaps from the history backend |
| 648 // which most closely match |desired_size_in_dip| x |desired_size_in_dip| and | 648 // which most closely match |desired_size_in_dip| x |desired_size_in_dip| and |
| 649 // |desired_scale_factors| for |icon_types|. If |desired_size_in_dip| is 0, | 649 // |desired_scale_factors| for |icon_types|. If |desired_size_in_dip| is 0, |
| 650 // the largest favicon bitmap for |icon_types| is returned. The returned | 650 // the largest favicon bitmap for |icon_types| is returned. The returned |
| 651 // FaviconBitmapResults will have at most one result for each of | 651 // FaviconRawBitmapResults will have at most one result for each of |
| 652 // |desired_scale_factors|. If a favicon bitmap is determined to be the best | 652 // |desired_scale_factors|. If a favicon bitmap is determined to be the best |
| 653 // candidate for multiple scale factors there will be less results. | 653 // candidate for multiple scale factors there will be less results. |
| 654 // If |icon_types| has several types, results for only a single type will be | 654 // If |icon_types| has several types, results for only a single type will be |
| 655 // returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and | 655 // returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and |
| 656 // FAVICON. | 656 // FAVICON. |
| 657 base::CancelableTaskTracker::TaskId GetFavicons( | 657 base::CancelableTaskTracker::TaskId GetFavicons( |
| 658 const std::vector<GURL>& icon_urls, | 658 const std::vector<GURL>& icon_urls, |
| 659 int icon_types, | 659 int icon_types, |
| 660 int desired_size_in_dip, | 660 int desired_size_in_dip, |
| 661 const std::vector<ui::ScaleFactor>& desired_scale_factors, | 661 const std::vector<ui::ScaleFactor>& desired_scale_factors, |
| 662 const favicon_base::FaviconResultsCallback& callback, | 662 const favicon_base::FaviconResultsCallback& callback, |
| 663 base::CancelableTaskTracker* tracker); | 663 base::CancelableTaskTracker* tracker); |
| 664 | 664 |
| 665 // Used by the FaviconService to get favicons mapped to |page_url| for | 665 // Used by the FaviconService to get favicons mapped to |page_url| for |
| 666 // |icon_types| which most closely match |desired_size_in_dip| and | 666 // |icon_types| which most closely match |desired_size_in_dip| and |
| 667 // |desired_scale_factors|. If |desired_size_in_dip| is 0, the largest favicon | 667 // |desired_scale_factors|. If |desired_size_in_dip| is 0, the largest favicon |
| 668 // bitmap for |icon_types| is returned. The returned FaviconBitmapResults will | 668 // bitmap for |icon_types| is returned. The returned FaviconRawBitmapResults |
| 669 // will |
| 669 // have at most one result for each of |desired_scale_factors|. If a favicon | 670 // have at most one result for each of |desired_scale_factors|. If a favicon |
| 670 // bitmap is determined to be the best candidate for multiple scale factors | 671 // bitmap is determined to be the best candidate for multiple scale factors |
| 671 // there will be less results. If |icon_types| has several types, results for | 672 // there will be less results. If |icon_types| has several types, results for |
| 672 // only a single type will be returned in the priority of | 673 // only a single type will be returned in the priority of |
| 673 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON. | 674 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON. |
| 674 base::CancelableTaskTracker::TaskId GetFaviconsForURL( | 675 base::CancelableTaskTracker::TaskId GetFaviconsForURL( |
| 675 const GURL& page_url, | 676 const GURL& page_url, |
| 676 int icon_types, | 677 int icon_types, |
| 677 int desired_size_in_dip, | 678 int desired_size_in_dip, |
| 678 const std::vector<ui::ScaleFactor>& desired_scale_factors, | 679 const std::vector<ui::ScaleFactor>& desired_scale_factors, |
| 679 const favicon_base::FaviconResultsCallback& callback, | 680 const favicon_base::FaviconResultsCallback& callback, |
| 680 base::CancelableTaskTracker* tracker); | 681 base::CancelableTaskTracker* tracker); |
| 681 | 682 |
| 682 // Used by FaviconService to find the first favicon bitmap whose width and | 683 // Used by FaviconService to find the first favicon bitmap whose width and |
| 683 // height are greater than that of |minimum_size_in_pixels|. This searches | 684 // height are greater than that of |minimum_size_in_pixels|. This searches |
| 684 // for icons by IconType. Each element of |icon_types| is a bitmask of | 685 // for icons by IconType. Each element of |icon_types| is a bitmask of |
| 685 // IconTypes indicating the types to search for. | 686 // IconTypes indicating the types to search for. |
| 686 // If the largest icon of |icon_types[0]| is not larger than | 687 // If the largest icon of |icon_types[0]| is not larger than |
| 687 // |minimum_size_in_pixel|, the next icon types of | 688 // |minimum_size_in_pixel|, the next icon types of |
| 688 // |icon_types| will be searched and so on. | 689 // |icon_types| will be searched and so on. |
| 689 // If no icon is larger than |minimum_size_in_pixel|, the largest one of all | 690 // If no icon is larger than |minimum_size_in_pixel|, the largest one of all |
| 690 // icon types in |icon_types| is returned. | 691 // icon types in |icon_types| is returned. |
| 691 // This feature is especially useful when some types of icon is perfered as | 692 // This feature is especially useful when some types of icon is perfered as |
| 692 // long as its size is larger than a specific value. | 693 // long as its size is larger than a specific value. |
| 693 base::CancelableTaskTracker::TaskId GetLargestFaviconForURL( | 694 base::CancelableTaskTracker::TaskId GetLargestFaviconForURL( |
| 694 const GURL& page_url, | 695 const GURL& page_url, |
| 695 const std::vector<int>& icon_types, | 696 const std::vector<int>& icon_types, |
| 696 int minimum_size_in_pixels, | 697 int minimum_size_in_pixels, |
| 697 const favicon_base::FaviconRawCallback& callback, | 698 const favicon_base::FaviconRawBitmapCallback& callback, |
| 698 base::CancelableTaskTracker* tracker); | 699 base::CancelableTaskTracker* tracker); |
| 699 | 700 |
| 700 // Used by the FaviconService to get the favicon bitmap which most closely | 701 // Used by the FaviconService to get the favicon bitmap which most closely |
| 701 // matches |desired_size_in_dip| and |desired_scale_factor| from the favicon | 702 // matches |desired_size_in_dip| and |desired_scale_factor| from the favicon |
| 702 // with |favicon_id| from the history backend. If |desired_size_in_dip| is 0, | 703 // with |favicon_id| from the history backend. If |desired_size_in_dip| is 0, |
| 703 // the largest favicon bitmap for |favicon_id| is returned. | 704 // the largest favicon bitmap for |favicon_id| is returned. |
| 704 base::CancelableTaskTracker::TaskId GetFaviconForID( | 705 base::CancelableTaskTracker::TaskId GetFaviconForID( |
| 705 favicon_base::FaviconID favicon_id, | 706 favicon_base::FaviconID favicon_id, |
| 706 int desired_size_in_dip, | 707 int desired_size_in_dip, |
| 707 ui::ScaleFactor desired_scale_factor, | 708 ui::ScaleFactor desired_scale_factor, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 void MergeFavicon(const GURL& page_url, | 760 void MergeFavicon(const GURL& page_url, |
| 760 const GURL& icon_url, | 761 const GURL& icon_url, |
| 761 favicon_base::IconType icon_type, | 762 favicon_base::IconType icon_type, |
| 762 scoped_refptr<base::RefCountedMemory> bitmap_data, | 763 scoped_refptr<base::RefCountedMemory> bitmap_data, |
| 763 const gfx::Size& pixel_size); | 764 const gfx::Size& pixel_size); |
| 764 | 765 |
| 765 // Used by the FaviconService to set the favicons for a page on the history | 766 // Used by the FaviconService to set the favicons for a page on the history |
| 766 // backend. | 767 // backend. |
| 767 // |favicon_bitmap_data| replaces all the favicon bitmaps mapped to | 768 // |favicon_bitmap_data| replaces all the favicon bitmaps mapped to |
| 768 // |page_url|. | 769 // |page_url|. |
| 769 // |expired| and |icon_type| fields in FaviconBitmapData are ignored. | 770 // |expired| and |icon_type| fields in FaviconRawBitmapData are ignored. |
| 770 // Use MergeFavicon() if |favicon_bitmap_data| is incomplete, and favicon | 771 // Use MergeFavicon() if |favicon_bitmap_data| is incomplete, and favicon |
| 771 // bitmaps in the database should be preserved if possible. For instance, | 772 // bitmaps in the database should be preserved if possible. For instance, |
| 772 // favicon bitmaps from sync are 1x only. MergeFavicon() is used to avoid | 773 // favicon bitmaps from sync are 1x only. MergeFavicon() is used to avoid |
| 773 // deleting the 2x favicon bitmap if it is present in the history backend. | 774 // deleting the 2x favicon bitmap if it is present in the history backend. |
| 774 // See HistoryBackend::ValidateSetFaviconsParams() for more details on the | 775 // See HistoryBackend::ValidateSetFaviconsParams() for more details on the |
| 775 // criteria for |favicon_bitmap_data| to be valid. | 776 // criteria for |favicon_bitmap_data| to be valid. |
| 776 void SetFavicons( | 777 void SetFavicons(const GURL& page_url, |
| 777 const GURL& page_url, | 778 favicon_base::IconType icon_type, |
| 778 favicon_base::IconType icon_type, | 779 const std::vector<favicon_base::FaviconRawBitmapData>& |
| 779 const std::vector<favicon_base::FaviconBitmapData>& favicon_bitmap_data); | 780 favicon_bitmap_data); |
| 780 | 781 |
| 781 // Used by the FaviconService to mark the favicon for the page as being out | 782 // Used by the FaviconService to mark the favicon for the page as being out |
| 782 // of date. | 783 // of date. |
| 783 void SetFaviconsOutOfDateForPage(const GURL& page_url); | 784 void SetFaviconsOutOfDateForPage(const GURL& page_url); |
| 784 | 785 |
| 785 // Used by the FaviconService to clone favicons from one page to another, | 786 // Used by the FaviconService to clone favicons from one page to another, |
| 786 // provided that other page does not already have favicons. | 787 // provided that other page does not already have favicons. |
| 787 void CloneFavicons(const GURL& old_page_url, const GURL& new_page_url); | 788 void CloneFavicons(const GURL& old_page_url, const GURL& new_page_url); |
| 788 | 789 |
| 789 // Used by the FaviconService for importing many favicons for many pages at | 790 // Used by the FaviconService for importing many favicons for many pages at |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 1041 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 1041 | 1042 |
| 1042 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; | 1043 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; |
| 1043 | 1044 |
| 1044 history::DeleteDirectiveHandler delete_directive_handler_; | 1045 history::DeleteDirectiveHandler delete_directive_handler_; |
| 1045 | 1046 |
| 1046 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 1047 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 1047 }; | 1048 }; |
| 1048 | 1049 |
| 1049 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 1050 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| OLD | NEW |