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" | |
22 #include "chrome/browser/api/webdata/autofill_web_data_service.h" | 21 #include "chrome/browser/api/webdata/autofill_web_data_service.h" |
23 #include "chrome/browser/api/webdata/web_data_results.h" | 22 #include "chrome/browser/api/webdata/web_data_results.h" |
24 #include "chrome/browser/api/webdata/web_data_service_base.h" | 23 #include "chrome/browser/api/webdata/web_data_service_base.h" |
25 #include "chrome/browser/api/webdata/web_data_service_consumer.h" | 24 #include "chrome/browser/api/webdata/web_data_service_consumer.h" |
26 #include "chrome/browser/search_engines/template_url.h" | 25 #include "chrome/browser/search_engines/template_url.h" |
27 #include "chrome/browser/search_engines/template_url_id.h" | 26 #include "chrome/browser/search_engines/template_url_id.h" |
28 #include "chrome/browser/webdata/keyword_table.h" | 27 #include "chrome/browser/webdata/keyword_table.h" |
29 #include "chrome/browser/webdata/web_database.h" | 28 #include "chrome/browser/webdata/web_database.h" |
30 | 29 |
31 class AutocompleteSyncableService; | 30 class AutocompleteSyncableService; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 class WebDataServiceConsumer; | 99 class WebDataServiceConsumer; |
101 | 100 |
102 class WebDataService | 101 class WebDataService |
103 : public WebDataServiceBase, | 102 : public WebDataServiceBase, |
104 public AutofillWebData { | 103 public AutofillWebData { |
105 public: | 104 public: |
106 // Retrieve a WebDataService for the given context. | 105 // Retrieve a WebDataService for the given context. |
107 static scoped_refptr<WebDataService> FromBrowserContext( | 106 static scoped_refptr<WebDataService> FromBrowserContext( |
108 content::BrowserContext* context); | 107 content::BrowserContext* context); |
109 | 108 |
110 explicit WebDataService(const ProfileErrorCallback& callback); | 109 WebDataService(scoped_refptr<WebDatabaseService> wdbs, |
| 110 const ProfileErrorCallback& callback); |
111 | 111 |
112 // Notifies listeners on the UI thread that multiple changes have been made to | 112 // Notifies listeners on the UI thread that multiple changes have been made to |
113 // to Autofill records of the database. | 113 // to Autofill records of the database. |
114 // NOTE: This method is intended to be called from the DB thread. It | 114 // NOTE: This method is intended to be called from the DB thread. It |
115 // it asynchronously notifies listeners on the UI thread. | 115 // it asynchronously notifies listeners on the UI thread. |
116 // |web_data_service| may be NULL for testing purposes. | 116 // |web_data_service| may be NULL for testing purposes. |
117 static void NotifyOfMultipleAutofillChanges(WebDataService* web_data_service); | 117 static void NotifyOfMultipleAutofillChanges(WebDataService* web_data_service); |
118 | 118 |
119 | |
120 | |
121 ////////////////////////////////////////////////////////////////////////////// | 119 ////////////////////////////////////////////////////////////////////////////// |
122 // | 120 // |
123 // Keywords | 121 // Keywords |
124 // | 122 // |
125 ////////////////////////////////////////////////////////////////////////////// | 123 ////////////////////////////////////////////////////////////////////////////// |
126 | 124 |
127 // As the database processes requests at a later date, all deletion is | 125 // As the database processes requests at a later date, all deletion is |
128 // done on the background thread. | 126 // done on the background thread. |
129 // | 127 // |
130 // Many of the keyword related methods do not return a handle. This is because | 128 // Many of the keyword related methods do not return a handle. This is because |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 friend class WebDataRequest; | 291 friend class WebDataRequest; |
294 | 292 |
295 // For unit tests, passes a null callback. | 293 // For unit tests, passes a null callback. |
296 WebDataService(); | 294 WebDataService(); |
297 | 295 |
298 virtual ~WebDataService(); | 296 virtual ~WebDataService(); |
299 | 297 |
300 private: | 298 private: |
301 ////////////////////////////////////////////////////////////////////////////// | 299 ////////////////////////////////////////////////////////////////////////////// |
302 // | 300 // |
303 // The following methods are only invoked in the web data service thread. | 301 // The following methods are only invoked on the DB thread. |
304 // | 302 // |
305 ////////////////////////////////////////////////////////////////////////////// | 303 ////////////////////////////////////////////////////////////////////////////// |
306 | 304 |
307 ////////////////////////////////////////////////////////////////////////////// | 305 ////////////////////////////////////////////////////////////////////////////// |
308 // | 306 // |
309 // Keywords. | 307 // Keywords. |
310 // | 308 // |
311 ////////////////////////////////////////////////////////////////////////////// | 309 ////////////////////////////////////////////////////////////////////////////// |
312 WebDatabase::State AddKeywordImpl( | 310 WebDatabase::State AddKeywordImpl( |
313 const TemplateURLData& data, WebDatabase* db); | 311 const TemplateURLData& data, WebDatabase* db); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 417 |
420 // Callbacks to ensure that sensitive info is destroyed if request is | 418 // Callbacks to ensure that sensitive info is destroyed if request is |
421 // cancelled. | 419 // cancelled. |
422 void DestroyAutofillProfileResult(const WDTypedResult* result); | 420 void DestroyAutofillProfileResult(const WDTypedResult* result); |
423 void DestroyAutofillCreditCardResult(const WDTypedResult* result); | 421 void DestroyAutofillCreditCardResult(const WDTypedResult* result); |
424 | 422 |
425 DISALLOW_COPY_AND_ASSIGN(WebDataService); | 423 DISALLOW_COPY_AND_ASSIGN(WebDataService); |
426 }; | 424 }; |
427 | 425 |
428 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ | 426 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ |
OLD | NEW |