Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1522)

Side by Side Diff: chrome/browser/history/history.h

Issue 10399087: Converting BookmarkModel and HistoryService to ProfileKeyedServices. This just performs the initial… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_factory.cc ('k') | chrome/browser/history/history.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_H_ 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_H_
6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ 6 #define CHROME_BROWSER_HISTORY_HISTORY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/observer_list_threadsafe.h" 17 #include "base/observer_list_threadsafe.h"
18 #include "base/string16.h" 18 #include "base/string16.h"
19 #include "chrome/browser/cancelable_request.h" 19 #include "chrome/browser/cancelable_request.h"
20 #include "chrome/browser/favicon/favicon_service.h" 20 #include "chrome/browser/favicon/favicon_service.h"
21 #include "chrome/browser/history/history_types.h" 21 #include "chrome/browser/history/history_types.h"
22 #include "chrome/browser/profiles/refcounted_profile_keyed_service.h"
22 #include "chrome/browser/search_engines/template_url_id.h" 23 #include "chrome/browser/search_engines/template_url_id.h"
23 #include "chrome/common/ref_counted_util.h" 24 #include "chrome/common/ref_counted_util.h"
24 #include "content/public/browser/notification_observer.h" 25 #include "content/public/browser/notification_observer.h"
25 #include "content/public/browser/notification_registrar.h" 26 #include "content/public/browser/notification_registrar.h"
26 #include "content/public/common/page_transition_types.h" 27 #include "content/public/common/page_transition_types.h"
27 #include "sql/init_status.h" 28 #include "sql/init_status.h"
28 29
29 #if defined(OS_ANDROID) 30 #if defined(OS_ANDROID)
30 #include "chrome/browser/history/android/android_history_provider_service.h" 31 #include "chrome/browser/history/android/android_history_provider_service.h"
31 #endif 32 #endif
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 virtual ~HistoryDBTask() {} 90 virtual ~HistoryDBTask() {}
90 }; 91 };
91 92
92 // The history service records page titles, and visit times, as well as 93 // The history service records page titles, and visit times, as well as
93 // (eventually) information about autocomplete. 94 // (eventually) information about autocomplete.
94 // 95 //
95 // This service is thread safe. Each request callback is invoked in the 96 // This service is thread safe. Each request callback is invoked in the
96 // thread that made the request. 97 // thread that made the request.
97 class HistoryService : public CancelableRequestProvider, 98 class HistoryService : public CancelableRequestProvider,
98 public content::NotificationObserver, 99 public content::NotificationObserver,
99 public base::RefCountedThreadSafe<HistoryService> { 100 public RefcountedProfileKeyedService {
100 public: 101 public:
101 // Miscellaneous commonly-used types. 102 // Miscellaneous commonly-used types.
102 typedef std::vector<PageUsageData*> PageUsageDataList; 103 typedef std::vector<PageUsageData*> PageUsageDataList;
103 104
104 // Must call Init after construction. 105 // Must call Init after construction.
105 explicit HistoryService(Profile* profile); 106 explicit HistoryService(Profile* profile);
106 // The empty constructor is provided only for testing. 107 // The empty constructor is provided only for testing.
107 HistoryService(); 108 HistoryService();
108 109
109 // Initializes the history service, returning true on success. On false, do 110 // Initializes the history service, returning true on success. On false, do
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // system. Callers should not store or cache this value. 153 // system. Callers should not store or cache this value.
153 // 154 //
154 // TODO(brettw) this should return the InMemoryHistoryBackend. 155 // TODO(brettw) this should return the InMemoryHistoryBackend.
155 history::URLDatabase* InMemoryDatabase(); 156 history::URLDatabase* InMemoryDatabase();
156 157
157 // Return the quick history index. 158 // Return the quick history index.
158 history::InMemoryURLIndex* InMemoryIndex() const { 159 history::InMemoryURLIndex* InMemoryIndex() const {
159 return in_memory_url_index_.get(); 160 return in_memory_url_index_.get();
160 } 161 }
161 162
163 // RefcountedProfileKeyedService:
164 virtual void ShutdownOnUIThread() OVERRIDE;
165
162 // Navigation ---------------------------------------------------------------- 166 // Navigation ----------------------------------------------------------------
163 167
164 // Adds the given canonical URL to history with the current time as the visit 168 // Adds the given canonical URL to history with the current time as the visit
165 // time. Referrer may be the empty string. 169 // time. Referrer may be the empty string.
166 // 170 //
167 // The supplied render process host is used to scope the given page ID. Page 171 // The supplied render process host is used to scope the given page ID. Page
168 // IDs are only unique inside a given render process, so we need that to 172 // IDs are only unique inside a given render process, so we need that to
169 // differentiate them. This pointer should not be dereferenced by the history 173 // differentiate them. This pointer should not be dereferenced by the history
170 // system. 174 // system.
171 // 175 //
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 // The index used for quick history lookups. 950 // The index used for quick history lookups.
947 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; 951 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_;
948 952
949 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > 953 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> >
950 visit_database_observers_; 954 visit_database_observers_;
951 955
952 DISALLOW_COPY_AND_ASSIGN(HistoryService); 956 DISALLOW_COPY_AND_ASSIGN(HistoryService);
953 }; 957 };
954 958
955 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ 959 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_factory.cc ('k') | chrome/browser/history/history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698