summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete_history_manager.h
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 19:55:45 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 19:55:45 +0000
commit6db0def9b89c58b9ade972ac1e9b0d4f8f88d858 (patch)
treed9e0a78de0fd72ec56e424750f3b399e89010f70 /chrome/browser/autocomplete_history_manager.h
parent7fce6e9a1e243fe31b686ef2123c453f7f210450 (diff)
downloadchromium_src-6db0def9b89c58b9ade972ac1e9b0d4f8f88d858.zip
chromium_src-6db0def9b89c58b9ade972ac1e9b0d4f8f88d858.tar.gz
chromium_src-6db0def9b89c58b9ade972ac1e9b0d4f8f88d858.tar.bz2
Rename FormFieldHistoryManager to AutocompleteHistory manager to better reflect its relation to the Autocomplete feature.
BUG=33032 TEST=none Review URL: http://codereview.chromium.org/661323 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40408 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete_history_manager.h')
-rw-r--r--chrome/browser/autocomplete_history_manager.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete_history_manager.h b/chrome/browser/autocomplete_history_manager.h
new file mode 100644
index 0000000..b2e37f5
--- /dev/null
+++ b/chrome/browser/autocomplete_history_manager.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_
+#define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_
+
+#include <string>
+
+#include "chrome/browser/pref_member.h"
+#include "chrome/browser/renderer_host/render_view_host_delegate.h"
+#include "chrome/browser/webdata/web_data_service.h"
+
+namespace webkit_glue {
+class FormFieldValues;
+}
+
+class Profile;
+class TabContents;
+
+// Per-tab Autocomplete history manager. Handles receiving form data from the
+// renderer and the storing and retrieving of form data through WebDataService.
+class AutocompleteHistoryManager
+ : public RenderViewHostDelegate::FormFieldHistory,
+ public WebDataServiceConsumer {
+ public:
+ explicit AutocompleteHistoryManager(TabContents* tab_contents);
+ virtual ~AutocompleteHistoryManager();
+
+ Profile* profile();
+
+ // RenderViewHostDelegate::FormFieldHistory implementation.
+ virtual void FormFieldValuesSubmitted(
+ const webkit_glue::FormFieldValues& form);
+ virtual bool GetFormFieldHistorySuggestions(int query_id,
+ const string16& name,
+ const string16& prefix);
+ virtual void RemoveFormFieldHistoryEntry(const string16& name,
+ const string16& value);
+
+ // WebDataServiceConsumer implementation.
+ virtual void OnWebDataServiceRequestDone(WebDataService::Handle h,
+ const WDTypedResult* result);
+
+ static void RegisterUserPrefs(PrefService* prefs);
+
+ private:
+ void CancelPendingQuery();
+ void StoreFormEntriesInWebDatabase(const webkit_glue::FormFieldValues& form);
+ void SendSuggestions(const WDTypedResult* suggestions);
+
+ TabContents* tab_contents_;
+
+ BooleanPrefMember form_autofill_enabled_;
+
+ // When the manager makes a request from WebDataService, the database
+ // is queried on another thread, we record the query handle until we
+ // get called back.
+ WebDataService::Handle pending_query_handle_;
+ int query_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager);
+};
+
+#endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_MANAGER_H_