| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 int visit_count, | 474 int visit_count, |
| 475 int typed_count, | 475 int typed_count, |
| 476 base::Time last_visit, | 476 base::Time last_visit, |
| 477 bool hidden, | 477 bool hidden, |
| 478 history::VisitSource visit_source); | 478 history::VisitSource visit_source); |
| 479 | 479 |
| 480 // The same as AddPageWithDetails() but takes a vector. | 480 // The same as AddPageWithDetails() but takes a vector. |
| 481 void AddPagesWithDetails(const history::URLRows& info, | 481 void AddPagesWithDetails(const history::URLRows& info, |
| 482 history::VisitSource visit_source); | 482 history::VisitSource visit_source); |
| 483 | 483 |
| 484 // Returns true if this looks like the type of URL we want to add to the | |
| 485 // history. We filter out some URLs such as JavaScript. | |
| 486 static bool CanAddURL(const GURL& url); | |
| 487 | |
| 488 base::WeakPtr<HistoryService> AsWeakPtr(); | 484 base::WeakPtr<HistoryService> AsWeakPtr(); |
| 489 | 485 |
| 490 // syncer::SyncableService implementation. | 486 // syncer::SyncableService implementation. |
| 491 syncer::SyncMergeResult MergeDataAndStartSyncing( | 487 syncer::SyncMergeResult MergeDataAndStartSyncing( |
| 492 syncer::ModelType type, | 488 syncer::ModelType type, |
| 493 const syncer::SyncDataList& initial_sync_data, | 489 const syncer::SyncDataList& initial_sync_data, |
| 494 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 490 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 495 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | 491 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; |
| 496 void StopSyncing(syncer::ModelType type) override; | 492 void StopSyncing(syncer::ModelType type) override; |
| 497 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; | 493 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 // Call to schedule a given task for running on the history thread with the | 761 // Call to schedule a given task for running on the history thread with the |
| 766 // specified priority. The task will have ownership taken. | 762 // specified priority. The task will have ownership taken. |
| 767 void ScheduleTask(SchedulePriority priority, const base::Closure& task); | 763 void ScheduleTask(SchedulePriority priority, const base::Closure& task); |
| 768 | 764 |
| 769 // Invokes all callback registered by AddFaviconChangedCallback. | 765 // Invokes all callback registered by AddFaviconChangedCallback. |
| 770 void NotifyFaviconChanged(const std::set<GURL>& changed_favicons); | 766 void NotifyFaviconChanged(const std::set<GURL>& changed_favicons); |
| 771 | 767 |
| 772 base::ThreadChecker thread_checker_; | 768 base::ThreadChecker thread_checker_; |
| 773 | 769 |
| 774 // The thread used by the history service to run complicated operations. | 770 // The thread used by the history service to run complicated operations. |
| 775 // |thread_| is NULL once |Cleanup| is NULL. | 771 // |thread_| is null once Cleanup() is called. |
| 776 base::Thread* thread_; | 772 base::Thread* thread_; |
| 777 | 773 |
| 778 // This class has most of the implementation and runs on the 'thread_'. | 774 // This class has most of the implementation and runs on the 'thread_'. |
| 779 // You MUST communicate with this class ONLY through the thread_'s | 775 // You MUST communicate with this class ONLY through the thread_'s |
| 780 // message_loop(). | 776 // message_loop(). |
| 781 // | 777 // |
| 782 // This pointer will be NULL once Cleanup() has been called, meaning no | 778 // This pointer will be null once Cleanup() has been called, meaning no |
| 783 // more calls should be made to the history thread. | 779 // more calls should be made to the history thread. |
| 784 scoped_refptr<history::HistoryBackend> history_backend_; | 780 scoped_refptr<history::HistoryBackend> history_backend_; |
| 785 | 781 |
| 786 // A cache of the user-typed URLs kept in memory that is used by the | 782 // A cache of the user-typed URLs kept in memory that is used by the |
| 787 // autocomplete system. This will be NULL until the database has been created | 783 // autocomplete system. This will be null until the database has been created |
| 788 // on the background thread. | 784 // on the background thread. |
| 789 // TODO(mrossetti): Consider changing ownership. See http://crbug.com/138321 | 785 // TODO(mrossetti): Consider changing ownership. See http://crbug.com/138321 |
| 790 scoped_ptr<history::InMemoryHistoryBackend> in_memory_backend_; | 786 scoped_ptr<history::InMemoryHistoryBackend> in_memory_backend_; |
| 791 | 787 |
| 792 // The history service will inform its VisitDelegate of URLs recorded and | 788 // The history service will inform its VisitDelegate of URLs recorded and |
| 793 // removed from the history database. This may be null during testing. | 789 // removed from the history database. This may be null during testing. |
| 794 scoped_ptr<history::VisitDelegate> visit_delegate_; | 790 scoped_ptr<history::VisitDelegate> visit_delegate_; |
| 795 | 791 |
| 796 // The history client, may be null when testing. The object should otherwise | 792 // The history client, may be null when testing. The object should otherwise |
| 797 // outlive |HistoryService|. | 793 // outlive |HistoryService|. |
| 798 history::HistoryClient* history_client_; | 794 history::HistoryClient* history_client_; |
| 799 | 795 |
| 800 // Has the backend finished loading? The backend is loaded once Init has | 796 // Has the backend finished loading? The backend is loaded once Init has |
| 801 // completed. | 797 // completed. |
| 802 bool backend_loaded_; | 798 bool backend_loaded_; |
| 803 | 799 |
| 804 ObserverList<history::HistoryServiceObserver> observers_; | 800 ObserverList<history::HistoryServiceObserver> observers_; |
| 805 base::CallbackList<void(const std::set<GURL>&)> | 801 base::CallbackList<void(const std::set<GURL>&)> |
| 806 favicon_changed_callback_list_; | 802 favicon_changed_callback_list_; |
| 807 | 803 |
| 808 history::DeleteDirectiveHandler delete_directive_handler_; | 804 history::DeleteDirectiveHandler delete_directive_handler_; |
| 809 | 805 |
| 810 // All vended weak pointers are invalidated in Cleanup(). | 806 // All vended weak pointers are invalidated in Cleanup(). |
| 811 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 807 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
| 812 | 808 |
| 813 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 809 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 814 }; | 810 }; |
| 815 | 811 |
| 816 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 812 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| OLD | NEW |