Chromium Code Reviews| 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_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 // Notification from the backend that it has finished loading. Sends | 679 // Notification from the backend that it has finished loading. Sends |
| 680 // notification (NOTIFY_HISTORY_LOADED) and sets backend_loaded_ to true. | 680 // notification (NOTIFY_HISTORY_LOADED) and sets backend_loaded_ to true. |
| 681 void OnDBLoaded(int backend_id); | 681 void OnDBLoaded(int backend_id); |
| 682 | 682 |
| 683 // Favicon ------------------------------------------------------------------- | 683 // Favicon ------------------------------------------------------------------- |
| 684 | 684 |
| 685 // These favicon methods are exposed to the FaviconService. Instead of calling | 685 // These favicon methods are exposed to the FaviconService. Instead of calling |
| 686 // these methods directly you should call the respective method on the | 686 // these methods directly you should call the respective method on the |
| 687 // FaviconService. | 687 // FaviconService. |
| 688 | 688 |
| 689 // Used by the FaviconService to get a favicon from the history backend. | 689 // Used by FaviconService to get all the favicon bitmaps from the history |
| 690 void GetFavicon(FaviconService::GetFaviconRequest* request, | 690 // backend for the favicons at |icon_urls|. |
| 691 const GURL& icon_url, | 691 void GetFavicons(FaviconService::GetFaviconRequest* request, |
| 692 const std::vector<GURL>& icon_urls, | |
| 692 history::IconType icon_type); | 693 history::IconType icon_type); |
| 693 | 694 |
| 695 // Used by the FaviconService to get all the favicons mapped to |page_url| | |
| 696 // from the history backend. | |
|
sky
2012/08/21 20:16:56
Document icon_types
| |
| 697 void GetFaviconsForURL(FaviconService::GetFaviconRequest* request, | |
| 698 const GURL& page_url, | |
| 699 int icon_types); | |
| 700 | |
| 694 // Used by the FaviconService to update the favicon mappings on the history | 701 // Used by the FaviconService to update the favicon mappings on the history |
| 702 // backend for favicons of type FAVICON. | |
|
sky
2012/08/21 20:16:56
This takes an icon_type.
| |
| 703 // |icon_urls| is a list of all the favicon URLs known for |page_url|. It is | |
| 704 // important for this list to be complete as any favicons mapped to | |
| 705 // |page_url| whose icon URL is not in |icon_urls| will be deleted. | |
| 706 void UpdateFaviconMappingsAndFetch(FaviconService::GetFaviconRequest* request, | |
| 707 const GURL& page_url, | |
| 708 const std::vector<GURL>& icon_urls, | |
| 709 history::IconType icon_type); | |
| 710 | |
| 711 // Used by the FaviconService to add favicons for a page on the history | |
| 712 // backend. This method queries for the IconURLSizesMap from |page_url|. If | |
| 713 // unavailable, a guess at what IconURLSizesMap should be is used. This | |
| 714 // function is inefficient. Do not use if at all possible. | |
| 715 // TODO(pkotwicz): Remove this function once it is no longer required by | |
| 716 // sync. | |
| 717 void AddFavicons(const GURL& page_url, | |
| 718 history::IconType icon_type, | |
| 719 const std::vector<history::FaviconDataElement>& elements); | |
| 720 | |
| 721 // Used by the FaviconService to set the favicons for a page on the history | |
| 695 // backend. | 722 // backend. |
| 696 void UpdateFaviconMappingAndFetch(FaviconService::GetFaviconRequest* request, | 723 // |elements| is a listing of additional favicon bitmaps to store for |
| 697 const GURL& page_url, | 724 // |page_url|. |
| 698 const GURL& icon_url, | 725 // |icon_url_sizes| is a mapping of all the icon urls of favicons available |
| 699 history::IconType icon_type); | 726 // for |page_url| to the sizes that those favicons are available at from the |
| 727 // web. |elements| does not need to have entries for all the icon urls or | |
| 728 // sizes listed in |icon_url_sizes|. However, the icon urls and sizes in | |
| 729 // |elements| must be a subset of |icon_url_sizes|. It is important that | |
| 730 // |icon_url_sizes| be complete as mappings to favicons whose icon url or | |
| 731 // pixel size is not in |icon_url_sizes| will be deleted. | |
| 732 void SetFavicons(const GURL& page_url, | |
| 733 history::IconType icon_type, | |
| 734 const std::vector<history::FaviconDataElement>& elements, | |
| 735 const history::IconURLSizesMap& icon_url_sizes); | |
| 700 | 736 |
| 701 // Used by the FaviconService to get a favicon from the history backend. | 737 // Used by the FaviconService to mark the favicons for the page as being out |
| 702 void GetFaviconForURL(FaviconService::GetFaviconRequest* request, | |
| 703 const GURL& page_url, | |
| 704 int icon_types); | |
| 705 | |
| 706 // Used by the FaviconService to get a favicon from the history backend. | |
| 707 void GetFaviconForID(FaviconService::GetFaviconRequest* request, | |
| 708 history::FaviconID id); | |
| 709 | |
| 710 // Used by the FaviconService to mark the favicon for the page as being out | |
| 711 // of date. | 738 // of date. |
| 712 void SetFaviconOutOfDateForPage(const GURL& page_url); | 739 void SetFaviconsOutOfDateForPage(const GURL& page_url); |
| 713 | 740 |
| 714 // Used by the FaviconService to clone favicons from one page to another, | 741 // Used by the FaviconService to clone favicons from one page to another, |
| 715 // provided that other page does not already have favicons. | 742 // provided that other page does not already have favicons. |
| 716 void CloneFavicon(const GURL& old_page_url, const GURL& new_page_url); | 743 void CloneFavicons(const GURL& old_page_url, const GURL& new_page_url); |
| 717 | 744 |
| 718 // Used by the FaviconService for importing many favicons for many pages at | 745 // Used by the FaviconService for importing many favicons for many pages at |
| 719 // once. The pages must exist, any favicon sets for unknown pages will be | 746 // once. The pages must exist, any favicon sets for unknown pages will be |
| 720 // discarded. Existing favicons will not be overwritten. | 747 // discarded. Existing favicons will not be overwritten. |
| 721 void SetImportedFavicons( | 748 void SetImportedFavicons( |
| 722 const std::vector<history::ImportedFaviconUsage>& favicon_usage); | 749 const std::vector<history::ImportedFaviconUsage>& favicon_usage); |
| 723 | 750 |
| 724 // Used by the FaviconService to set the favicon for a page on the history | |
| 725 // backend. | |
| 726 void SetFavicon(const GURL& page_url, | |
| 727 const GURL& icon_url, | |
| 728 const std::vector<unsigned char>& image_data, | |
| 729 history::IconType icon_type); | |
| 730 | |
| 731 | |
| 732 // Sets the in-memory URL database. This is called by the backend once the | 751 // Sets the in-memory URL database. This is called by the backend once the |
| 733 // database is loaded to make it available. | 752 // database is loaded to make it available. |
| 734 void SetInMemoryBackend(int backend_id, | 753 void SetInMemoryBackend(int backend_id, |
| 735 history::InMemoryHistoryBackend* mem_backend); | 754 history::InMemoryHistoryBackend* mem_backend); |
| 736 | 755 |
| 737 // Called by our BackendDelegate when there is a problem reading the database. | 756 // Called by our BackendDelegate when there is a problem reading the database. |
| 738 void NotifyProfileError(int backend_id, sql::InitStatus init_status); | 757 void NotifyProfileError(int backend_id, sql::InitStatus init_status); |
| 739 | 758 |
| 740 // Call to schedule a given task for running on the history thread with the | 759 // Call to schedule a given task for running on the history thread with the |
| 741 // specified priority. The task will have ownership taken. | 760 // specified priority. The task will have ownership taken. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 950 // The index used for quick history lookups. | 969 // The index used for quick history lookups. |
| 951 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 970 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 952 | 971 |
| 953 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > | 972 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > |
| 954 visit_database_observers_; | 973 visit_database_observers_; |
| 955 | 974 |
| 956 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 975 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 957 }; | 976 }; |
| 958 | 977 |
| 959 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ | 978 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ |
| OLD | NEW |