| 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_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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 class VisitedLinkMaster; | 57 class VisitedLinkMaster; |
| 58 } | 58 } |
| 59 | 59 |
| 60 namespace history { | 60 namespace history { |
| 61 | 61 |
| 62 class HistoryBackend; | 62 class HistoryBackend; |
| 63 class HistoryClient; | 63 class HistoryClient; |
| 64 class HistoryDatabase; | 64 class HistoryDatabase; |
| 65 class HistoryDBTask; | 65 class HistoryDBTask; |
| 66 class HistoryQueryTest; | 66 class HistoryQueryTest; |
| 67 class HistoryServiceObserver; |
| 67 class HistoryTest; | 68 class HistoryTest; |
| 68 class InMemoryHistoryBackend; | 69 class InMemoryHistoryBackend; |
| 69 class InMemoryURLIndex; | 70 class InMemoryURLIndex; |
| 70 class InMemoryURLIndexTest; | 71 class InMemoryURLIndexTest; |
| 71 class URLDatabase; | 72 class URLDatabase; |
| 72 class VisitDatabaseObserver; | |
| 73 class VisitFilter; | 73 class VisitFilter; |
| 74 struct DownloadRow; | 74 struct DownloadRow; |
| 75 struct HistoryAddPageArgs; | 75 struct HistoryAddPageArgs; |
| 76 struct HistoryDetails; | 76 struct HistoryDetails; |
| 77 struct KeywordSearchTermVisit; | 77 struct KeywordSearchTermVisit; |
| 78 | 78 |
| 79 } // namespace history | 79 } // namespace history |
| 80 | 80 |
| 81 // The history service records page titles, and visit times, as well as | 81 // The history service records page titles, and visit times, as well as |
| 82 // (eventually) information about autocomplete. | 82 // (eventually) information about autocomplete. |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 // Deletes all URL and search term entries matching the given |term| and | 423 // Deletes all URL and search term entries matching the given |term| and |
| 424 // |keyword_id|. | 424 // |keyword_id|. |
| 425 void DeleteMatchingURLsForKeyword(history::KeywordID keyword_id, | 425 void DeleteMatchingURLsForKeyword(history::KeywordID keyword_id, |
| 426 const base::string16& term); | 426 const base::string16& term); |
| 427 | 427 |
| 428 // Bookmarks ----------------------------------------------------------------- | 428 // Bookmarks ----------------------------------------------------------------- |
| 429 | 429 |
| 430 // Notification that a URL is no longer bookmarked. | 430 // Notification that a URL is no longer bookmarked. |
| 431 void URLsNoLongerBookmarked(const std::set<GURL>& urls); | 431 void URLsNoLongerBookmarked(const std::set<GURL>& urls); |
| 432 | 432 |
| 433 // Observers ----------------------------------------------------------------- |
| 434 |
| 435 // Adds/Removes an Observer. |
| 436 void AddObserver(history::HistoryServiceObserver* observer); |
| 437 void RemoveObserver(history::HistoryServiceObserver* observer); |
| 438 |
| 433 // Generic Stuff ------------------------------------------------------------- | 439 // Generic Stuff ------------------------------------------------------------- |
| 434 | 440 |
| 435 // Schedules a HistoryDBTask for running on the history backend thread. See | 441 // Schedules a HistoryDBTask for running on the history backend thread. See |
| 436 // HistoryDBTask for details on what this does. Takes ownership of |task|. | 442 // HistoryDBTask for details on what this does. Takes ownership of |task|. |
| 437 virtual void ScheduleDBTask(scoped_ptr<history::HistoryDBTask> task, | 443 virtual void ScheduleDBTask(scoped_ptr<history::HistoryDBTask> task, |
| 438 base::CancelableTaskTracker* tracker); | 444 base::CancelableTaskTracker* tracker); |
| 439 | 445 |
| 440 // Adds or removes observers for the VisitDatabase. | |
| 441 void AddVisitDatabaseObserver(history::VisitDatabaseObserver* observer); | |
| 442 void RemoveVisitDatabaseObserver(history::VisitDatabaseObserver* observer); | |
| 443 | |
| 444 void NotifyVisitDBObserversOnAddVisit(const history::BriefVisitInfo& info); | |
| 445 | |
| 446 // This callback is invoked when favicon change for urls. | 446 // This callback is invoked when favicon change for urls. |
| 447 typedef base::Callback<void(const std::set<GURL>&)> OnFaviconChangedCallback; | 447 typedef base::Callback<void(const std::set<GURL>&)> OnFaviconChangedCallback; |
| 448 | 448 |
| 449 // Add a callback to the list. The callback will remain registered until the | 449 // Add a callback to the list. The callback will remain registered until the |
| 450 // returned Subscription is destroyed. This must occurs before HistoryService | 450 // returned Subscription is destroyed. This must occurs before HistoryService |
| 451 // is destroyed. | 451 // is destroyed. |
| 452 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> | 452 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> |
| 453 AddFaviconChangedCallback(const OnFaviconChangedCallback& callback) | 453 AddFaviconChangedCallback(const OnFaviconChangedCallback& callback) |
| 454 WARN_UNUSED_RESULT; | 454 WARN_UNUSED_RESULT; |
| 455 | 455 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 | 582 |
| 583 // Notification from the backend that it has finished loading. Sends | 583 // Notification from the backend that it has finished loading. Sends |
| 584 // notification (NOTIFY_HISTORY_LOADED) and sets backend_loaded_ to true. | 584 // notification (NOTIFY_HISTORY_LOADED) and sets backend_loaded_ to true. |
| 585 void OnDBLoaded(); | 585 void OnDBLoaded(); |
| 586 | 586 |
| 587 // Helper function for getting URL information. | 587 // Helper function for getting URL information. |
| 588 // Reads a URLRow from in-memory database. Returns false if database is not | 588 // Reads a URLRow from in-memory database. Returns false if database is not |
| 589 // available or the URL does not exist. | 589 // available or the URL does not exist. |
| 590 bool GetRowForURL(const GURL& url, history::URLRow* url_row); | 590 bool GetRowForURL(const GURL& url, history::URLRow* url_row); |
| 591 | 591 |
| 592 // Observers ----------------------------------------------------------------- |
| 593 |
| 594 // Notify all Observers registered that the VisitDatabase was changed. |
| 595 void NotifyAddVisit(const history::BriefVisitInfo& info); |
| 596 |
| 592 // Favicon ------------------------------------------------------------------- | 597 // Favicon ------------------------------------------------------------------- |
| 593 | 598 |
| 594 // These favicon methods are exposed to the FaviconService. Instead of calling | 599 // These favicon methods are exposed to the FaviconService. Instead of calling |
| 595 // these methods directly you should call the respective method on the | 600 // these methods directly you should call the respective method on the |
| 596 // FaviconService. | 601 // FaviconService. |
| 597 | 602 |
| 598 // Used by FaviconService to get the favicon bitmaps from the history backend | 603 // Used by FaviconService to get the favicon bitmaps from the history backend |
| 599 // whose edge sizes most closely match |desired_sizes| for |icon_types|. If | 604 // whose edge sizes most closely match |desired_sizes| for |icon_types|. If |
| 600 // |desired_sizes| has a '0' entry, the largest favicon bitmap for | 605 // |desired_sizes| has a '0' entry, the largest favicon bitmap for |
| 601 // |icon_types| is returned. The returned FaviconBitmapResults will have at | 606 // |icon_types| is returned. The returned FaviconBitmapResults will have at |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 | 871 |
| 867 // Cached values from Init(), used whenever we need to reload the backend. | 872 // Cached values from Init(), used whenever we need to reload the backend. |
| 868 base::FilePath history_dir_; | 873 base::FilePath history_dir_; |
| 869 bool no_db_; | 874 bool no_db_; |
| 870 | 875 |
| 871 // The index used for quick history lookups. | 876 // The index used for quick history lookups. |
| 872 // TODO(mrossetti): Move in_memory_url_index out of history_service. | 877 // TODO(mrossetti): Move in_memory_url_index out of history_service. |
| 873 // See http://crbug.com/138321 | 878 // See http://crbug.com/138321 |
| 874 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 879 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 875 | 880 |
| 876 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; | 881 ObserverList<history::HistoryServiceObserver> observers_; |
| 877 | |
| 878 base::CallbackList<void(const std::set<GURL>&)> | 882 base::CallbackList<void(const std::set<GURL>&)> |
| 879 favicon_changed_callback_list_; | 883 favicon_changed_callback_list_; |
| 880 | 884 |
| 881 history::DeleteDirectiveHandler delete_directive_handler_; | 885 history::DeleteDirectiveHandler delete_directive_handler_; |
| 882 | 886 |
| 883 // All vended weak pointers are invalidated in Cleanup(). | 887 // All vended weak pointers are invalidated in Cleanup(). |
| 884 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 888 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
| 885 | 889 |
| 886 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 890 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 887 }; | 891 }; |
| 888 | 892 |
| 889 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 893 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| OLD | NEW |