| 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 CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 void OnGetAutocompleteSuggestions( | 43 void OnGetAutocompleteSuggestions( |
| 44 int query_id, | 44 int query_id, |
| 45 const string16& name, | 45 const string16& name, |
| 46 const string16& prefix, | 46 const string16& prefix, |
| 47 const std::vector<string16>& autofill_values, | 47 const std::vector<string16>& autofill_values, |
| 48 const std::vector<string16>& autofill_labels, | 48 const std::vector<string16>& autofill_labels, |
| 49 const std::vector<string16>& autofill_icons, | 49 const std::vector<string16>& autofill_icons, |
| 50 const std::vector<int>& autofill_unique_ids); | 50 const std::vector<int>& autofill_unique_ids); |
| 51 void OnFormSubmitted(const webkit::forms::FormData& form); | 51 void OnFormSubmitted(const webkit::forms::FormData& form); |
| 52 | 52 |
| 53 // Must be public for the external delegate to use. |
| 54 void OnRemoveAutocompleteEntry(const string16& name, const string16& value); |
| 55 |
| 53 // Sets our external delegate. | 56 // Sets our external delegate. |
| 54 void SetExternalDelegate(AutofillExternalDelegate* delegate); | 57 void SetExternalDelegate(AutofillExternalDelegate* delegate); |
| 55 | 58 |
| 56 protected: | 59 protected: |
| 57 friend class AutocompleteHistoryManagerTest; | 60 friend class AutocompleteHistoryManagerTest; |
| 58 friend class AutofillManagerTest; | 61 friend class AutofillManagerTest; |
| 59 FRIEND_TEST_ALL_PREFIXES(AutocompleteHistoryManagerTest, ExternalDelegate); | 62 FRIEND_TEST_ALL_PREFIXES(AutocompleteHistoryManagerTest, ExternalDelegate); |
| 60 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, | 63 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest, |
| 61 TestTabContentsWithExternalDelegate); | 64 TestTabContentsWithExternalDelegate); |
| 62 | 65 |
| 63 // For tests. | 66 // For tests. |
| 64 AutocompleteHistoryManager(content::WebContents* web_contents, | 67 AutocompleteHistoryManager(content::WebContents* web_contents, |
| 65 Profile* profile, | 68 Profile* profile, |
| 66 WebDataService* wds); | 69 WebDataService* wds); |
| 67 | 70 |
| 68 void SendSuggestions(const std::vector<string16>* suggestions); | 71 void SendSuggestions(const std::vector<string16>* suggestions); |
| 69 void CancelPendingQuery(); | 72 void CancelPendingQuery(); |
| 70 | 73 |
| 71 // Exposed for testing. | 74 // Exposed for testing. |
| 72 AutofillExternalDelegate* external_delegate() { | 75 AutofillExternalDelegate* external_delegate() { |
| 73 return external_delegate_; | 76 return external_delegate_; |
| 74 } | 77 } |
| 75 | 78 |
| 76 private: | 79 private: |
| 77 void OnRemoveAutocompleteEntry(const string16& name, const string16& value); | |
| 78 | |
| 79 Profile* profile_; | 80 Profile* profile_; |
| 80 scoped_refptr<WebDataService> web_data_service_; | 81 scoped_refptr<WebDataService> web_data_service_; |
| 81 | 82 |
| 82 BooleanPrefMember autofill_enabled_; | 83 BooleanPrefMember autofill_enabled_; |
| 83 | 84 |
| 84 // When the manager makes a request from WebDataService, the database is | 85 // When the manager makes a request from WebDataService, the database is |
| 85 // queried on another thread, we record the query handle until we get called | 86 // queried on another thread, we record the query handle until we get called |
| 86 // back. We also store the autofill results so we can send them together. | 87 // back. We also store the autofill results so we can send them together. |
| 87 WebDataService::Handle pending_query_handle_; | 88 WebDataService::Handle pending_query_handle_; |
| 88 int query_id_; | 89 int query_id_; |
| 89 std::vector<string16> autofill_values_; | 90 std::vector<string16> autofill_values_; |
| 90 std::vector<string16> autofill_labels_; | 91 std::vector<string16> autofill_labels_; |
| 91 std::vector<string16> autofill_icons_; | 92 std::vector<string16> autofill_icons_; |
| 92 std::vector<int> autofill_unique_ids_; | 93 std::vector<int> autofill_unique_ids_; |
| 93 | 94 |
| 94 // Delegate to perform external processing (display, selection) on | 95 // Delegate to perform external processing (display, selection) on |
| 95 // our behalf. Weak. | 96 // our behalf. Weak. |
| 96 AutofillExternalDelegate* external_delegate_; | 97 AutofillExternalDelegate* external_delegate_; |
| 97 | 98 |
| 98 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager); | 99 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager); |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 102 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ |
| OLD | NEW |