| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_WEBDATA_WEB_DATA_SERVICE_H__ | 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ |
| 6 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ | 6 #define CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ |
| 7 | 7 |
| 8 #include <map> |
| 9 |
| 8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 9 #include "base/lock.h" | 11 #include "base/lock.h" |
| 10 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 11 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 12 #include "base/thread.h" | 14 #include "base/thread.h" |
| 13 #include "chrome/browser/webdata/web_database.h" | 15 #include "chrome/browser/webdata/web_database.h" |
| 14 #include "chrome/common/scoped_vector.h" | 16 #include "chrome/common/scoped_vector.h" |
| 15 #include <map> | 17 #include "webkit/glue/autofill_form.h" |
| 16 | 18 |
| 17 struct AutofillForm::Element; | |
| 18 struct IE7PasswordInfo; | 19 struct IE7PasswordInfo; |
| 19 struct PasswordForm; | 20 struct PasswordForm; |
| 20 class AutofillForm; | |
| 21 class GURL; | 21 class GURL; |
| 22 class ShutdownTask; | 22 class ShutdownTask; |
| 23 class TemplateURL; | 23 class TemplateURL; |
| 24 | 24 |
| 25 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
| 26 // | 26 // |
| 27 // WebDataService is a generic data repository for meta data associated with | 27 // WebDataService is a generic data repository for meta data associated with |
| 28 // web pages. All data is retrieved and archived in an asynchronous way. | 28 // web pages. All data is retrieved and archived in an asynchronous way. |
| 29 // | 29 // |
| 30 // All requests return a handle. The handle can be used to cancel the request. | 30 // All requests return a handle. The handle can be used to cancel the request. |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 void RemoveFormElementsAddedBetween(const base::Time& delete_begin, | 376 void RemoveFormElementsAddedBetween(const base::Time& delete_begin, |
| 377 const base::Time& delete_end); | 377 const base::Time& delete_end); |
| 378 | 378 |
| 379 protected: | 379 protected: |
| 380 friend class TemplateURLModelTest; | 380 friend class TemplateURLModelTest; |
| 381 friend class TemplateURLModelTestingProfile; | 381 friend class TemplateURLModelTestingProfile; |
| 382 friend class WebDataServiceTest; | 382 friend class WebDataServiceTest; |
| 383 friend class WebDataRequest; | 383 friend class WebDataRequest; |
| 384 | 384 |
| 385 // This is invoked by the unit test; path is the path of the Web Data file. | 385 // This is invoked by the unit test; path is the path of the Web Data file. |
| 386 bool WebDataService::InitWithPath(const std::wstring& path); | 386 bool InitWithPath(const std::wstring& path); |
| 387 | 387 |
| 388 // Invoked by request implementations when a request has been processed. | 388 // Invoked by request implementations when a request has been processed. |
| 389 void RequestCompleted(Handle h); | 389 void RequestCompleted(Handle h); |
| 390 | 390 |
| 391 // Register the request as a pending request. | 391 // Register the request as a pending request. |
| 392 void RegisterRequest(WebDataRequest* request); | 392 void RegisterRequest(WebDataRequest* request); |
| 393 | 393 |
| 394 ////////////////////////////////////////////////////////////////////////////// | 394 ////////////////////////////////////////////////////////////////////////////// |
| 395 // | 395 // |
| 396 // The following methods are only invoked in the web data service thread. | 396 // The following methods are only invoked in the web data service thread. |
| 397 // | 397 // |
| 398 ////////////////////////////////////////////////////////////////////////////// | 398 ////////////////////////////////////////////////////////////////////////////// |
| 399 private: | 399 private: |
| 400 friend class ShutdownTask; | 400 friend class ShutdownTask; |
| 401 | 401 |
| 402 typedef GenericRequest2<std::vector<const TemplateURL*>, | 402 typedef GenericRequest2<std::vector<const TemplateURL*>, |
| 403 std::vector<TemplateURL*>> SetKeywordsRequest; | 403 std::vector<TemplateURL*> > SetKeywordsRequest; |
| 404 | 404 |
| 405 // Initialize the database with the provided path. | 405 // Initialize the database with the provided path. |
| 406 void InitializeDatabase(const std::wstring& path); | 406 void InitializeDatabase(const std::wstring& path); |
| 407 | 407 |
| 408 // Commit any pending transaction and deletes the database. | 408 // Commit any pending transaction and deletes the database. |
| 409 void WebDataService::ShutdownDatabase(); | 409 void ShutdownDatabase(); |
| 410 | 410 |
| 411 // Commit the current transaction and creates a new one. | 411 // Commit the current transaction and creates a new one. |
| 412 void Commit(); | 412 void Commit(); |
| 413 | 413 |
| 414 ////////////////////////////////////////////////////////////////////////////// | 414 ////////////////////////////////////////////////////////////////////////////// |
| 415 // | 415 // |
| 416 // Keywords. | 416 // Keywords. |
| 417 // | 417 // |
| 418 ////////////////////////////////////////////////////////////////////////////// | 418 ////////////////////////////////////////////////////////////////////////////// |
| 419 void AddKeywordImpl(GenericRequest<TemplateURL>* request); | 419 void AddKeywordImpl(GenericRequest<TemplateURL>* request); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 public: | 513 public: |
| 514 | 514 |
| 515 // Called when a request is done. h uniquely identifies the request. | 515 // Called when a request is done. h uniquely identifies the request. |
| 516 // result can be NULL, if no result is expected or if the database could | 516 // result can be NULL, if no result is expected or if the database could |
| 517 // not be opened. The result object is destroyed after this call. | 517 // not be opened. The result object is destroyed after this call. |
| 518 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, | 518 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, |
| 519 const WDTypedResult* result) = 0; | 519 const WDTypedResult* result) = 0; |
| 520 }; | 520 }; |
| 521 | 521 |
| 522 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ | 522 #endif // CHROME_BROWSER_WEBDATA_WEB_DATA_SERVICE_H__ |
| OLD | NEW |