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

Side by Side Diff: chrome/browser/webdata/web_data_service.h

Issue 12491017: Make WebDataService no longer depend on ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean-up Created 7 years, 9 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
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 // Chromium settings and storage represent user-selected preferences and 5 // Chromium settings and storage represent user-selected preferences and
6 // information and MUST not be extracted, overwritten or modified except 6 // information and MUST not be extracted, overwritten or modified except
7 // through Chromium defined APIs. 7 // through Chromium defined APIs.
8 8
9 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ 9 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__
10 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ 10 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__
11 11
12 #include <map> 12 #include <map>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/callback_forward.h" 16 #include "base/callback_forward.h"
17 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
18 #include "base/location.h" 18 #include "base/location.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/sequenced_task_runner_helpers.h" 20 #include "base/sequenced_task_runner_helpers.h"
21 #include "base/synchronization/lock.h" 21 #include "base/synchronization/lock.h"
22 #include "chrome/browser/api/webdata/autofill_web_data_service.h" 22 #include "chrome/browser/api/webdata/autofill_web_data_service.h"
23 #include "chrome/browser/api/webdata/web_data_results.h" 23 #include "chrome/browser/api/webdata/web_data_results.h"
24 #include "chrome/browser/api/webdata/web_data_service_base.h" 24 #include "chrome/browser/api/webdata/web_data_service_base.h"
25 #include "chrome/browser/api/webdata/web_data_service_consumer.h" 25 #include "chrome/browser/api/webdata/web_data_service_consumer.h"
26 #include "chrome/browser/profiles/refcounted_profile_keyed_service.h"
27 #include "chrome/browser/search_engines/template_url.h" 26 #include "chrome/browser/search_engines/template_url.h"
28 #include "chrome/browser/search_engines/template_url_id.h" 27 #include "chrome/browser/search_engines/template_url_id.h"
29 #include "chrome/browser/webdata/keyword_table.h" 28 #include "chrome/browser/webdata/keyword_table.h"
30 #include "chrome/browser/webdata/web_data_request_manager.h" 29 #include "chrome/browser/webdata/web_data_request_manager.h"
31 #include "chrome/browser/webdata/web_database.h" 30 #include "chrome/browser/webdata/web_database.h"
32 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
33 #include "sql/init_status.h" 32 #include "sql/init_status.h"
34 33
35 class AutocompleteSyncableService; 34 class AutocompleteSyncableService;
36 class AutofillChange; 35 class AutofillChange;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // Identifies the ID of the TemplateURL that is the default search. A value of 96 // Identifies the ID of the TemplateURL that is the default search. A value of
98 // 0 indicates there is no default search provider. 97 // 0 indicates there is no default search provider.
99 int64 default_search_provider_id; 98 int64 default_search_provider_id;
100 // Version of the built-in keywords. A value of 0 indicates a first run. 99 // Version of the built-in keywords. A value of 0 indicates a first run.
101 int builtin_keyword_version; 100 int builtin_keyword_version;
102 }; 101 };
103 102
104 class WebDataServiceConsumer; 103 class WebDataServiceConsumer;
105 104
106 class WebDataService 105 class WebDataService
107 : public WebDataServiceBase, 106 : public base::RefCountedThreadSafe<WebDataService,
108 public AutofillWebData, 107 content::BrowserThread::DeleteOnUIThread>,
109 public RefcountedProfileKeyedService { 108 public WebDataServiceBase,
109 public AutofillWebData {
110 public: 110 public:
111 // Retrieve a WebDataService for the given context. 111 // Retrieve a WebDataService for the given context.
112 static scoped_refptr<WebDataService> FromBrowserContext( 112 static scoped_refptr<WebDataService> FromBrowserContext(
113 content::BrowserContext* context); 113 content::BrowserContext* context);
114 114
115 WebDataService(); 115 WebDataService();
116 116
117 // WebDataServiceBase implementation. 117 // WebDataServiceBase implementation.
118 virtual void CancelRequest(Handle h) OVERRIDE; 118 virtual void CancelRequest(Handle h) OVERRIDE;
119 virtual content::NotificationSource GetNotificationSource() OVERRIDE; 119 virtual content::NotificationSource GetNotificationSource() OVERRIDE;
120 120
121 // Notifies listeners on the UI thread that multiple changes have been made to 121 // Notifies listeners on the UI thread that multiple changes have been made to
122 // to Autofill records of the database. 122 // to Autofill records of the database.
123 // NOTE: This method is intended to be called from the DB thread. It 123 // NOTE: This method is intended to be called from the DB thread. It
124 // it asynchronously notifies listeners on the UI thread. 124 // it asynchronously notifies listeners on the UI thread.
125 // |web_data_service| may be NULL for testing purposes. 125 // |web_data_service| may be NULL for testing purposes.
126 static void NotifyOfMultipleAutofillChanges(WebDataService* web_data_service); 126 static void NotifyOfMultipleAutofillChanges(WebDataService* web_data_service);
127 127
128 // RefcountedProfileKeyedService override:
129 // Shutdown the web data service. The service can no longer be used after this 128 // Shutdown the web data service. The service can no longer be used after this
130 // call. 129 // call.
131 virtual void ShutdownOnUIThread() OVERRIDE; 130 void ShutdownOnUIThread();
132 131
133 // Initializes the web data service. 132 // Initializes the web data service.
134 void Init(const base::FilePath& path); 133 void Init(const base::FilePath& path);
135 134
136 // Unloads the database without actually shutting down the service. This can 135 // Unloads the database without actually shutting down the service. This can
137 // be used to temporarily reduce the browser process' memory footprint. 136 // be used to temporarily reduce the browser process' memory footprint.
138 void UnloadDatabase(); 137 void UnloadDatabase();
139 138
140 // Unloads the database permanently and shuts down service. 139 // Unloads the database permanently and shuts down service.
141 void ShutdownDatabase(); 140 void ShutdownDatabase();
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 // thread. 482 // thread.
484 // Currently only Autocomplete and Autofill profiles use the new Sync API, but 483 // Currently only Autocomplete and Autofill profiles use the new Sync API, but
485 // all the database data should migrate to this API over time. 484 // all the database data should migrate to this API over time.
486 AutocompleteSyncableService* autocomplete_syncable_service_; 485 AutocompleteSyncableService* autocomplete_syncable_service_;
487 AutofillProfileSyncableService* autofill_profile_syncable_service_; 486 AutofillProfileSyncableService* autofill_profile_syncable_service_;
488 487
489 DISALLOW_COPY_AND_ASSIGN(WebDataService); 488 DISALLOW_COPY_AND_ASSIGN(WebDataService);
490 }; 489 };
491 490
492 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ 491 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698