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 #include "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/autofill/autofill_external_delegate.h" | 6 #include "chrome/browser/autofill/autofill_external_delegate.h" |
7 #include "chrome/browser/autofill/autofill_manager.h" | 7 #include "chrome/browser/autofill/autofill_manager.h" |
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
9 #include "chrome/common/autofill_messages.h" | 9 #include "chrome/common/autofill_messages.h" |
10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 tab_contents_wrapper_->autofill_manager()->OnDidShowAutofillSuggestions( | 132 tab_contents_wrapper_->autofill_manager()->OnDidShowAutofillSuggestions( |
133 has_autofill_item && !has_shown_autofill_popup_for_current_edit_); | 133 has_autofill_item && !has_shown_autofill_popup_for_current_edit_); |
134 has_shown_autofill_popup_for_current_edit_ |= has_autofill_item; | 134 has_shown_autofill_popup_for_current_edit_ |= has_autofill_item; |
135 } | 135 } |
136 | 136 |
137 void AutofillExternalDelegate::DidEndTextFieldEditing() { | 137 void AutofillExternalDelegate::DidEndTextFieldEditing() { |
138 has_shown_autofill_popup_for_current_edit_ = false; | 138 has_shown_autofill_popup_for_current_edit_ = false; |
139 } | 139 } |
140 | 140 |
141 void AutofillExternalDelegate::DidAcceptAutofillSuggestions(string16 value, | 141 void AutofillExternalDelegate::DidAcceptAutofillSuggestions( |
142 int unique_id, | 142 const string16& value, int unique_id, unsigned index) { |
143 unsigned index) { | |
144 // If the selected element is a warning we don't want to do anything. | 143 // If the selected element is a warning we don't want to do anything. |
145 if (unique_id < 0) | 144 if (unique_id < 0) |
146 return; | 145 return; |
147 | 146 |
148 // TODO(csharp): Add the password autofill manager. | 147 // TODO(csharp): Add the password autofill manager. |
149 // if (password_autofill_manager_->DidAcceptAutofillSuggestion(node, value)) | 148 // if (password_autofill_manager_->DidAcceptAutofillSuggestion(node, value)) |
150 // return; | 149 // return; |
151 | 150 |
152 if (suggestions_options_index_ != -1 && | 151 if (suggestions_options_index_ != -1 && |
153 index == static_cast<unsigned>(suggestions_options_index_)) { | 152 index == static_cast<unsigned>(suggestions_options_index_)) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // none, so all platforms use the default. | 210 // none, so all platforms use the default. |
212 | 211 |
213 #if !defined(OS_ANDROID) && !defined(TOOLKIT_GTK) | 212 #if !defined(OS_ANDROID) && !defined(TOOLKIT_GTK) |
214 | 213 |
215 AutofillExternalDelegate* AutofillExternalDelegate::Create( | 214 AutofillExternalDelegate* AutofillExternalDelegate::Create( |
216 TabContentsWrapper*, AutofillManager*) { | 215 TabContentsWrapper*, AutofillManager*) { |
217 return NULL; | 216 return NULL; |
218 } | 217 } |
219 | 218 |
220 #endif | 219 #endif |
OLD | NEW |