Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "chrome/browser/autofill/password_autofill_manager.h" | |
| 13 #include "webkit/forms/form_data.h" | 14 #include "webkit/forms/form_data.h" |
| 14 #include "webkit/forms/form_field.h" | 15 #include "webkit/forms/form_field.h" |
| 16 #include "webkit/forms/password_form_dom_manager.h" | |
| 15 | 17 |
| 16 class AutofillManager; | 18 class AutofillManager; |
| 17 class TabContentsWrapper; | 19 class TabContentsWrapper; |
| 18 | 20 |
| 19 namespace gfx { | 21 namespace gfx { |
| 20 class Rect; | 22 class Rect; |
| 21 } | 23 } |
| 22 | 24 |
| 23 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. | 25 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. |
| 24 // Once Autofill is moved out of WebKit this class should be the only home for | 26 // Once Autofill is moved out of WebKit this class should be the only home for |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 void DidAcceptAutofillSuggestions(const string16& value, | 67 void DidAcceptAutofillSuggestions(const string16& value, |
| 66 int unique_id, | 68 int unique_id, |
| 67 unsigned index); | 69 unsigned index); |
| 68 | 70 |
| 69 // Informs the delegate that the Autofill previewed form should be cleared. | 71 // Informs the delegate that the Autofill previewed form should be cleared. |
| 70 virtual void ClearPreviewedForm(); | 72 virtual void ClearPreviewedForm(); |
| 71 | 73 |
| 72 // Hide the Autofill poup. | 74 // Hide the Autofill poup. |
| 73 virtual void HideAutofillPopup(); | 75 virtual void HideAutofillPopup(); |
| 74 | 76 |
| 77 // Returns the delegate to its starting state by removing any page specific | |
| 78 // values or settings. | |
| 79 void Reset(); | |
| 80 | |
| 81 // Inform the Password Manager of a filled form. | |
| 82 void AddPasswordFormMapping( | |
| 83 const webkit::forms::FormField& form, | |
| 84 const webkit::forms::PasswordFormFillData& fill_data); | |
| 85 | |
| 75 // Platforms that wish to implement an external Autofill delegate | 86 // Platforms that wish to implement an external Autofill delegate |
| 76 // MUST implement this. The 1st arg is the tab contents that owns | 87 // MUST implement this. The 1st arg is the tab contents that owns |
| 77 // this delegate; the second is the Autofill manager owned by the | 88 // this delegate; the second is the Autofill manager owned by the |
| 78 // tab contents. | 89 // tab contents. |
| 79 static AutofillExternalDelegate* Create(TabContentsWrapper*, | 90 static AutofillExternalDelegate* Create(TabContentsWrapper*, |
| 80 AutofillManager*); | 91 AutofillManager*); |
| 81 protected: | 92 protected: |
| 82 explicit AutofillExternalDelegate(TabContentsWrapper* tab_contents_wrapper, | 93 explicit AutofillExternalDelegate(TabContentsWrapper* tab_contents_wrapper, |
| 83 AutofillManager* autofill_manager); | 94 AutofillManager* autofill_manager); |
| 84 | 95 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 104 private: | 115 private: |
| 105 // Fills the form with the Autofill data corresponding to |unique_id|. | 116 // Fills the form with the Autofill data corresponding to |unique_id|. |
| 106 // If |is_preview| is true then this is just a preview to show the user what | 117 // If |is_preview| is true then this is just a preview to show the user what |
| 107 // would be selected and if |is_preview| is false then the user has selected | 118 // would be selected and if |is_preview| is false then the user has selected |
| 108 // this data. | 119 // this data. |
| 109 void FillAutofillFormData(int unique_id, bool is_preview); | 120 void FillAutofillFormData(int unique_id, bool is_preview); |
| 110 | 121 |
| 111 TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. | 122 TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. |
| 112 AutofillManager* autofill_manager_; // weak. | 123 AutofillManager* autofill_manager_; // weak. |
| 113 | 124 |
| 125 // Password Autofill manager, handles all password related Autofilling. | |
|
Ilya Sherman
2012/03/15 18:27:41
nit: "password related" -> "password-related"
csharp
2012/03/16 20:21:12
Done.
| |
| 126 PasswordAutofillManager password_autofill_manager_; | |
| 127 | |
| 114 // The ID of the last request sent for form field Autofill. Used to ignore | 128 // The ID of the last request sent for form field Autofill. Used to ignore |
| 115 // out of date responses. | 129 // out of date responses. |
| 116 int autofill_query_id_; | 130 int autofill_query_id_; |
| 117 | 131 |
| 118 // The current form and field selected by Autofill. | 132 // The current form and field selected by Autofill. |
| 119 webkit::forms::FormData autofill_query_form_; | 133 webkit::forms::FormData autofill_query_form_; |
| 120 webkit::forms::FormField autofill_query_field_; | 134 webkit::forms::FormField autofill_query_field_; |
| 121 | 135 |
| 122 // Should we display a warning if Autofill is disabled? | 136 // Should we display a warning if Autofill is disabled? |
| 123 bool display_warning_if_disabled_; | 137 bool display_warning_if_disabled_; |
| 124 | 138 |
| 125 // Have we already shown Autofill suggestions for the field the user is | 139 // Have we already shown Autofill suggestions for the field the user is |
| 126 // currently editing? Used to keep track of state for metrics logging. | 140 // currently editing? Used to keep track of state for metrics logging. |
| 127 bool has_shown_autofill_popup_for_current_edit_; | 141 bool has_shown_autofill_popup_for_current_edit_; |
| 128 | 142 |
| 129 // The menu index of the "Clear" menu item. | 143 // The menu index of the "Clear" menu item. |
| 130 int suggestions_clear_index_; | 144 int suggestions_clear_index_; |
| 131 | 145 |
| 132 // The menu index of the "Autofill options..." menu item. | 146 // The menu index of the "Autofill options..." menu item. |
| 133 int suggestions_options_index_; | 147 int suggestions_options_index_; |
| 134 | 148 |
| 135 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 149 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
| 136 }; | 150 }; |
| 137 | 151 |
| 138 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 152 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| OLD | NEW |