| 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 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/history/delete_directive_handler.h" | 26 #include "chrome/browser/history/delete_directive_handler.h" |
| 27 #include "chrome/browser/history/typed_url_syncable_service.h" | 27 #include "chrome/browser/history/typed_url_syncable_service.h" |
| 28 #include "components/favicon_base/favicon_callback.h" | 28 #include "components/favicon_base/favicon_callback.h" |
| 29 #include "components/favicon_base/favicon_usage_data.h" | 29 #include "components/favicon_base/favicon_usage_data.h" |
| 30 #include "components/history/core/browser/keyword_id.h" | 30 #include "components/history/core/browser/keyword_id.h" |
| 31 #include "components/keyed_service/core/keyed_service.h" | 31 #include "components/keyed_service/core/keyed_service.h" |
| 32 #include "sql/init_status.h" | 32 #include "sql/init_status.h" |
| 33 #include "sync/api/syncable_service.h" | 33 #include "sync/api/syncable_service.h" |
| 34 #include "ui/base/page_transition_types.h" | 34 #include "ui/base/page_transition_types.h" |
| 35 | 35 |
| 36 #if defined(OS_ANDROID) | |
| 37 class AndroidHistoryProviderService; | |
| 38 #endif | |
| 39 | |
| 40 class GURL; | 36 class GURL; |
| 41 class PageUsageRequest; | 37 class PageUsageRequest; |
| 42 class SkBitmap; | 38 class SkBitmap; |
| 43 | 39 |
| 44 namespace base { | 40 namespace base { |
| 45 class FilePath; | 41 class FilePath; |
| 46 class Thread; | 42 class Thread; |
| 47 } | 43 } |
| 48 | 44 |
| 49 namespace history { | 45 namespace history { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 74 // (eventually) information about autocomplete. | 70 // (eventually) information about autocomplete. |
| 75 // | 71 // |
| 76 // This service is thread safe. Each request callback is invoked in the | 72 // This service is thread safe. Each request callback is invoked in the |
| 77 // thread that made the request. | 73 // thread that made the request. |
| 78 class HistoryService : public syncer::SyncableService, public KeyedService { | 74 class HistoryService : public syncer::SyncableService, public KeyedService { |
| 79 public: | 75 public: |
| 80 // Miscellaneous commonly-used types. | 76 // Miscellaneous commonly-used types. |
| 81 typedef std::vector<history::PageUsageData*> PageUsageDataList; | 77 typedef std::vector<history::PageUsageData*> PageUsageDataList; |
| 82 | 78 |
| 83 // Must call Init after construction. The empty constructor provided only for | 79 // Must call Init after construction. The empty constructor provided only for |
| 84 // unit tests. When using the full constructor, |history_client| and |profile| | 80 // unit tests. When using the full constructor, |history_client| may only be |
| 85 // should only be null during testing, while |visit_delegate| may be null if | 81 // null during testing, while |visit_delegate| may be null if the embedder use |
| 86 // the embedder use another way to track visited links. | 82 // another way to track visited links. |
| 87 HistoryService(); | 83 HistoryService(); |
| 88 HistoryService(history::HistoryClient* history_client, | 84 HistoryService(history::HistoryClient* history_client, |
| 89 scoped_ptr<history::VisitDelegate> visit_delegate); | 85 scoped_ptr<history::VisitDelegate> visit_delegate); |
| 90 ~HistoryService() override; | 86 ~HistoryService() override; |
| 91 | 87 |
| 92 // Initializes the history service, returning true on success. On false, do | 88 // Initializes the history service, returning true on success. On false, do |
| 93 // not call any other functions. The given directory will be used for storing | 89 // not call any other functions. The given directory will be used for storing |
| 94 // the history files. |languages| is a comma-separated list of languages to | 90 // the history files. |languages| is a comma-separated list of languages to |
| 95 // use when interpreting URLs, it must not be empty (except during testing). | 91 // use when interpreting URLs, it must not be empty (except during testing). |
| 96 bool Init(const std::string& languages, | 92 bool Init(const std::string& languages, |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 scoped_ptr<history::VisitDelegate> visit_delegate_; | 800 scoped_ptr<history::VisitDelegate> visit_delegate_; |
| 805 | 801 |
| 806 // The history client, may be null when testing. The object should otherwise | 802 // The history client, may be null when testing. The object should otherwise |
| 807 // outlive |HistoryService|. | 803 // outlive |HistoryService|. |
| 808 history::HistoryClient* history_client_; | 804 history::HistoryClient* history_client_; |
| 809 | 805 |
| 810 // Has the backend finished loading? The backend is loaded once Init has | 806 // Has the backend finished loading? The backend is loaded once Init has |
| 811 // completed. | 807 // completed. |
| 812 bool backend_loaded_; | 808 bool backend_loaded_; |
| 813 | 809 |
| 814 // Cached values from Init(), used whenever we need to reload the backend. | |
| 815 base::FilePath history_dir_; | |
| 816 bool no_db_; | |
| 817 | |
| 818 // The index used for quick history lookups. | 810 // The index used for quick history lookups. |
| 819 // TODO(mrossetti): Move in_memory_url_index out of history_service. | 811 // TODO(mrossetti): Move in_memory_url_index out of history_service. |
| 820 // See http://crbug.com/138321 | 812 // See http://crbug.com/138321 |
| 821 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 813 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 822 | 814 |
| 823 ObserverList<history::HistoryServiceObserver> observers_; | 815 ObserverList<history::HistoryServiceObserver> observers_; |
| 824 base::CallbackList<void(const std::set<GURL>&)> | 816 base::CallbackList<void(const std::set<GURL>&)> |
| 825 favicon_changed_callback_list_; | 817 favicon_changed_callback_list_; |
| 826 | 818 |
| 827 history::DeleteDirectiveHandler delete_directive_handler_; | 819 history::DeleteDirectiveHandler delete_directive_handler_; |
| 828 | 820 |
| 829 // All vended weak pointers are invalidated in Cleanup(). | 821 // All vended weak pointers are invalidated in Cleanup(). |
| 830 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 822 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
| 831 | 823 |
| 832 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 824 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 833 }; | 825 }; |
| 834 | 826 |
| 835 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 827 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| OLD | NEW |