Chromium Code Reviews| 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 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/prefs/pref_member.h" | 11 #include "base/prefs/pref_member.h" |
| 12 #include "components/autofill/browser/webdata/autofill_webdata_service.h" | 12 #include "components/autofill/browser/webdata/autofill_webdata_service.h" |
| 13 #include "components/webdata/common/web_data_service_consumer.h" | 13 #include "components/webdata/common/web_data_service_consumer.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class BrowserContext; | 17 class BrowserContext; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace autofill { | 20 namespace autofill { |
| 21 | 21 |
| 22 class AutofillExternalDelegate; | 22 class AutofillExternalDelegate; |
| 23 class AutofillManagerDelegate; | |
| 23 struct FormData; | 24 struct FormData; |
| 24 | 25 |
| 25 // Per-tab Autocomplete history manager. Handles receiving form data | 26 // Per-tab Autocomplete history manager. Handles receiving form data |
| 26 // from the renderer and the storing and retrieving of form data | 27 // from the renderer and the storing and retrieving of form data |
| 27 // through WebDataServiceBase. | 28 // through WebDataServiceBase. |
| 28 class AutocompleteHistoryManager : public content::WebContentsObserver, | 29 class AutocompleteHistoryManager : public content::WebContentsObserver, |
| 29 public WebDataServiceConsumer { | 30 public WebDataServiceConsumer { |
| 30 public: | 31 public: |
| 31 explicit AutocompleteHistoryManager(content::WebContents* web_contents); | 32 AutocompleteHistoryManager(content::WebContents* web_contents, |
| 33 autofill::AutofillManagerDelegate* const delegate); | |
|
Ilya Sherman
2013/06/18 05:56:25
nit: It's quite contrary to existing style that I'
sgurun-gerrit only
2013/06/19 00:16:17
Done.
| |
| 32 virtual ~AutocompleteHistoryManager(); | 34 virtual ~AutocompleteHistoryManager(); |
| 33 | 35 |
| 34 // content::WebContentsObserver implementation. | 36 // content::WebContentsObserver implementation. |
| 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 36 | 38 |
| 37 // WebDataServiceConsumer implementation. | 39 // WebDataServiceConsumer implementation. |
| 38 virtual void OnWebDataServiceRequestDone( | 40 virtual void OnWebDataServiceRequestDone( |
| 39 WebDataServiceBase::Handle h, | 41 WebDataServiceBase::Handle h, |
| 40 const WDTypedResult* result) OVERRIDE; | 42 const WDTypedResult* result) OVERRIDE; |
| 41 | 43 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 64 // Sends the given |suggestions| for display in the Autofill popup. | 66 // Sends the given |suggestions| for display in the Autofill popup. |
| 65 void SendSuggestions(const std::vector<base::string16>* suggestions); | 67 void SendSuggestions(const std::vector<base::string16>* suggestions); |
| 66 | 68 |
| 67 private: | 69 private: |
| 68 // Cancels the currently pending WebDataService query, if there is one. | 70 // Cancels the currently pending WebDataService query, if there is one. |
| 69 void CancelPendingQuery(); | 71 void CancelPendingQuery(); |
| 70 | 72 |
| 71 content::BrowserContext* browser_context_; | 73 content::BrowserContext* browser_context_; |
| 72 scoped_refptr<AutofillWebDataService> autofill_data_; | 74 scoped_refptr<AutofillWebDataService> autofill_data_; |
| 73 | 75 |
| 74 BooleanPrefMember autofill_enabled_; | 76 BooleanPrefMember autofill_enabled_; |
|
Ilya Sherman
2013/06/18 05:56:25
Can this be removed?
sgurun-gerrit only
2013/06/19 00:16:17
Done.
| |
| 75 | 77 |
| 76 // When the manager makes a request from WebDataServiceBase, the database is | 78 // When the manager makes a request from WebDataServiceBase, the database is |
| 77 // queried on another thread, we record the query handle until we get called | 79 // queried on another thread, we record the query handle until we get called |
| 78 // back. We also store the autofill results so we can send them together. | 80 // back. We also store the autofill results so we can send them together. |
| 79 WebDataServiceBase::Handle pending_query_handle_; | 81 WebDataServiceBase::Handle pending_query_handle_; |
| 80 int query_id_; | 82 int query_id_; |
| 81 std::vector<base::string16> autofill_values_; | 83 std::vector<base::string16> autofill_values_; |
| 82 std::vector<base::string16> autofill_labels_; | 84 std::vector<base::string16> autofill_labels_; |
| 83 std::vector<base::string16> autofill_icons_; | 85 std::vector<base::string16> autofill_icons_; |
| 84 std::vector<int> autofill_unique_ids_; | 86 std::vector<int> autofill_unique_ids_; |
| 85 | 87 |
| 86 // Delegate to perform external processing (display, selection) on | 88 // Delegate to perform external processing (display, selection) on |
| 87 // our behalf. Weak. | 89 // our behalf. Weak. |
| 88 AutofillExternalDelegate* external_delegate_; | 90 AutofillExternalDelegate* external_delegate_; |
| 91 autofill::AutofillManagerDelegate* const manager_delegate_; | |
|
Ilya Sherman
2013/06/18 05:56:25
(this const is fine and dandy, though :)
sgurun-gerrit only
2013/06/19 00:16:17
Done.
| |
| 89 | 92 |
| 90 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager); | 93 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager); |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 } // namespace autofill | 96 } // namespace autofill |
| 94 | 97 |
| 95 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 98 #endif // COMPONENTS_AUTOFILL_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ |
| OLD | NEW |