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

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

Issue 336423006: Pass in a set of requested favicon pixel sizes to the HistoryService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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_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 19 matching lines...) Expand all
30 #include "components/history/core/browser/history_client.h" 30 #include "components/history/core/browser/history_client.h"
31 #include "components/keyed_service/core/keyed_service.h" 31 #include "components/keyed_service/core/keyed_service.h"
32 #include "components/search_engines/template_url_id.h" 32 #include "components/search_engines/template_url_id.h"
33 #include "components/visitedlink/browser/visitedlink_delegate.h" 33 #include "components/visitedlink/browser/visitedlink_delegate.h"
34 #include "content/public/browser/download_manager_delegate.h" 34 #include "content/public/browser/download_manager_delegate.h"
35 #include "content/public/browser/notification_observer.h" 35 #include "content/public/browser/notification_observer.h"
36 #include "content/public/browser/notification_registrar.h" 36 #include "content/public/browser/notification_registrar.h"
37 #include "content/public/common/page_transition_types.h" 37 #include "content/public/common/page_transition_types.h"
38 #include "sql/init_status.h" 38 #include "sql/init_status.h"
39 #include "sync/api/syncable_service.h" 39 #include "sync/api/syncable_service.h"
40 #include "ui/base/layout.h"
41 40
42 #if defined(OS_ANDROID) 41 #if defined(OS_ANDROID)
43 class AndroidHistoryProviderService; 42 class AndroidHistoryProviderService;
44 #endif 43 #endif
45 44
46 class GURL; 45 class GURL;
47 class HistoryURLProvider; 46 class HistoryURLProvider;
48 class PageUsageData; 47 class PageUsageData;
49 class PageUsageRequest; 48 class PageUsageRequest;
50 class Profile; 49 class Profile;
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 // available or the URL does not exist. 637 // available or the URL does not exist.
639 bool GetRowForURL(const GURL& url, history::URLRow* url_row); 638 bool GetRowForURL(const GURL& url, history::URLRow* url_row);
640 639
641 // Favicon ------------------------------------------------------------------- 640 // Favicon -------------------------------------------------------------------
642 641
643 // These favicon methods are exposed to the FaviconService. Instead of calling 642 // These favicon methods are exposed to the FaviconService. Instead of calling
644 // these methods directly you should call the respective method on the 643 // these methods directly you should call the respective method on the
645 // FaviconService. 644 // FaviconService.
646 645
647 // Used by FaviconService to get the favicon bitmaps from the history backend 646 // 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 647 // whose edge sizes most closely match |desired_sizes| for |icon_types|. If
649 // |desired_scale_factors| for |icon_types|. If |desired_size_in_dip| is 0, 648 // |desired_sizes| has a '0' entry, the largest favicon bitmap for
650 // the largest favicon bitmap for |icon_types| is returned. The returned 649 // |icon_types| is returned. The returned FaviconBitmapResults will have at
651 // FaviconBitmapResults will have at most one result for each of 650 // most one result for each entry in |desired_sizes|. If a favicon bitmap is
652 // |desired_scale_factors|. If a favicon bitmap is determined to be the best 651 // determined to be the best candidate for multiple |desired_sizes| there will
653 // candidate for multiple scale factors there will be less results. 652 // be fewer results.
654 // If |icon_types| has several types, results for only a single type will be 653 // 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 654 // returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and
656 // FAVICON. 655 // FAVICON.
657 base::CancelableTaskTracker::TaskId GetFavicons( 656 base::CancelableTaskTracker::TaskId GetFavicons(
658 const std::vector<GURL>& icon_urls, 657 const std::vector<GURL>& icon_urls,
659 int icon_types, 658 int icon_types,
660 int desired_size_in_dip, 659 const std::vector<int>& desired_sizes,
661 const std::vector<ui::ScaleFactor>& desired_scale_factors,
662 const favicon_base::FaviconResultsCallback& callback, 660 const favicon_base::FaviconResultsCallback& callback,
663 base::CancelableTaskTracker* tracker); 661 base::CancelableTaskTracker* tracker);
664 662
665 // Used by the FaviconService to get favicons mapped to |page_url| for 663 // Used by the FaviconService to get favicons mapped to |page_url| for
666 // |icon_types| which most closely match |desired_size_in_dip| and 664 // |icon_types| whose edge sizes most closely match |desired_sizes|. If
667 // |desired_scale_factors|. If |desired_size_in_dip| is 0, the largest favicon 665 // |desired_sizes| has a '0' entry, the largest favicon bitmap for
668 // bitmap for |icon_types| is returned. The returned FaviconBitmapResults will 666 // |icon_types| is returned. The returned FaviconBitmapResults will have at
669 // have at most one result for each of |desired_scale_factors|. If a favicon 667 // most one result for each entry in |desired_sizes|. If a favicon bitmap is
670 // bitmap is determined to be the best candidate for multiple scale factors 668 // determined to be the best candidate for multiple |desired_sizes| there
671 // there will be less results. If |icon_types| has several types, results for 669 // will be fewer results. If |icon_types| has several types, results for only
672 // only a single type will be returned in the priority of 670 // a single type will be returned in the priority of TOUCH_PRECOMPOSED_ICON,
673 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON. 671 // TOUCH_ICON, and FAVICON.
674 base::CancelableTaskTracker::TaskId GetFaviconsForURL( 672 base::CancelableTaskTracker::TaskId GetFaviconsForURL(
675 const GURL& page_url, 673 const GURL& page_url,
676 int icon_types, 674 int icon_types,
677 int desired_size_in_dip, 675 const std::vector<int>& desired_sizes,
678 const std::vector<ui::ScaleFactor>& desired_scale_factors,
679 const favicon_base::FaviconResultsCallback& callback, 676 const favicon_base::FaviconResultsCallback& callback,
680 base::CancelableTaskTracker* tracker); 677 base::CancelableTaskTracker* tracker);
681 678
682 // Used by FaviconService to find the first favicon bitmap whose width and 679 // 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 680 // 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 681 // for icons by IconType. Each element of |icon_types| is a bitmask of
685 // IconTypes indicating the types to search for. 682 // IconTypes indicating the types to search for.
686 // If the largest icon of |icon_types[0]| is not larger than 683 // If the largest icon of |icon_types[0]| is not larger than
687 // |minimum_size_in_pixel|, the next icon types of 684 // |minimum_size_in_pixel|, the next icon types of
688 // |icon_types| will be searched and so on. 685 // |icon_types| will be searched and so on.
689 // If no icon is larger than |minimum_size_in_pixel|, the largest one of all 686 // If no icon is larger than |minimum_size_in_pixel|, the largest one of all
690 // icon types in |icon_types| is returned. 687 // icon types in |icon_types| is returned.
691 // This feature is especially useful when some types of icon is perfered as 688 // This feature is especially useful when some types of icon is perfered as
692 // long as its size is larger than a specific value. 689 // long as its size is larger than a specific value.
693 base::CancelableTaskTracker::TaskId GetLargestFaviconForURL( 690 base::CancelableTaskTracker::TaskId GetLargestFaviconForURL(
694 const GURL& page_url, 691 const GURL& page_url,
695 const std::vector<int>& icon_types, 692 const std::vector<int>& icon_types,
696 int minimum_size_in_pixels, 693 int minimum_size_in_pixels,
697 const favicon_base::FaviconRawBitmapCallback& callback, 694 const favicon_base::FaviconRawBitmapCallback& callback,
698 base::CancelableTaskTracker* tracker); 695 base::CancelableTaskTracker* tracker);
699 696
700 // Used by the FaviconService to get the favicon bitmap which most closely 697 // 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 698 // matches |desired_size| from the favicon with |favicon_id| from the history
702 // with |favicon_id| from the history backend. If |desired_size_in_dip| is 0, 699 // backend. If |desired_size| is 0, the largest favicon bitmap for
703 // the largest favicon bitmap for |favicon_id| is returned. 700 // |favicon_id| is returned.
704 base::CancelableTaskTracker::TaskId GetFaviconForID( 701 base::CancelableTaskTracker::TaskId GetFaviconForID(
705 favicon_base::FaviconID favicon_id, 702 favicon_base::FaviconID favicon_id,
706 int desired_size_in_dip, 703 int desired_size,
707 ui::ScaleFactor desired_scale_factor,
708 const favicon_base::FaviconResultsCallback& callback, 704 const favicon_base::FaviconResultsCallback& callback,
709 base::CancelableTaskTracker* tracker); 705 base::CancelableTaskTracker* tracker);
710 706
711 // Used by the FaviconService to replace the favicon mappings to |page_url| 707 // Used by the FaviconService to replace the favicon mappings to |page_url|
712 // for |icon_types| on the history backend. 708 // for |icon_types| on the history backend.
713 // Sample |icon_urls|: 709 // Sample |icon_urls|:
714 // { ICON_URL1 -> TOUCH_ICON, known to the database, 710 // { ICON_URL1 -> TOUCH_ICON, known to the database,
715 // ICON_URL2 -> TOUCH_ICON, not known to the database, 711 // ICON_URL2 -> TOUCH_ICON, not known to the database,
716 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database } 712 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database }
717 // The new mappings are computed from |icon_urls| with these rules: 713 // The new mappings are computed from |icon_urls| with these rules:
718 // 1) Any urls in |icon_urls| which are not already known to the database are 714 // 1) Any urls in |icon_urls| which are not already known to the database are
719 // rejected. 715 // rejected.
720 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 } 716 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 }
721 // 2) If |icon_types| has multiple types, the mappings are only set for the 717 // 2) If |icon_types| has multiple types, the mappings are only set for the
722 // largest icon type. 718 // largest icon type.
723 // Sample new mappings to |page_url|: { ICON_URL3 } 719 // Sample new mappings to |page_url|: { ICON_URL3 }
724 // |icon_types| can only have multiple IconTypes if 720 // |icon_types| can only have multiple IconTypes if
725 // |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON. 721 // |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON.
726 // The favicon bitmaps which most closely match |desired_size_in_dip| 722 // The favicon bitmaps whose edge sizes most closely match |desired_sizes|
727 // and |desired_scale_factors| from the favicons which were just mapped 723 // from the favicons which were just mapped to |page_url| are returned. If
728 // to |page_url| are returned. If |desired_size_in_dip| is 0, the 724 // |desired_sizes| has a '0' entry, the largest favicon bitmap is returned.
729 // largest favicon bitmap is returned.
730 base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch( 725 base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch(
731 const GURL& page_url, 726 const GURL& page_url,
732 const std::vector<GURL>& icon_urls, 727 const std::vector<GURL>& icon_urls,
733 int icon_types, 728 int icon_types,
734 int desired_size_in_dip, 729 const std::vector<int>& desired_sizes,
735 const std::vector<ui::ScaleFactor>& desired_scale_factors,
736 const favicon_base::FaviconResultsCallback& callback, 730 const favicon_base::FaviconResultsCallback& callback,
737 base::CancelableTaskTracker* tracker); 731 base::CancelableTaskTracker* tracker);
738 732
739 // Used by FaviconService to set a favicon for |page_url| and |icon_url| with 733 // Used by FaviconService to set a favicon for |page_url| and |icon_url| with
740 // |pixel_size|. 734 // |pixel_size|.
741 // Example: 735 // Example:
742 // |page_url|: www.google.com 736 // |page_url|: www.google.com
743 // 2 favicons in history for |page_url|: 737 // 2 favicons in history for |page_url|:
744 // www.google.com/a.ico 16x16 738 // www.google.com/a.ico 16x16
745 // www.google.com/b.ico 32x32 739 // www.google.com/b.ico 32x32
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; 1034 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
1041 1035
1042 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; 1036 ObserverList<history::VisitDatabaseObserver> visit_database_observers_;
1043 1037
1044 history::DeleteDirectiveHandler delete_directive_handler_; 1038 history::DeleteDirectiveHandler delete_directive_handler_;
1045 1039
1046 DISALLOW_COPY_AND_ASSIGN(HistoryService); 1040 DISALLOW_COPY_AND_ASSIGN(HistoryService);
1047 }; 1041 };
1048 1042
1049 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ 1043 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend_unittest.cc ('k') | chrome/browser/history/history_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698