OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CORE_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_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/core/browser/webdata/autofill_webdata_service.h" | 12 #include "components/autofill/core/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 | 14 |
15 namespace content { | |
16 class BrowserContext; | |
17 class WebContents; | |
18 } | |
19 | |
20 namespace autofill { | 15 namespace autofill { |
21 | 16 |
22 class AutofillDriver; | 17 class AutofillDriver; |
23 class AutofillExternalDelegate; | 18 class AutofillExternalDelegate; |
24 class AutofillManagerDelegate; | 19 class AutofillManagerDelegate; |
25 struct FormData; | 20 struct FormData; |
26 | 21 |
27 // Per-tab Autocomplete history manager. Handles receiving form data | 22 // Per-tab Autocomplete history manager. Handles receiving form data |
28 // from the renderer and the storing and retrieving of form data | 23 // from the renderer and the storing and retrieving of form data |
29 // through WebDataServiceBase. | 24 // through WebDataServiceBase. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // Sends the given |suggestions| for display in the Autofill popup. | 58 // Sends the given |suggestions| for display in the Autofill popup. |
64 void SendSuggestions(const std::vector<base::string16>* suggestions); | 59 void SendSuggestions(const std::vector<base::string16>* suggestions); |
65 | 60 |
66 // Used by tests to disable sending IPC. | 61 // Used by tests to disable sending IPC. |
67 void set_send_ipc(bool send_ipc) { send_ipc_ = send_ipc; } | 62 void set_send_ipc(bool send_ipc) { send_ipc_ = send_ipc; } |
68 | 63 |
69 private: | 64 private: |
70 // Cancels the currently pending WebDataService query, if there is one. | 65 // Cancels the currently pending WebDataService query, if there is one. |
71 void CancelPendingQuery(); | 66 void CancelPendingQuery(); |
72 | 67 |
73 content::BrowserContext* browser_context_; | |
74 // Provides driver-level context. Must outlive this object. | 68 // Provides driver-level context. Must outlive this object. |
75 AutofillDriver* driver_; | 69 AutofillDriver* driver_; |
76 scoped_refptr<AutofillWebDataService> autofill_data_; | 70 scoped_refptr<AutofillWebDataService> database_; |
77 | 71 |
78 // When the manager makes a request from WebDataServiceBase, the database is | 72 // When the manager makes a request from WebDataServiceBase, the database is |
79 // queried on another thread, we record the query handle until we get called | 73 // queried on another thread, we record the query handle until we get called |
80 // back. We also store the autofill results so we can send them together. | 74 // back. We also store the autofill results so we can send them together. |
81 WebDataServiceBase::Handle pending_query_handle_; | 75 WebDataServiceBase::Handle pending_query_handle_; |
82 int query_id_; | 76 int query_id_; |
83 std::vector<base::string16> autofill_values_; | 77 std::vector<base::string16> autofill_values_; |
84 std::vector<base::string16> autofill_labels_; | 78 std::vector<base::string16> autofill_labels_; |
85 std::vector<base::string16> autofill_icons_; | 79 std::vector<base::string16> autofill_icons_; |
86 std::vector<int> autofill_unique_ids_; | 80 std::vector<int> autofill_unique_ids_; |
87 | 81 |
88 // Delegate to perform external processing (display, selection) on | 82 // Delegate to perform external processing (display, selection) on |
89 // our behalf. Weak. | 83 // our behalf. Weak. |
90 AutofillExternalDelegate* external_delegate_; | 84 AutofillExternalDelegate* external_delegate_; |
91 | 85 |
92 // Delegate to provide whether or not autocomplete functionality is enabled. | 86 // Delegate to provide whether or not autocomplete functionality is enabled. |
93 AutofillManagerDelegate* const manager_delegate_; | 87 AutofillManagerDelegate* const manager_delegate_; |
94 | 88 |
95 // Whether IPC is sent. | 89 // Whether IPC is sent. |
96 bool send_ipc_; | 90 bool send_ipc_; |
97 | 91 |
98 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager); | 92 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager); |
99 }; | 93 }; |
100 | 94 |
101 } // namespace autofill | 95 } // namespace autofill |
102 | 96 |
103 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 97 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ |
OLD | NEW |