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