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 #include "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "chrome/browser/autocomplete_history_manager.h" | |
| 6 #include "chrome/browser/autofill/autofill_external_delegate.h" | 7 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| 7 #include "chrome/browser/autofill/autofill_manager.h" | 8 #include "chrome/browser/autofill/autofill_manager.h" |
| 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 9 #include "chrome/common/autofill_messages.h" | 10 #include "chrome/common/autofill_messages.h" |
| 10 #include "chrome/common/chrome_constants.h" | 11 #include "chrome/common/chrome_constants.h" |
| 11 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
| 12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 13 #include "grit/chromium_strings.h" | 14 #include "grit/chromium_strings.h" |
| 14 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 return; | 164 return; |
| 164 } | 165 } |
| 165 | 166 |
| 166 SetBounds(bounds); | 167 SetBounds(bounds); |
| 167 | 168 |
| 168 std::vector<string16> empty(suggestions.size()); | 169 std::vector<string16> empty(suggestions.size()); |
| 169 std::vector<int> password_ids(suggestions.size(), kPasswordEntryId); | 170 std::vector<int> password_ids(suggestions.size(), kPasswordEntryId); |
| 170 ApplyAutofillSuggestions(suggestions, empty, empty, password_ids, -1); | 171 ApplyAutofillSuggestions(suggestions, empty, empty, password_ids, -1); |
| 171 } | 172 } |
| 172 | 173 |
| 174 void AutofillExternalDelegate::RemoveAutocompleteEntry(const string16& value) { | |
| 175 if (tab_contents_wrapper_) { | |
|
Ilya Sherman
2012/04/17 08:31:20
nit: Is it actually possible for this to be NULL?
csharp
2012/04/18 15:35:58
In some tests right now, but I don't think it coul
Ilya Sherman
2012/04/18 18:12:51
Ok. I think it would be better to use mocked obje
| |
| 176 tab_contents_wrapper_->autocomplete_history_manager()-> | |
| 177 OnRemoveAutocompleteEntry(autofill_query_field_.name, value); | |
| 178 } | |
| 179 | |
| 180 // Adjust the positions of the non-Autocomplete menu items. | |
| 181 if (suggestions_clear_index_ != -1) | |
| 182 --suggestions_clear_index_; | |
| 183 | |
| 184 if (suggestions_options_index_ != -1) | |
| 185 --suggestions_options_index_; | |
| 186 } | |
| 187 | |
| 173 void AutofillExternalDelegate::DidEndTextFieldEditing() { | 188 void AutofillExternalDelegate::DidEndTextFieldEditing() { |
| 174 has_shown_autofill_popup_for_current_edit_ = false; | 189 has_shown_autofill_popup_for_current_edit_ = false; |
| 175 } | 190 } |
| 176 | 191 |
| 177 bool AutofillExternalDelegate::DidAcceptAutofillSuggestions( | 192 bool AutofillExternalDelegate::DidAcceptAutofillSuggestions( |
| 178 const string16& value, | 193 const string16& value, |
| 179 int unique_id, | 194 int unique_id, |
| 180 unsigned index) { | 195 unsigned index) { |
| 181 // If the selected element is a warning we don't want to do anything. | 196 // If the selected element is a warning we don't want to do anything. |
| 182 if (unique_id == kWarningId) | 197 if (unique_id == kWarningId) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 // none, so all platforms use the default. | 281 // none, so all platforms use the default. |
| 267 | 282 |
| 268 #if !defined(OS_ANDROID) && !defined(TOOLKIT_GTK) | 283 #if !defined(OS_ANDROID) && !defined(TOOLKIT_GTK) |
| 269 | 284 |
| 270 AutofillExternalDelegate* AutofillExternalDelegate::Create( | 285 AutofillExternalDelegate* AutofillExternalDelegate::Create( |
| 271 TabContentsWrapper*, AutofillManager*) { | 286 TabContentsWrapper*, AutofillManager*) { |
| 272 return NULL; | 287 return NULL; |
| 273 } | 288 } |
| 274 | 289 |
| 275 #endif | 290 #endif |
| OLD | NEW |