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

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

Issue 335233003: Convert ui::ScaleFactor -> float in favicon/history code (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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // 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, 648 // |desired_favicon_scales| for |icon_types|. If |desired_size_in_dip| is 0,
650 // the largest favicon bitmap for |icon_types| is returned. The returned 649 // the largest favicon bitmap for |icon_types| is returned. The returned
651 // FaviconBitmapResults will have at most one result for each of 650 // FaviconBitmapResults will have at most one result for each of
652 // |desired_scale_factors|. If a favicon bitmap is determined to be the best 651 // |desired_favicon_scales|. If a favicon bitmap is determined to be the best
653 // candidate for multiple scale factors there will be less results. 652 // 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 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 int desired_size_in_dip,
661 const std::vector<ui::ScaleFactor>& desired_scale_factors, 660 const std::vector<float>& desired_favicon_scales,
662 const favicon_base::FaviconResultsCallback& callback, 661 const favicon_base::FaviconResultsCallback& callback,
663 base::CancelableTaskTracker* tracker); 662 base::CancelableTaskTracker* tracker);
664 663
665 // Used by the FaviconService to get favicons mapped to |page_url| for 664 // Used by the FaviconService to get favicons mapped to |page_url| for
666 // |icon_types| which most closely match |desired_size_in_dip| and 665 // |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 666 // |desired_favicon_scales|. If |desired_size_in_dip| is 0, the largest
667 // favicon
668 // bitmap for |icon_types| is returned. The returned FaviconBitmapResults will 668 // bitmap for |icon_types| is returned. The returned FaviconBitmapResults will
669 // have at most one result for each of |desired_scale_factors|. If a favicon 669 // have at most one result for each of |desired_favicon_scales|. If a favicon
670 // bitmap is determined to be the best candidate for multiple scale factors 670 // 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 671 // 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 672 // only a single type will be returned in the priority of
673 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON. 673 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON.
674 base::CancelableTaskTracker::TaskId GetFaviconsForURL( 674 base::CancelableTaskTracker::TaskId GetFaviconsForURL(
675 const GURL& page_url, 675 const GURL& page_url,
676 int icon_types, 676 int icon_types,
677 int desired_size_in_dip, 677 int desired_size_in_dip,
678 const std::vector<ui::ScaleFactor>& desired_scale_factors, 678 const std::vector<float>& desired_favicon_scales,
679 const favicon_base::FaviconResultsCallback& callback, 679 const favicon_base::FaviconResultsCallback& callback,
680 base::CancelableTaskTracker* tracker); 680 base::CancelableTaskTracker* tracker);
681 681
682 // Used by FaviconService to find the first favicon bitmap whose width and 682 // 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 683 // 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 684 // for icons by IconType. Each element of |icon_types| is a bitmask of
685 // IconTypes indicating the types to search for. 685 // IconTypes indicating the types to search for.
686 // If the largest icon of |icon_types[0]| is not larger than 686 // If the largest icon of |icon_types[0]| is not larger than
687 // |minimum_size_in_pixel|, the next icon types of 687 // |minimum_size_in_pixel|, the next icon types of
688 // |icon_types| will be searched and so on. 688 // |icon_types| will be searched and so on.
689 // If no icon is larger than |minimum_size_in_pixel|, the largest one of all 689 // If no icon is larger than |minimum_size_in_pixel|, the largest one of all
690 // icon types in |icon_types| is returned. 690 // icon types in |icon_types| is returned.
691 // This feature is especially useful when some types of icon is perfered as 691 // This feature is especially useful when some types of icon is perfered as
692 // long as its size is larger than a specific value. 692 // long as its size is larger than a specific value.
693 base::CancelableTaskTracker::TaskId GetLargestFaviconForURL( 693 base::CancelableTaskTracker::TaskId GetLargestFaviconForURL(
694 const GURL& page_url, 694 const GURL& page_url,
695 const std::vector<int>& icon_types, 695 const std::vector<int>& icon_types,
696 int minimum_size_in_pixels, 696 int minimum_size_in_pixels,
697 const favicon_base::FaviconRawBitmapCallback& callback, 697 const favicon_base::FaviconRawBitmapCallback& callback,
698 base::CancelableTaskTracker* tracker); 698 base::CancelableTaskTracker* tracker);
699 699
700 // Used by the FaviconService to get the favicon bitmap which most closely 700 // 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 701 // matches |desired_size_in_dip| and |desired_favicon_scale| from the favicon
702 // with |favicon_id| from the history backend. If |desired_size_in_dip| is 0, 702 // with |favicon_id| from the history backend. If |desired_size_in_dip| is 0,
703 // the largest favicon bitmap for |favicon_id| is returned. 703 // the largest favicon bitmap for |favicon_id| is returned.
704 base::CancelableTaskTracker::TaskId GetFaviconForID( 704 base::CancelableTaskTracker::TaskId GetFaviconForID(
705 favicon_base::FaviconID favicon_id, 705 favicon_base::FaviconID favicon_id,
706 int desired_size_in_dip, 706 int desired_size_in_dip,
707 ui::ScaleFactor desired_scale_factor, 707 float desired_favicon_scale,
708 const favicon_base::FaviconResultsCallback& callback, 708 const favicon_base::FaviconResultsCallback& callback,
709 base::CancelableTaskTracker* tracker); 709 base::CancelableTaskTracker* tracker);
710 710
711 // Used by the FaviconService to replace the favicon mappings to |page_url| 711 // Used by the FaviconService to replace the favicon mappings to |page_url|
712 // for |icon_types| on the history backend. 712 // for |icon_types| on the history backend.
713 // Sample |icon_urls|: 713 // Sample |icon_urls|:
714 // { ICON_URL1 -> TOUCH_ICON, known to the database, 714 // { ICON_URL1 -> TOUCH_ICON, known to the database,
715 // ICON_URL2 -> TOUCH_ICON, not known to the database, 715 // ICON_URL2 -> TOUCH_ICON, not known to the database,
716 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database } 716 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database }
717 // The new mappings are computed from |icon_urls| with these rules: 717 // 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 718 // 1) Any urls in |icon_urls| which are not already known to the database are
719 // rejected. 719 // rejected.
720 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 } 720 // 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 721 // 2) If |icon_types| has multiple types, the mappings are only set for the
722 // largest icon type. 722 // largest icon type.
723 // Sample new mappings to |page_url|: { ICON_URL3 } 723 // Sample new mappings to |page_url|: { ICON_URL3 }
724 // |icon_types| can only have multiple IconTypes if 724 // |icon_types| can only have multiple IconTypes if
725 // |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON. 725 // |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON.
726 // The favicon bitmaps which most closely match |desired_size_in_dip| 726 // The favicon bitmaps which most closely match |desired_size_in_dip|
727 // and |desired_scale_factors| from the favicons which were just mapped 727 // and |desired_favicon_scales| from the favicons which were just mapped
728 // to |page_url| are returned. If |desired_size_in_dip| is 0, the 728 // to |page_url| are returned. If |desired_size_in_dip| is 0, the
729 // largest favicon bitmap is returned. 729 // largest favicon bitmap is returned.
730 base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch( 730 base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch(
731 const GURL& page_url, 731 const GURL& page_url,
732 const std::vector<GURL>& icon_urls, 732 const std::vector<GURL>& icon_urls,
733 int icon_types, 733 int icon_types,
734 int desired_size_in_dip, 734 int desired_size_in_dip,
735 const std::vector<ui::ScaleFactor>& desired_scale_factors, 735 const std::vector<float>& desired_favicon_scales,
736 const favicon_base::FaviconResultsCallback& callback, 736 const favicon_base::FaviconResultsCallback& callback,
737 base::CancelableTaskTracker* tracker); 737 base::CancelableTaskTracker* tracker);
738 738
739 // Used by FaviconService to set a favicon for |page_url| and |icon_url| with 739 // Used by FaviconService to set a favicon for |page_url| and |icon_url| with
740 // |pixel_size|. 740 // |pixel_size|.
741 // Example: 741 // Example:
742 // |page_url|: www.google.com 742 // |page_url|: www.google.com
743 // 2 favicons in history for |page_url|: 743 // 2 favicons in history for |page_url|:
744 // www.google.com/a.ico 16x16 744 // www.google.com/a.ico 16x16
745 // www.google.com/b.ico 32x32 745 // 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_; 1040 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
1041 1041
1042 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; 1042 ObserverList<history::VisitDatabaseObserver> visit_database_observers_;
1043 1043
1044 history::DeleteDirectiveHandler delete_directive_handler_; 1044 history::DeleteDirectiveHandler delete_directive_handler_;
1045 1045
1046 DISALLOW_COPY_AND_ASSIGN(HistoryService); 1046 DISALLOW_COPY_AND_ASSIGN(HistoryService);
1047 }; 1047 };
1048 1048
1049 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ 1049 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698