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 "components/autofill/browser/autocomplete_history_manager.h" | 6 #include "components/autofill/browser/autocomplete_history_manager.h" |
7 #include "components/autofill/browser/autofill_external_delegate.h" | 7 #include "components/autofill/browser/autofill_external_delegate.h" |
8 #include "components/autofill/browser/autofill_manager.h" | 8 #include "components/autofill/browser/autofill_manager.h" |
9 #include "components/autofill/common/autofill_messages.h" | 9 #include "components/autofill/common/autofill_messages.h" |
10 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, | 199 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, |
200 int identifier) { | 200 int identifier) { |
201 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 201 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
202 | 202 |
203 if (identifier == WebAutofillClient::MenuItemIDAutofillOptions) { | 203 if (identifier == WebAutofillClient::MenuItemIDAutofillOptions) { |
204 // User selected 'Autofill Options'. | 204 // User selected 'Autofill Options'. |
205 autofill_manager_->OnShowAutofillDialog(); | 205 autofill_manager_->OnShowAutofillDialog(); |
206 } else if (identifier == WebAutofillClient::MenuItemIDClearForm) { | 206 } else if (identifier == WebAutofillClient::MenuItemIDClearForm) { |
207 // User selected 'Clear form'. | 207 // User selected 'Clear form'. |
208 host->Send(new AutofillMsg_ClearForm(host->GetRoutingID())); | 208 host->Send(new AutofillMsg_ClearForm(host->GetRoutingID())); |
209 } else if (identifier == WebAutofillClient::MenuItemIDPasswordEntry && | 209 } else if (identifier == WebAutofillClient::MenuItemIDPasswordEntry) { |
210 password_autofill_manager_.DidAcceptAutofillSuggestion( | 210 bool success = password_autofill_manager_.DidAcceptAutofillSuggestion( |
211 autofill_query_field_, value)) { | 211 autofill_query_field_, value); |
212 // DidAcceptAutofillSuggestion has already handled the work to fill in | 212 DCHECK(success); |
213 // the page as required. | |
214 } else if (identifier == WebAutofillClient::MenuItemIDDataListEntry) { | 213 } else if (identifier == WebAutofillClient::MenuItemIDDataListEntry) { |
215 host->Send(new AutofillMsg_AcceptDataListSuggestion(host->GetRoutingID(), | 214 host->Send(new AutofillMsg_AcceptDataListSuggestion(host->GetRoutingID(), |
216 value)); | 215 value)); |
217 } else if (identifier == WebAutofillClient::MenuItemIDAutocompleteEntry) { | 216 } else if (identifier == WebAutofillClient::MenuItemIDAutocompleteEntry) { |
218 // User selected an Autocomplete, so we fill directly. | 217 // User selected an Autocomplete, so we fill directly. |
219 host->Send(new AutofillMsg_SetNodeText(host->GetRoutingID(), value)); | 218 host->Send(new AutofillMsg_SetNodeText(host->GetRoutingID(), value)); |
220 } else { | 219 } else { |
221 FillAutofillFormData(identifier, false); | 220 FillAutofillFormData(identifier, false); |
222 } | 221 } |
223 | 222 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if (!*content::Details<bool>(details).ptr()) | 383 if (!*content::Details<bool>(details).ptr()) |
385 autofill_manager_->delegate()->HideAutofillPopup(); | 384 autofill_manager_->delegate()->HideAutofillPopup(); |
386 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { | 385 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { |
387 autofill_manager_->delegate()->HideAutofillPopup(); | 386 autofill_manager_->delegate()->HideAutofillPopup(); |
388 } else { | 387 } else { |
389 NOTREACHED(); | 388 NOTREACHED(); |
390 } | 389 } |
391 } | 390 } |
392 | 391 |
393 } // namespace autofill | 392 } // namespace autofill |
OLD | NEW |