| 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 WebDataService(const base::FilePath& path, | 109 WebDataService(scoped_refptr<WebDatabaseService> wdbs, |
| 111 const ProfileErrorCallback& callback); | 110 const ProfileErrorCallback& callback); |
| 112 | 111 |
| 113 // 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 |
| 114 // to Autofill records of the database. | 113 // to Autofill records of the database. |
| 115 // 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 |
| 116 // it asynchronously notifies listeners on the UI thread. | 115 // it asynchronously notifies listeners on the UI thread. |
| 117 // |web_data_service| may be NULL for testing purposes. | 116 // |web_data_service| may be NULL for testing purposes. |
| 118 static void NotifyOfMultipleAutofillChanges(WebDataService* web_data_service); | 117 static void NotifyOfMultipleAutofillChanges(WebDataService* web_data_service); |
| 119 | 118 |
| 120 | |
| 121 | |
| 122 ////////////////////////////////////////////////////////////////////////////// | 119 ////////////////////////////////////////////////////////////////////////////// |
| 123 // | 120 // |
| 124 // Keywords | 121 // Keywords |
| 125 // | 122 // |
| 126 ////////////////////////////////////////////////////////////////////////////// | 123 ////////////////////////////////////////////////////////////////////////////// |
| 127 | 124 |
| 128 // 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 |
| 129 // done on the background thread. | 126 // done on the background thread. |
| 130 // | 127 // |
| 131 // 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... |
| 294 friend class WebDataRequest; | 291 friend class WebDataRequest; |
| 295 | 292 |
| 296 // For unit tests, passes a null callback. | 293 // For unit tests, passes a null callback. |
| 297 WebDataService(); | 294 WebDataService(); |
| 298 | 295 |
| 299 virtual ~WebDataService(); | 296 virtual ~WebDataService(); |
| 300 | 297 |
| 301 private: | 298 private: |
| 302 ////////////////////////////////////////////////////////////////////////////// | 299 ////////////////////////////////////////////////////////////////////////////// |
| 303 // | 300 // |
| 304 // The following methods are only invoked in the web data service thread. | 301 // The following methods are only invoked on the DB thread. |
| 305 // | 302 // |
| 306 ////////////////////////////////////////////////////////////////////////////// | 303 ////////////////////////////////////////////////////////////////////////////// |
| 307 | 304 |
| 308 ////////////////////////////////////////////////////////////////////////////// | 305 ////////////////////////////////////////////////////////////////////////////// |
| 309 // | 306 // |
| 310 // Keywords. | 307 // Keywords. |
| 311 // | 308 // |
| 312 ////////////////////////////////////////////////////////////////////////////// | 309 ////////////////////////////////////////////////////////////////////////////// |
| 313 WebDatabase::State AddKeywordImpl( | 310 WebDatabase::State AddKeywordImpl( |
| 314 const TemplateURLData& data, WebDatabase* db); | 311 const TemplateURLData& data, WebDatabase* db); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 417 |
| 421 // Callbacks to ensure that sensitive info is destroyed if request is | 418 // Callbacks to ensure that sensitive info is destroyed if request is |
| 422 // cancelled. | 419 // cancelled. |
| 423 void DestroyAutofillProfileResult(const WDTypedResult* result); | 420 void DestroyAutofillProfileResult(const WDTypedResult* result); |
| 424 void DestroyAutofillCreditCardResult(const WDTypedResult* result); | 421 void DestroyAutofillCreditCardResult(const WDTypedResult* result); |
| 425 | 422 |
| 426 DISALLOW_COPY_AND_ASSIGN(WebDataService); | 423 DISALLOW_COPY_AND_ASSIGN(WebDataService); |
| 427 }; | 424 }; |
| 428 | 425 |
| 429 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ | 426 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ |
| OLD | NEW |