| 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_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 6 #define CHROME_BROWSER_AUTOFILL_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 "chrome/browser/api/prefs/pref_member.h" | 11 #include "chrome/browser/api/prefs/pref_member.h" |
| 12 #include "chrome/browser/api/webdata/autofill_web_data_service.h" | 12 #include "chrome/browser/api/webdata/autofill_web_data_service.h" |
| 13 #include "chrome/browser/api/webdata/web_data_service_consumer.h" | 13 #include "chrome/browser/api/webdata/web_data_service_consumer.h" |
| 14 #include "chrome/browser/common/web_contents_user_data.h" | 14 #include "chrome/browser/common/web_contents_user_data.h" |
| 15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 16 | 16 |
| 17 struct FormData; |
| 18 |
| 17 namespace content { | 19 namespace content { |
| 18 class BrowserContext; | 20 class BrowserContext; |
| 19 } | 21 } |
| 20 | 22 |
| 21 namespace webkit { | |
| 22 namespace forms { | |
| 23 struct FormData; | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 class AutofillExternalDelegate; | 23 class AutofillExternalDelegate; |
| 28 | 24 |
| 29 // Per-tab Autocomplete history manager. Handles receiving form data | 25 // Per-tab Autocomplete history manager. Handles receiving form data |
| 30 // from the renderer and the storing and retrieving of form data | 26 // from the renderer and the storing and retrieving of form data |
| 31 // through WebDataServiceBase. | 27 // through WebDataServiceBase. |
| 32 class AutocompleteHistoryManager | 28 class AutocompleteHistoryManager |
| 33 : public content::WebContentsObserver, | 29 : public content::WebContentsObserver, |
| 34 public WebDataServiceConsumer, | 30 public WebDataServiceConsumer, |
| 35 public WebContentsUserData<AutocompleteHistoryManager> { | 31 public WebContentsUserData<AutocompleteHistoryManager> { |
| 36 public: | 32 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 47 // Pass-through functions that are called by AutofillManager, after it has | 43 // Pass-through functions that are called by AutofillManager, after it has |
| 48 // dispatched a message. | 44 // dispatched a message. |
| 49 void OnGetAutocompleteSuggestions( | 45 void OnGetAutocompleteSuggestions( |
| 50 int query_id, | 46 int query_id, |
| 51 const string16& name, | 47 const string16& name, |
| 52 const string16& prefix, | 48 const string16& prefix, |
| 53 const std::vector<string16>& autofill_values, | 49 const std::vector<string16>& autofill_values, |
| 54 const std::vector<string16>& autofill_labels, | 50 const std::vector<string16>& autofill_labels, |
| 55 const std::vector<string16>& autofill_icons, | 51 const std::vector<string16>& autofill_icons, |
| 56 const std::vector<int>& autofill_unique_ids); | 52 const std::vector<int>& autofill_unique_ids); |
| 57 void OnFormSubmitted(const webkit::forms::FormData& form); | 53 void OnFormSubmitted(const FormData& form); |
| 58 | 54 |
| 59 // Must be public for the external delegate to use. | 55 // Must be public for the external delegate to use. |
| 60 void OnRemoveAutocompleteEntry(const string16& name, const string16& value); | 56 void OnRemoveAutocompleteEntry(const string16& name, const string16& value); |
| 61 | 57 |
| 62 // Sets our external delegate. | 58 // Sets our external delegate. |
| 63 void SetExternalDelegate(AutofillExternalDelegate* delegate); | 59 void SetExternalDelegate(AutofillExternalDelegate* delegate); |
| 64 | 60 |
| 65 protected: | 61 protected: |
| 66 friend class AutocompleteHistoryManagerTest; | 62 friend class AutocompleteHistoryManagerTest; |
| 67 friend class AutofillManagerTest; | 63 friend class AutofillManagerTest; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 std::vector<int> autofill_unique_ids_; | 98 std::vector<int> autofill_unique_ids_; |
| 103 | 99 |
| 104 // Delegate to perform external processing (display, selection) on | 100 // Delegate to perform external processing (display, selection) on |
| 105 // our behalf. Weak. | 101 // our behalf. Weak. |
| 106 AutofillExternalDelegate* external_delegate_; | 102 AutofillExternalDelegate* external_delegate_; |
| 107 | 103 |
| 108 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager); | 104 DISALLOW_COPY_AND_ASSIGN(AutocompleteHistoryManager); |
| 109 }; | 105 }; |
| 110 | 106 |
| 111 #endif // CHROME_BROWSER_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_ | 107 #endif // CHROME_BROWSER_AUTOFILL_AUTOCOMPLETE_HISTORY_MANAGER_H_ |
| OLD | NEW |