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

Side by Side Diff: chrome/browser/autocomplete_history_manager.h

Issue 10843067: Move AutocompleteHistoryManager into chrome/browser/autofill/ as it is (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR Created 8 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autocomplete_history_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_
7
8 #include <vector>
9
10 #include "base/gtest_prod_util.h"
11 #include "chrome/browser/prefs/pref_member.h"
12 #include "chrome/browser/webdata/web_data_service.h"
13 #include "content/public/browser/web_contents_observer.h"
14
15 namespace webkit {
16 namespace forms {
17 struct FormData;
18 }
19 }
20
21 class AutofillExternalDelegate;
22 class Profile;
23
24 // Per-tab Autocomplete history manager. Handles receiving form data from the
25 // renderer and the storing and retrieving of form data through WebDataService.
26 class AutocompleteHistoryManager : public content::WebContentsObserver,
27 public WebDataServiceConsumer {
28 public:
29 explicit AutocompleteHistoryManager(content::WebContents* web_contents);
30 virtual ~AutocompleteHistoryManager();
31
32 // content::WebContentsObserver implementation.
33 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
34
35 // WebDataServiceConsumer implementation.
36 virtual void OnWebDataServiceRequestDone(
37 WebDataService::Handle h,
38 const WDTypedResult* result) OVERRIDE;
39
40 // Pass-through functions that are called by AutofillManager, after it has
41 // dispatched a message.
42 void OnGetAutocompleteSuggestions(
43 int query_id,
44 const string16& name,
45 const string16& prefix,
46 const std::vector<string16>& autofill_values,
47 const std::vector<string16>& autofill_labels,
48 const std::vector<string16>& autofill_icons,
49 const std::vector<int>& autofill_unique_ids);
50 void OnFormSubmitted(const webkit::forms::FormData& form);
51
52 // Must be public for the external delegate to use.
53 void OnRemoveAutocompleteEntry(const string16& name, const string16& value);
54
55 // Sets our external delegate.
56 void SetExternalDelegate(AutofillExternalDelegate* delegate);
57
58 protected:
59 friend class AutocompleteHistoryManagerTest;
60 friend class AutofillManagerTest;
61 FRIEND_TEST_ALL_PREFIXES(AutocompleteHistoryManagerTest, ExternalDelegate);
62 FRIEND_TEST_ALL_PREFIXES(AutofillManagerTest,
63 TestTabContentsWithExternalDelegate);
64
65 // For tests.
66 AutocompleteHistoryManager(content::WebContents* web_contents,
67 Profile* profile,
68 WebDataService* wds);
69
70 void SendSuggestions(const std::vector<string16>* suggestions);
71 void CancelPendingQuery();
72
73 // Exposed for testing.
74 AutofillExternalDelegate* external_delegate() {
75 return external_delegate_;
76 }
77
78 private:
79 Profile* profile_;
80 scoped_refptr<WebDataService> web_data_service_;
81
82 BooleanPrefMember autofill_enabled_;
83
84 // 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 // back. We also store the autofill results so we can send them together.
87 WebDataService::Handle pending_query_handle_;
88 int query_id_;
89 std::vector<string16> autofill_values_;
90 std::vector<string16> autofill_labels_;
91 std::vector<string16> autofill_icons_;
92 std::vector<int> autofill_unique_ids_;
93
94 // Delegate to perform external processing (display, selection) on
95 // our behalf. Weak.
96 AutofillExternalDelegate* external_delegate_;
97
98 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager);
99 };
100
101 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete_history_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698