| 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_AUTOFILL_EXTERNAL_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 11 #include "base/string16.h" | 12 #include "base/string16.h" |
| 12 #include "chrome/browser/autofill/password_autofill_manager.h" | 13 #include "chrome/browser/autofill/password_autofill_manager.h" |
| 13 #include "chrome/browser/ui/autofill/autofill_popup_delegate.h" | 14 #include "chrome/browser/ui/autofill/autofill_popup_delegate.h" |
| 14 #include "chrome/common/form_data.h" | 15 #include "chrome/common/form_data.h" |
| 15 #include "chrome/common/form_field_data.h" | 16 #include "chrome/common/form_field_data.h" |
| 16 #include "chrome/common/password_form_fill_data.h" | 17 #include "chrome/common/password_form_fill_data.h" |
| 17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/web_contents_user_data.h" | 20 #include "content/public/browser/web_contents_user_data.h" |
| 20 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 40 public content::NotificationObserver, | 41 public content::NotificationObserver, |
| 41 public AutofillPopupDelegate { | 42 public AutofillPopupDelegate { |
| 42 public: | 43 public: |
| 43 // Creates an AutofillExternalDelegate and attaches it to the specified | 44 // Creates an AutofillExternalDelegate and attaches it to the specified |
| 44 // contents; the second argument is an AutofillManager managing Autofill for | 45 // contents; the second argument is an AutofillManager managing Autofill for |
| 45 // that WebContents. | 46 // that WebContents. |
| 46 static void CreateForWebContentsAndManager(content::WebContents* web_contents, | 47 static void CreateForWebContentsAndManager(content::WebContents* web_contents, |
| 47 AutofillManager* autofill_manager); | 48 AutofillManager* autofill_manager); |
| 48 | 49 |
| 49 // AutofillPopupDelegate implementation. | 50 // AutofillPopupDelegate implementation. |
| 51 virtual void OnPopupShown(content::KeyboardListener* listener) OVERRIDE; |
| 52 virtual void OnPopupHidden(content::KeyboardListener* listener) OVERRIDE; |
| 50 virtual void DidSelectSuggestion(int identifier) OVERRIDE; | 53 virtual void DidSelectSuggestion(int identifier) OVERRIDE; |
| 51 virtual void DidAcceptSuggestion(const string16& value, | 54 virtual void DidAcceptSuggestion(const string16& value, |
| 52 int identifier) OVERRIDE; | 55 int identifier) OVERRIDE; |
| 53 virtual void RemoveSuggestion(const string16& value, int identifier) OVERRIDE; | 56 virtual void RemoveSuggestion(const string16& value, int identifier) OVERRIDE; |
| 54 virtual void ClearPreviewedForm() OVERRIDE; | 57 virtual void ClearPreviewedForm() OVERRIDE; |
| 55 virtual void ControllerDestroyed() OVERRIDE; | |
| 56 | 58 |
| 57 // Records and associates a query_id with web form data. Called | 59 // Records and associates a query_id with web form data. Called |
| 58 // when the renderer posts an Autofill query to the browser. |bounds| | 60 // when the renderer posts an Autofill query to the browser. |bounds| |
| 59 // is window relative. |display_warning_if_disabled| tells us if we should | 61 // is window relative. |display_warning_if_disabled| tells us if we should |
| 60 // display warnings (such as autofill is disabled, but had suggestions). | 62 // display warnings (such as autofill is disabled, but had suggestions). |
| 61 // We might not want to display the warning if a website has disabled | 63 // We might not want to display the warning if a website has disabled |
| 62 // Autocomplete because they have their own popup, and showing our popup | 64 // Autocomplete because they have their own popup, and showing our popup |
| 63 // on to of theirs would be a poor user experience. | 65 // on to of theirs would be a poor user experience. |
| 64 virtual void OnQuery(int query_id, | 66 virtual void OnQuery(int query_id, |
| 65 const FormData& form, | 67 const FormData& form, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 std::vector<int>* autofill_unique_ids); | 156 std::vector<int>* autofill_unique_ids); |
| 155 | 157 |
| 156 // content::NotificationObserver method override. | 158 // content::NotificationObserver method override. |
| 157 virtual void Observe(int type, | 159 virtual void Observe(int type, |
| 158 const content::NotificationSource& source, | 160 const content::NotificationSource& source, |
| 159 const content::NotificationDetails& details) OVERRIDE; | 161 const content::NotificationDetails& details) OVERRIDE; |
| 160 | 162 |
| 161 // The web_contents associated with this delegate. | 163 // The web_contents associated with this delegate. |
| 162 content::WebContents* web_contents_; // weak; owns me. | 164 content::WebContents* web_contents_; // weak; owns me. |
| 163 AutofillManager* autofill_manager_; // weak. | 165 AutofillManager* autofill_manager_; // weak. |
| 164 AutofillPopupControllerImpl* controller_; // weak. | 166 base::WeakPtr<AutofillPopupControllerImpl> controller_; |
| 165 | 167 |
| 166 // Password Autofill manager, handles all password-related Autofilling. | 168 // Password Autofill manager, handles all password-related Autofilling. |
| 167 PasswordAutofillManager password_autofill_manager_; | 169 PasswordAutofillManager password_autofill_manager_; |
| 168 | 170 |
| 169 // The ID of the last request sent for form field Autofill. Used to ignore | 171 // The ID of the last request sent for form field Autofill. Used to ignore |
| 170 // out of date responses. | 172 // out of date responses. |
| 171 int autofill_query_id_; | 173 int autofill_query_id_; |
| 172 | 174 |
| 173 // A scoped container for notification registries. | 175 // A scoped container for notification registries. |
| 174 content::NotificationRegistrar registrar_; | 176 content::NotificationRegistrar registrar_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 187 // The current data list values. | 189 // The current data list values. |
| 188 std::vector<string16> data_list_values_; | 190 std::vector<string16> data_list_values_; |
| 189 std::vector<string16> data_list_labels_; | 191 std::vector<string16> data_list_labels_; |
| 190 std::vector<string16> data_list_icons_; | 192 std::vector<string16> data_list_icons_; |
| 191 std::vector<int> data_list_unique_ids_; | 193 std::vector<int> data_list_unique_ids_; |
| 192 | 194 |
| 193 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 195 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
| 194 }; | 196 }; |
| 195 | 197 |
| 196 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 198 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| OLD | NEW |