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 COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 void RemoveObserver(HistoryServiceObserver* observer); | 433 void RemoveObserver(HistoryServiceObserver* observer); |
434 | 434 |
435 // Generic Stuff ------------------------------------------------------------- | 435 // Generic Stuff ------------------------------------------------------------- |
436 | 436 |
437 // Schedules a HistoryDBTask for running on the history backend thread. See | 437 // Schedules a HistoryDBTask for running on the history backend thread. See |
438 // HistoryDBTask for details on what this does. Takes ownership of |task|. | 438 // HistoryDBTask for details on what this does. Takes ownership of |task|. |
439 virtual base::CancelableTaskTracker::TaskId ScheduleDBTask( | 439 virtual base::CancelableTaskTracker::TaskId ScheduleDBTask( |
440 scoped_ptr<HistoryDBTask> task, | 440 scoped_ptr<HistoryDBTask> task, |
441 base::CancelableTaskTracker* tracker); | 441 base::CancelableTaskTracker* tracker); |
442 | 442 |
443 // This callback is invoked when favicon change for urls. | 443 // Callback for when favicon data changes. The first std::vector contains a |
444 typedef base::Callback<void(const std::set<GURL>&)> OnFaviconChangedCallback; | 444 // list of page URLs for which the favicon data has changed. The second |
445 // std::vector contains a list of icon URLs for which the favicon data has | |
446 // changed. | |
447 typedef base::Callback<void(const std::vector<GURL>&, | |
448 const std::vector<GURL>&)> | |
449 OnFaviconChangedCallback; | |
Roger McFarlane (Chromium)
2015/05/13 18:28:12
uber-nit: OnFaviconsChangedCallback
pkotwicz
2015/05/14 14:18:54
Thanks for catching this!
| |
445 | 450 |
446 // Add a callback to the list. The callback will remain registered until the | 451 // Add a callback to the list. The callback will remain registered until the |
447 // returned Subscription is destroyed. This must occurs before HistoryService | 452 // returned Subscription is destroyed. The Subscription must be destroyed |
448 // is destroyed. | 453 // before HistoryService is destroyed. |
449 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> | 454 scoped_ptr<base::CallbackList<void(const std::vector<GURL>&, |
455 const std::vector<GURL>&)>::Subscription> | |
450 AddFaviconChangedCallback(const OnFaviconChangedCallback& callback) | 456 AddFaviconChangedCallback(const OnFaviconChangedCallback& callback) |
451 WARN_UNUSED_RESULT; | 457 WARN_UNUSED_RESULT; |
452 | 458 |
453 // Testing ------------------------------------------------------------------- | 459 // Testing ------------------------------------------------------------------- |
454 | 460 |
455 // Runs |flushed| after bouncing off the history thread. | 461 // Runs |flushed| after bouncing off the history thread. |
456 void FlushForTest(const base::Closure& flushed); | 462 void FlushForTest(const base::Closure& flushed); |
457 | 463 |
458 // Designed for unit tests, this passes the given task on to the history | 464 // Designed for unit tests, this passes the given task on to the history |
459 // backend to be called once the history backend has terminated. This allows | 465 // backend to be called once the history backend has terminated. This allows |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 // database is loaded to make it available. | 761 // database is loaded to make it available. |
756 void SetInMemoryBackend(scoped_ptr<InMemoryHistoryBackend> mem_backend); | 762 void SetInMemoryBackend(scoped_ptr<InMemoryHistoryBackend> mem_backend); |
757 | 763 |
758 // Called by our BackendDelegate when there is a problem reading the database. | 764 // Called by our BackendDelegate when there is a problem reading the database. |
759 void NotifyProfileError(sql::InitStatus init_status); | 765 void NotifyProfileError(sql::InitStatus init_status); |
760 | 766 |
761 // Call to schedule a given task for running on the history thread with the | 767 // Call to schedule a given task for running on the history thread with the |
762 // specified priority. The task will have ownership taken. | 768 // specified priority. The task will have ownership taken. |
763 void ScheduleTask(SchedulePriority priority, const base::Closure& task); | 769 void ScheduleTask(SchedulePriority priority, const base::Closure& task); |
764 | 770 |
765 // Invokes all callback registered by AddFaviconChangedCallback. | 771 // Called when the favicons for the given page URLs (e.g. |
766 void NotifyFaviconChanged(const std::set<GURL>& changed_favicons); | 772 // http://www.google.com) and the given icon URLs (e.g. |
773 // http://www.google.com/favicon.ico) have changed. | |
774 void NotifyFaviconsChanged(const std::vector<GURL>& page_urls, | |
775 const std::vector<GURL>& icon_urls); | |
767 | 776 |
768 base::ThreadChecker thread_checker_; | 777 base::ThreadChecker thread_checker_; |
769 | 778 |
770 // The thread used by the history service to run complicated operations. | 779 // The thread used by the history service to run complicated operations. |
771 // |thread_| is null once Cleanup() is called. | 780 // |thread_| is null once Cleanup() is called. |
772 base::Thread* thread_; | 781 base::Thread* thread_; |
773 | 782 |
774 // This class has most of the implementation and runs on the 'thread_'. | 783 // This class has most of the implementation and runs on the 'thread_'. |
775 // You MUST communicate with this class ONLY through the thread_'s | 784 // You MUST communicate with this class ONLY through the thread_'s |
776 // message_loop(). | 785 // message_loop(). |
(...skipping 14 matching lines...) Expand all Loading... | |
791 | 800 |
792 // The history client, may be null when testing. The object should otherwise | 801 // The history client, may be null when testing. The object should otherwise |
793 // outlive |HistoryService|. | 802 // outlive |HistoryService|. |
794 HistoryClient* history_client_; | 803 HistoryClient* history_client_; |
795 | 804 |
796 // Has the backend finished loading? The backend is loaded once Init has | 805 // Has the backend finished loading? The backend is loaded once Init has |
797 // completed. | 806 // completed. |
798 bool backend_loaded_; | 807 bool backend_loaded_; |
799 | 808 |
800 ObserverList<HistoryServiceObserver> observers_; | 809 ObserverList<HistoryServiceObserver> observers_; |
801 base::CallbackList<void(const std::set<GURL>&)> | 810 base::CallbackList<void(const std::vector<GURL>&, const std::vector<GURL>&)> |
802 favicon_changed_callback_list_; | 811 favicon_changed_callback_list_; |
803 | 812 |
804 DeleteDirectiveHandler delete_directive_handler_; | 813 DeleteDirectiveHandler delete_directive_handler_; |
805 | 814 |
806 // All vended weak pointers are invalidated in Cleanup(). | 815 // All vended weak pointers are invalidated in Cleanup(). |
807 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 816 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
808 | 817 |
809 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 818 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
810 }; | 819 }; |
811 | 820 |
812 } // namespace history | 821 } // namespace history |
813 | 822 |
814 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ | 823 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_SERVICE_H_ |
OLD | NEW |