Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ | |
| 6 #define ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/files/file_path.h" | |
| 10 #include "base/synchronization/waitable_event.h" | |
| 11 #include "components/autofill/browser/webdata/autofill_webdata_service.h" | |
| 12 #include "components/webdata/common/web_data_service_consumer.h" | |
| 13 #include "components/webdata/common/web_database_service.h" | |
| 14 | |
| 15 namespace android_webview { | |
| 16 | |
| 17 // Handles the database operations necessary to implement the autocomplete | |
| 18 // functionality. This includes creating and initializing the components that | |
| 19 // handle the database backend, and providing a synchronous interface when | |
| 20 // needed (the chromium database components have an async. interface). | |
| 21 class AwFormDatabaseService : public WebDataServiceConsumer { | |
| 22 public: | |
| 23 AwFormDatabaseService(const base::FilePath path); | |
| 24 | |
| 25 virtual ~AwFormDatabaseService(); | |
| 26 | |
| 27 // TODO(sgurun) Who will call this? | |
| 28 void Shutdown(); | |
| 29 | |
| 30 // Returns whether the form has any elements stored. May do | |
|
benm (inactive)
2013/05/07 11:16:11
do you mean whether the database has any elements
sgurun-gerrit only
2013/05/07 18:39:02
Done.
| |
| 31 // IO access and block. | |
| 32 bool HasFormElements(); | |
|
benm (inactive)
2013/05/07 11:16:11
Would HasFormData be a better name for symmetry wi
sgurun-gerrit only
2013/05/07 18:39:02
I think we can use "data" in android_webview/ but
benm (inactive)
2013/05/07 19:06:55
That sounds good to me.
| |
| 33 | |
| 34 // Clear any saved form data. Executes asynchronously. | |
| 35 void ClearFormElements(); | |
|
benm (inactive)
2013/05/07 11:16:11
ClearFormData?
sgurun-gerrit only
2013/05/07 18:39:02
Done.
| |
| 36 | |
| 37 scoped_refptr<autofill::AutofillWebDataService> | |
| 38 get_autofill_webdata_service(); | |
| 39 | |
| 40 // WebDataServiceConsumer implementation. | |
| 41 virtual void OnWebDataServiceRequestDone( | |
| 42 WebDataServiceBase::Handle h, | |
| 43 const WDTypedResult* result) OVERRIDE; | |
| 44 | |
| 45 private: | |
| 46 // Cancels the currently pending WebDataService query, if there is one. | |
| 47 void CancelPendingQuery(); | |
| 48 | |
| 49 void HasFormElementsImpl(); | |
| 50 | |
| 51 // Stores the query handle when an async database query is executed. | |
| 52 WebDataServiceBase::Handle pending_query_handle_; | |
| 53 bool has_form_elements_; | |
| 54 base::WaitableEvent completion_; | |
| 55 | |
| 56 scoped_refptr<autofill::AutofillWebDataService> autofill_data_; | |
| 57 scoped_refptr<WebDatabaseService> web_database_; | |
| 58 | |
| 59 DISALLOW_COPY_AND_ASSIGN(AwFormDatabaseService); | |
| 60 }; | |
| 61 | |
| 62 } // namespace android_webview | |
| 63 | |
| 64 #endif // ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_ | |
| OLD | NEW |