Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3402)

Unified Diff: chrome/browser/autofill/autofill_manager.cc

Issue 11821020: Chrome-side implementation of AutocompleteErrorEvent#reason. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/autofill_manager.cc
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 4bba52b11c8e1af5f42633f5bb9ab7d10c2b1047..c373ec78c6f307ab92e8a34d9e3e694ce627b30f 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -60,7 +60,6 @@
#include "grit/generated_resources.h"
#include "ipc/ipc_message_macros.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/rect.h"
@@ -68,6 +67,7 @@ typedef PersonalDataManager::GUIDPair GUIDPair;
using base::TimeTicks;
using content::BrowserThread;
using content::RenderViewHost;
+using WebKit::WebFormElement;
namespace {
@@ -781,7 +781,8 @@ void AutofillManager::OnRequestAutocomplete(
const GURL& frame_url,
const content::SSLStatus& ssl_status) {
if (!IsAutofillEnabled()) {
- ReturnAutocompleteError();
+ ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorDisabled,
+ FormData());
return;
}
@@ -796,12 +797,15 @@ void AutofillManager::OnRequestAutocomplete(
controller->Show();
}
-void AutofillManager::ReturnAutocompleteError() {
+void AutofillManager::ReturnAutocompleteResult(
+ WebFormElement::AutocompleteResult result, const FormData& form_data) {
RenderViewHost* host = web_contents()->GetRenderViewHost();
if (!host)
return;
- host->Send(new AutofillMsg_RequestAutocompleteError(host->GetRoutingID()));
+ host->Send(new AutofillMsg_RequestAutocompleteResult(host->GetRoutingID(),
+ result,
+ form_data));
}
void AutofillManager::ReturnAutocompleteData(const FormStructure* result) {
@@ -810,17 +814,13 @@ void AutofillManager::ReturnAutocompleteData(const FormStructure* result) {
if (!web_contents())
return;
- RenderViewHost* host = web_contents()->GetRenderViewHost();
- if (!host)
- return;
-
if (!result) {
- ReturnAutocompleteError();
- return;
+ ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorCancel,
+ FormData());
+ } else {
+ ReturnAutocompleteResult(WebFormElement::AutocompleteResultSuccess,
+ result->ToFormData());
}
-
- host->Send(new AutofillMsg_RequestAutocompleteSuccess(host->GetRoutingID(),
- result->ToFormData()));
}
void AutofillManager::OnLoadedServerPredictions(

Powered by Google App Engine
This is Rietveld 408576698