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 // 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 Loading... | |
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, |
Jói
2013/03/15 17:40:59
This base will have to move to WebDataServiceBase,
| |
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 virtual bool IsDatabaseLoaded(); | 139 virtual bool IsDatabaseLoaded(); |
141 virtual WebDatabase* GetDatabase(); | 140 virtual WebDatabase* GetDatabase(); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 // thread. | 476 // thread. |
478 // Currently only Autocomplete and Autofill profiles use the new Sync API, but | 477 // Currently only Autocomplete and Autofill profiles use the new Sync API, but |
479 // all the database data should migrate to this API over time. | 478 // all the database data should migrate to this API over time. |
480 AutocompleteSyncableService* autocomplete_syncable_service_; | 479 AutocompleteSyncableService* autocomplete_syncable_service_; |
481 AutofillProfileSyncableService* autofill_profile_syncable_service_; | 480 AutofillProfileSyncableService* autofill_profile_syncable_service_; |
482 | 481 |
483 DISALLOW_COPY_AND_ASSIGN(WebDataService); | 482 DISALLOW_COPY_AND_ASSIGN(WebDataService); |
484 }; | 483 }; |
485 | 484 |
486 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ | 485 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ |
OLD | NEW |