Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(547)

Side by Side Diff: components/autofill/core/browser/autocomplete_history_manager.h

Issue 772253003: Create an autofill Suggestion class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/suggestion.h"
12 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 13 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
13 #include "components/webdata/common/web_data_service_consumer.h" 14 #include "components/webdata/common/web_data_service_consumer.h"
14 15
15 namespace autofill { 16 namespace autofill {
16 17
17 class AutofillDriver; 18 class AutofillDriver;
18 class AutofillExternalDelegate; 19 class AutofillExternalDelegate;
19 class AutofillClient; 20 class AutofillClient;
20 struct FormData; 21 struct FormData;
21 22
(...skipping 10 matching lines...) Expand all
32 void OnWebDataServiceRequestDone(WebDataServiceBase::Handle h, 33 void OnWebDataServiceRequestDone(WebDataServiceBase::Handle h,
33 const WDTypedResult* result) override; 34 const WDTypedResult* result) override;
34 35
35 // Pass-through functions that are called by AutofillManager, after it has 36 // Pass-through functions that are called by AutofillManager, after it has
36 // dispatched a message. 37 // dispatched a message.
37 virtual void OnGetAutocompleteSuggestions( 38 virtual void OnGetAutocompleteSuggestions(
38 int query_id, 39 int query_id,
39 const base::string16& name, 40 const base::string16& name,
40 const base::string16& prefix, 41 const base::string16& prefix,
41 const std::string& form_control_type, 42 const std::string& form_control_type,
42 const std::vector<base::string16>& autofill_values, 43 const std::vector<Suggestion>& suggestions);
43 const std::vector<base::string16>& autofill_labels,
44 const std::vector<base::string16>& autofill_icons,
45 const std::vector<int>& autofill_unique_ids);
46 virtual void OnFormSubmitted(const FormData& form); 44 virtual void OnFormSubmitted(const FormData& form);
47 45
48 // Cancels the currently pending WebDataService query, if there is one. 46 // Cancels the currently pending WebDataService query, if there is one.
49 void CancelPendingQuery(); 47 void CancelPendingQuery();
50 48
51 // Must be public for the external delegate to use. 49 // Must be public for the external delegate to use.
52 void OnRemoveAutocompleteEntry(const base::string16& name, 50 void OnRemoveAutocompleteEntry(const base::string16& name,
53 const base::string16& value); 51 const base::string16& value);
54 52
55 // Sets our external delegate. 53 // Sets our external delegate.
56 void SetExternalDelegate(AutofillExternalDelegate* delegate); 54 void SetExternalDelegate(AutofillExternalDelegate* delegate);
57 55
58 protected: 56 protected:
59 friend class AutofillManagerTest; 57 friend class AutofillManagerTest;
60 58
61 // Sends the given |suggestions| for display in the Autofill popup. 59 // Sends the stored suggestions plus the new autocomplete results for display
62 void SendSuggestions(const std::vector<base::string16>* suggestions); 60 // in the Autofill popup. The parameter may be null if there are no new
61 // autocomplete additions.
62 void SendSuggestions(const std::vector<base::string16>* new_results);
63 63
64 private: 64 private:
65 // Provides driver-level context. Must outlive this object. 65 // Provides driver-level context. Must outlive this object.
66 AutofillDriver* driver_; 66 AutofillDriver* driver_;
67 scoped_refptr<AutofillWebDataService> database_; 67 scoped_refptr<AutofillWebDataService> database_;
68 68
69 // When the manager makes a request from WebDataServiceBase, the database is 69 // When the manager makes a request from WebDataServiceBase, the database is
70 // queried on another thread, we record the query handle until we get called 70 // queried on another thread, we record the query handle until we get called
71 // back. We also store the autofill results so we can send them together. 71 // back. We also store the autofill results so we can send them together.
72 WebDataServiceBase::Handle pending_query_handle_; 72 WebDataServiceBase::Handle pending_query_handle_;
73 int query_id_; 73 int query_id_;
74 std::vector<base::string16> autofill_values_; 74 std::vector<Suggestion> autofill_suggestions_;
75 std::vector<base::string16> autofill_labels_;
76 std::vector<base::string16> autofill_icons_;
77 std::vector<int> autofill_unique_ids_;
78 75
79 // Delegate to perform external processing (display, selection) on 76 // Delegate to perform external processing (display, selection) on
80 // our behalf. Weak. 77 // our behalf. Weak.
81 AutofillExternalDelegate* external_delegate_; 78 AutofillExternalDelegate* external_delegate_;
82 79
83 // Delegate to provide whether or not autocomplete functionality is enabled. 80 // Delegate to provide whether or not autocomplete functionality is enabled.
84 AutofillClient* const autofill_client_; 81 AutofillClient* const autofill_client_;
85 82
86 // Whether IPC is sent. 83 // Whether IPC is sent.
87 bool send_ipc_; 84 bool send_ipc_;
88 85
89 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager); 86 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager);
90 }; 87 };
91 88
92 } // namespace autofill 89 } // namespace autofill
93 90
94 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_ 91 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/BUILD.gn ('k') | components/autofill/core/browser/autocomplete_history_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698