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

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: rebase 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
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_manager.cc
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index fe54ada9377fc868e808d0aab577a128702bce05..9f5d6f18030a23c5d45d0bbb9cf5a61ba5e1f0e9 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 {
@@ -799,7 +799,8 @@ void AutofillManager::OnRequestAutocomplete(
const GURL& frame_url,
const content::SSLStatus& ssl_status) {
if (!IsAutofillEnabled()) {
- ReturnAutocompleteError();
+ ReturnAutocompleteResult(WebFormElement::AutocompleteResultErrorDisabled,
+ FormData());
return;
}
@@ -814,12 +815,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) {
@@ -828,17 +832,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(
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698