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

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

Issue 291643002: Move favicon callbacks to favicon_base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 7 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
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/observer_list.h" 19 #include "base/observer_list.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
21 #include "base/task/cancelable_task_tracker.h" 21 #include "base/task/cancelable_task_tracker.h"
22 #include "base/threading/thread_checker.h" 22 #include "base/threading/thread_checker.h"
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "chrome/browser/common/cancelable_request.h" 24 #include "chrome/browser/common/cancelable_request.h"
25 #include "chrome/browser/favicon/favicon_service.h"
26 #include "chrome/browser/history/delete_directive_handler.h" 25 #include "chrome/browser/history/delete_directive_handler.h"
27 #include "chrome/browser/history/history_types.h" 26 #include "chrome/browser/history/history_types.h"
28 #include "chrome/browser/history/typed_url_syncable_service.h" 27 #include "chrome/browser/history/typed_url_syncable_service.h"
29 #include "chrome/browser/search_engines/template_url_id.h" 28 #include "chrome/browser/search_engines/template_url_id.h"
30 #include "chrome/common/ref_counted_util.h" 29 #include "chrome/common/ref_counted_util.h"
30 #include "components/favicon_base/favicon_callback.h"
31 #include "components/keyed_service/core/keyed_service.h" 31 #include "components/keyed_service/core/keyed_service.h"
32 #include "components/visitedlink/browser/visitedlink_delegate.h" 32 #include "components/visitedlink/browser/visitedlink_delegate.h"
33 #include "content/public/browser/download_manager_delegate.h" 33 #include "content/public/browser/download_manager_delegate.h"
34 #include "content/public/browser/notification_observer.h" 34 #include "content/public/browser/notification_observer.h"
35 #include "content/public/browser/notification_registrar.h" 35 #include "content/public/browser/notification_registrar.h"
36 #include "content/public/common/page_transition_types.h" 36 #include "content/public/common/page_transition_types.h"
37 #include "sql/init_status.h" 37 #include "sql/init_status.h"
38 #include "sync/api/syncable_service.h" 38 #include "sync/api/syncable_service.h"
39 #include "ui/base/layout.h" 39 #include "ui/base/layout.h"
40 40
41 #if defined(OS_ANDROID) 41 #if defined(OS_ANDROID)
42 #include "chrome/browser/history/android/android_history_provider_service.h" 42 #include "chrome/browser/history/android/android_history_provider_service.h"
43 #endif 43 #endif
44 44
45 class BookmarkService; 45 class BookmarkService;
46 class GURL; 46 class GURL;
47 class HistoryURLProvider; 47 class HistoryURLProvider;
48 class PageUsageData; 48 class PageUsageData;
49 class PageUsageRequest; 49 class PageUsageRequest;
50 class Profile; 50 class Profile;
51 struct HistoryURLProviderParams; 51 struct HistoryURLProviderParams;
52 struct ImportedFaviconUsage;
52 53
53 namespace base { 54 namespace base {
54 class FilePath; 55 class FilePath;
55 class Thread; 56 class Thread;
56 } 57 }
57 58
58 namespace visitedlink { 59 namespace visitedlink {
59 class VisitedLinkMaster; 60 class VisitedLinkMaster;
60 } 61 }
61 62
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 // |desired_scale_factors|. If a favicon bitmap is determined to be the best 657 // |desired_scale_factors|. If a favicon bitmap is determined to be the best
657 // candidate for multiple scale factors there will be less results. 658 // candidate for multiple scale factors there will be less results.
658 // If |icon_types| has several types, results for only a single type will be 659 // If |icon_types| has several types, results for only a single type will be
659 // returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and 660 // returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and
660 // FAVICON. 661 // FAVICON.
661 base::CancelableTaskTracker::TaskId GetFavicons( 662 base::CancelableTaskTracker::TaskId GetFavicons(
662 const std::vector<GURL>& icon_urls, 663 const std::vector<GURL>& icon_urls,
663 int icon_types, 664 int icon_types,
664 int desired_size_in_dip, 665 int desired_size_in_dip,
665 const std::vector<ui::ScaleFactor>& desired_scale_factors, 666 const std::vector<ui::ScaleFactor>& desired_scale_factors,
666 const FaviconService::FaviconResultsCallback& callback, 667 const favicon_base::FaviconResultsCallback& callback,
667 base::CancelableTaskTracker* tracker); 668 base::CancelableTaskTracker* tracker);
668 669
669 // Used by the FaviconService to get favicons mapped to |page_url| for 670 // Used by the FaviconService to get favicons mapped to |page_url| for
670 // |icon_types| which most closely match |desired_size_in_dip| and 671 // |icon_types| which most closely match |desired_size_in_dip| and
671 // |desired_scale_factors|. If |desired_size_in_dip| is 0, the largest favicon 672 // |desired_scale_factors|. If |desired_size_in_dip| is 0, the largest favicon
672 // bitmap for |icon_types| is returned. The returned FaviconBitmapResults will 673 // bitmap for |icon_types| is returned. The returned FaviconBitmapResults will
673 // have at most one result for each of |desired_scale_factors|. If a favicon 674 // have at most one result for each of |desired_scale_factors|. If a favicon
674 // bitmap is determined to be the best candidate for multiple scale factors 675 // bitmap is determined to be the best candidate for multiple scale factors
675 // there will be less results. If |icon_types| has several types, results for 676 // there will be less results. If |icon_types| has several types, results for
676 // only a single type will be returned in the priority of 677 // only a single type will be returned in the priority of
677 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON. 678 // TOUCH_PRECOMPOSED_ICON, TOUCH_ICON, and FAVICON.
678 base::CancelableTaskTracker::TaskId GetFaviconsForURL( 679 base::CancelableTaskTracker::TaskId GetFaviconsForURL(
679 const GURL& page_url, 680 const GURL& page_url,
680 int icon_types, 681 int icon_types,
681 int desired_size_in_dip, 682 int desired_size_in_dip,
682 const std::vector<ui::ScaleFactor>& desired_scale_factors, 683 const std::vector<ui::ScaleFactor>& desired_scale_factors,
683 const FaviconService::FaviconResultsCallback& callback, 684 const favicon_base::FaviconResultsCallback& callback,
684 base::CancelableTaskTracker* tracker); 685 base::CancelableTaskTracker* tracker);
685 686
686 // Used by FaviconService to find the first favicon bitmap whose width and 687 // Used by FaviconService to find the first favicon bitmap whose width and
687 // height are greater than that of |minimum_size_in_pixels|. This searches 688 // height are greater than that of |minimum_size_in_pixels|. This searches
688 // for icons by IconType. Each element of |icon_types| is a bitmask of 689 // for icons by IconType. Each element of |icon_types| is a bitmask of
689 // IconTypes indicating the types to search for. 690 // IconTypes indicating the types to search for.
690 // If the largest icon of |icon_types[0]| is not larger than 691 // If the largest icon of |icon_types[0]| is not larger than
691 // |minimum_size_in_pixel|, the next icon types of 692 // |minimum_size_in_pixel|, the next icon types of
692 // |icon_types| will be searched and so on. 693 // |icon_types| will be searched and so on.
693 // If no icon is larger than |minimum_size_in_pixel|, the largest one of all 694 // If no icon is larger than |minimum_size_in_pixel|, the largest one of all
694 // icon types in |icon_types| is returned. 695 // icon types in |icon_types| is returned.
695 // This feature is especially useful when some types of icon is perfered as 696 // This feature is especially useful when some types of icon is perfered as
696 // long as its size is larger than a specific value. 697 // long as its size is larger than a specific value.
697 base::CancelableTaskTracker::TaskId GetLargestFaviconForURL( 698 base::CancelableTaskTracker::TaskId GetLargestFaviconForURL(
698 const GURL& page_url, 699 const GURL& page_url,
699 const std::vector<int>& icon_types, 700 const std::vector<int>& icon_types,
700 int minimum_size_in_pixels, 701 int minimum_size_in_pixels,
701 const FaviconService::FaviconRawCallback& callback, 702 const favicon_base::FaviconRawCallback& callback,
702 base::CancelableTaskTracker* tracker); 703 base::CancelableTaskTracker* tracker);
703 704
704 // Used by the FaviconService to get the favicon bitmap which most closely 705 // Used by the FaviconService to get the favicon bitmap which most closely
705 // matches |desired_size_in_dip| and |desired_scale_factor| from the favicon 706 // matches |desired_size_in_dip| and |desired_scale_factor| from the favicon
706 // with |favicon_id| from the history backend. If |desired_size_in_dip| is 0, 707 // with |favicon_id| from the history backend. If |desired_size_in_dip| is 0,
707 // the largest favicon bitmap for |favicon_id| is returned. 708 // the largest favicon bitmap for |favicon_id| is returned.
708 base::CancelableTaskTracker::TaskId GetFaviconForID( 709 base::CancelableTaskTracker::TaskId GetFaviconForID(
709 favicon_base::FaviconID favicon_id, 710 favicon_base::FaviconID favicon_id,
710 int desired_size_in_dip, 711 int desired_size_in_dip,
711 ui::ScaleFactor desired_scale_factor, 712 ui::ScaleFactor desired_scale_factor,
712 const FaviconService::FaviconResultsCallback& callback, 713 const favicon_base::FaviconResultsCallback& callback,
713 base::CancelableTaskTracker* tracker); 714 base::CancelableTaskTracker* tracker);
714 715
715 // Used by the FaviconService to replace the favicon mappings to |page_url| 716 // Used by the FaviconService to replace the favicon mappings to |page_url|
716 // for |icon_types| on the history backend. 717 // for |icon_types| on the history backend.
717 // Sample |icon_urls|: 718 // Sample |icon_urls|:
718 // { ICON_URL1 -> TOUCH_ICON, known to the database, 719 // { ICON_URL1 -> TOUCH_ICON, known to the database,
719 // ICON_URL2 -> TOUCH_ICON, not known to the database, 720 // ICON_URL2 -> TOUCH_ICON, not known to the database,
720 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database } 721 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database }
721 // The new mappings are computed from |icon_urls| with these rules: 722 // The new mappings are computed from |icon_urls| with these rules:
722 // 1) Any urls in |icon_urls| which are not already known to the database are 723 // 1) Any urls in |icon_urls| which are not already known to the database are
723 // rejected. 724 // rejected.
724 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 } 725 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 }
725 // 2) If |icon_types| has multiple types, the mappings are only set for the 726 // 2) If |icon_types| has multiple types, the mappings are only set for the
726 // largest icon type. 727 // largest icon type.
727 // Sample new mappings to |page_url|: { ICON_URL3 } 728 // Sample new mappings to |page_url|: { ICON_URL3 }
728 // |icon_types| can only have multiple IconTypes if 729 // |icon_types| can only have multiple IconTypes if
729 // |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON. 730 // |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON.
730 // The favicon bitmaps which most closely match |desired_size_in_dip| 731 // The favicon bitmaps which most closely match |desired_size_in_dip|
731 // and |desired_scale_factors| from the favicons which were just mapped 732 // and |desired_scale_factors| from the favicons which were just mapped
732 // to |page_url| are returned. If |desired_size_in_dip| is 0, the 733 // to |page_url| are returned. If |desired_size_in_dip| is 0, the
733 // largest favicon bitmap is returned. 734 // largest favicon bitmap is returned.
734 base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch( 735 base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch(
735 const GURL& page_url, 736 const GURL& page_url,
736 const std::vector<GURL>& icon_urls, 737 const std::vector<GURL>& icon_urls,
737 int icon_types, 738 int icon_types,
738 int desired_size_in_dip, 739 int desired_size_in_dip,
739 const std::vector<ui::ScaleFactor>& desired_scale_factors, 740 const std::vector<ui::ScaleFactor>& desired_scale_factors,
740 const FaviconService::FaviconResultsCallback& callback, 741 const favicon_base::FaviconResultsCallback& callback,
741 base::CancelableTaskTracker* tracker); 742 base::CancelableTaskTracker* tracker);
742 743
743 // Used by FaviconService to set a favicon for |page_url| and |icon_url| with 744 // Used by FaviconService to set a favicon for |page_url| and |icon_url| with
744 // |pixel_size|. 745 // |pixel_size|.
745 // Example: 746 // Example:
746 // |page_url|: www.google.com 747 // |page_url|: www.google.com
747 // 2 favicons in history for |page_url|: 748 // 2 favicons in history for |page_url|:
748 // www.google.com/a.ico 16x16 749 // www.google.com/a.ico 16x16
749 // www.google.com/b.ico 32x32 750 // www.google.com/b.ico 32x32
750 // MergeFavicon(|page_url|, www.google.com/a.ico, ..., ..., 16x16) 751 // MergeFavicon(|page_url|, www.google.com/a.ico, ..., ..., 16x16)
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; 1042 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
1042 1043
1043 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; 1044 ObserverList<history::VisitDatabaseObserver> visit_database_observers_;
1044 1045
1045 history::DeleteDirectiveHandler delete_directive_handler_; 1046 history::DeleteDirectiveHandler delete_directive_handler_;
1046 1047
1047 DISALLOW_COPY_AND_ASSIGN(HistoryService); 1048 DISALLOW_COPY_AND_ASSIGN(HistoryService);
1048 }; 1049 };
1049 1050
1050 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ 1051 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/android/sqlite_cursor_unittest.cc ('k') | chrome/browser/history/history_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698