summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd10
-rw-r--r--chrome/browser/about_flags.cc7
-rw-r--r--chrome/browser/autofill/autofill_manager.cc22
-rw-r--r--chrome/browser/autofill/form_structure.cc44
-rw-r--r--chrome/browser/autofill/form_structure.h13
-rw-r--r--chrome/common/autofill_messages.h21
-rw-r--r--chrome/common/chrome_switches.cc3
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/renderer/autofill/autofill_agent.cc11
-rw-r--r--chrome/renderer/autofill/autofill_agent.h8
-rw-r--r--chrome/renderer/autofill/form_manager.cc51
-rw-r--r--chrome/renderer/autofill/form_manager.h7
-rw-r--r--ui/base/l10n/l10n_util.cc15
-rw-r--r--ui/base/l10n/l10n_util.h8
-rw-r--r--webkit/glue/form_data.cc4
-rw-r--r--webkit/glue/form_data.h4
-rw-r--r--webkit/glue/form_data_predictions.cc22
-rw-r--r--webkit/glue/form_data_predictions.h34
-rw-r--r--webkit/glue/form_field.cc2
-rw-r--r--webkit/glue/form_field.h2
-rw-r--r--webkit/glue/form_field_predictions.cc23
-rw-r--r--webkit/glue/form_field_predictions.h30
-rw-r--r--webkit/glue/webkit_glue.gypi4
23 files changed, 335 insertions, 11 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 92a9c57..22df51d 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -4317,6 +4317,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_PRELOAD_INSTANT_SEARCH_DESCRIPTION" desc="Description for the flag to preload Instant search">
Preload the default search engine for Instant.
</message>
+ <message name="IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_NAME" desc="Title for the flag to show Autofill field type predictions for all forms">
+ Show Autofill predictions
+ </message>
+ <message name="IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_DESCRIPTION" desc="Description for the flag to show Autofill field type predictions for all forms">
+ Annotates web forms with Autofill field type predictions as placeholder text.
+ </message>
<!-- Crashes -->
<message name="IDS_CRASHES_TITLE" desc="Title for the chrome://crashes page.">
@@ -7586,6 +7592,10 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_AUTOFILL_HELP_LABEL" desc="The label of the Help link on the Autofill dialog.">
About Autofill
</message>
+
+ <message name="IDS_AUTOFILL_SHOW_PREDICTIONS_TITLE" desc="The title for form elements when annotated with Autofill predictions.">
+ heuristic type: <ph name="HEURISTIC_TYPE">$1<ex>NAME_FIRST</ex></ph>\nserver type: <ph name="SERVER_TYPE">$2<ex>NAME_FIRST</ex></ph>\nfield signature: <ph name="FIELD_SIGNATURE">$3<ex>12345678</ex></ph>\nform signature: <ph name="FORM_SIGNATURE">$4<ex>1234567812345678</ex></ph>\nexperiment id: "<ph name="EXPERIMENT_ID">$5<ex>ar1</ex></ph>"
+ </message>
<if expr="not pp_ifdef('use_titlecase')">
<message name="IDS_THEMES_GROUP_NAME" desc="In sentence case: The title of the themes group">
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index c6ceafc..d1b6b0e 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -336,6 +336,13 @@ const Experiment kExperiments[] = {
SINGLE_VALUE_TYPE("")
#endif
},
+ {
+ "show-autofill-type-predictions",
+ IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_NAME,
+ IDS_FLAGS_SHOW_AUTOFILL_TYPE_PREDICTIONS_DESCRIPTION,
+ kOsAll,
+ SINGLE_VALUE_TYPE(switches::kShowAutofillTypePredictions)
+ },
};
const Experiment* experiments = kExperiments;
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index e450918..edef7e4 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -11,6 +11,7 @@
#include <set>
#include <utility>
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/string16.h"
#include "base/string_util.h"
@@ -33,6 +34,7 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/autofill_messages.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/guid.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -45,9 +47,11 @@
#include "ipc/ipc_message_macros.h"
#include "ui/base/l10n/l10n_util.h"
#include "webkit/glue/form_data.h"
+#include "webkit/glue/form_data_predictions.h"
#include "webkit/glue/form_field.h"
using webkit_glue::FormData;
+using webkit_glue::FormDataPredictions;
using webkit_glue::FormField;
namespace {
@@ -627,9 +631,24 @@ void AutofillManager::OnDidShowAutofillSuggestions() {
void AutofillManager::OnLoadedServerPredictions(
const std::string& response_xml) {
+ // Parse and store the server predictions.
FormStructure::ParseQueryResponse(response_xml,
form_structures_.get(),
*metric_logger_);
+
+ // If the corresponding flag is set, annotate forms with the predicted types.
+ RenderViewHost* host = NULL;
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kShowAutofillTypePredictions) ||
+ !GetHost(personal_data_->profiles(), personal_data_->credit_cards(),
+ &host)) {
+ return;
+ }
+
+ std::vector<FormDataPredictions> forms;
+ FormStructure::GetFieldTypePredictions(form_structures_.get(), &forms);
+ host->Send(new AutofillMsg_FieldTypePredictionsAvailable(host->routing_id(),
+ forms));
}
void AutofillManager::OnUploadedPossibleFieldTypes() {
@@ -716,8 +735,7 @@ AutofillManager::AutofillManager(TabContentsWrapper* tab_contents,
DCHECK(tab_contents);
}
-void AutofillManager::set_metric_logger(
- const AutofillMetrics* metric_logger) {
+void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) {
metric_logger_.reset(metric_logger);
}
diff --git a/chrome/browser/autofill/form_structure.cc b/chrome/browser/autofill/form_structure.cc
index 8a804a5..e981394 100644
--- a/chrome/browser/autofill/form_structure.cc
+++ b/chrome/browser/autofill/form_structure.cc
@@ -9,15 +9,22 @@
#include "base/sha1.h"
#include "base/stringprintf.h"
#include "base/string_number_conversions.h"
+#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_metrics.h"
+#include "chrome/browser/autofill/autofill_type.h"
#include "chrome/browser/autofill/autofill_xml_parser.h"
#include "chrome/browser/autofill/field_types.h"
#include "chrome/browser/autofill/form_field.h"
#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
+#include "webkit/glue/form_data.h"
+#include "webkit/glue/form_data_predictions.h"
#include "webkit/glue/form_field.h"
+#include "webkit/glue/form_field_predictions.h"
using webkit_glue::FormData;
+using webkit_glue::FormDataPredictions;
+using webkit_glue::FormFieldPredictions;
namespace {
@@ -302,6 +309,43 @@ void FormStructure::ParseQueryResponse(const std::string& response_xml,
metric_logger.LogServerQueryMetric(metric);
}
+// static
+void FormStructure::GetFieldTypePredictions(
+ const std::vector<FormStructure*>& form_structures,
+ std::vector<FormDataPredictions>* forms) {
+ forms->clear();
+ forms->reserve(form_structures.size());
+ for (size_t i = 0; i < form_structures.size(); ++i) {
+ FormStructure* form_structure = form_structures[i];
+ FormDataPredictions form;
+ form.data.name = form_structure->form_name_;
+ form.data.method =
+ ASCIIToUTF16((form_structure->method_ == POST) ? "POST" : "GET");
+ form.data.origin = form_structure->source_url_;
+ form.data.action = form_structure->target_url_;
+ form.signature = form_structure->FormSignature();
+ form.experiment_id = form_structure->server_experiment_id_;
+
+ for (std::vector<AutofillField*>::const_iterator field =
+ form_structure->fields_.begin();
+ field != form_structure->fields_.end(); ++field) {
+ form.data.fields.push_back(webkit_glue::FormField(**field));
+
+ FormFieldPredictions annotated_field;
+ annotated_field.signature = (*field)->FieldSignature();
+ annotated_field.heuristic_type =
+ AutofillType::FieldTypeToString((*field)->heuristic_type());
+ annotated_field.server_type =
+ AutofillType::FieldTypeToString((*field)->server_type());
+ annotated_field.overall_type =
+ AutofillType::FieldTypeToString((*field)->type());
+ form.fields.push_back(annotated_field);
+ }
+
+ forms->push_back(form);
+ }
+}
+
std::string FormStructure::FormSignature() const {
std::string scheme(target_url_.scheme());
std::string host(target_url_.host());
diff --git a/chrome/browser/autofill/form_structure.h b/chrome/browser/autofill/form_structure.h
index 0d8ddd7..d94be92 100644
--- a/chrome/browser/autofill/form_structure.h
+++ b/chrome/browser/autofill/form_structure.h
@@ -15,7 +15,7 @@
#include "chrome/browser/autofill/autofill_type.h"
#include "chrome/browser/autofill/field_types.h"
#include "googleurl/src/gurl.h"
-#include "webkit/glue/form_data.h"
+
enum RequestMethod {
GET,
@@ -34,6 +34,11 @@ namespace buzz {
class XmlElement;
}
+namespace webkit_glue {
+struct FormData;
+struct FormDataPredictions;
+}
+
// FormStructure stores a single HTML form together with the values entered
// in the fields along with additional information needed by Autofill.
class FormStructure {
@@ -65,6 +70,12 @@ class FormStructure {
const std::vector<FormStructure*>& forms,
const AutofillMetrics& metric_logger);
+ // Fills |forms| with the details from the given |form_structures| and their
+ // fields' predicted types.
+ static void GetFieldTypePredictions(
+ const std::vector<FormStructure*>& form_structures,
+ std::vector<webkit_glue::FormDataPredictions>* forms);
+
// The unique signature for this form, composed of the target url domain,
// the form name, and the form field names in a 64-bit hash.
std::string FormSignature() const;
diff --git a/chrome/common/autofill_messages.h b/chrome/common/autofill_messages.h
index 250ae17..eb3fc88 100644
--- a/chrome/common/autofill_messages.h
+++ b/chrome/common/autofill_messages.h
@@ -9,7 +9,9 @@
#include "content/common/webkit_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "webkit/glue/form_data.h"
+#include "webkit/glue/form_data_predictions.h"
#include "webkit/glue/form_field.h"
+#include "webkit/glue/form_field_predictions.h"
#include "webkit/glue/password_form.h"
#include "webkit/glue/password_form_dom_manager.h"
@@ -25,6 +27,14 @@ IPC_STRUCT_TRAITS_BEGIN(webkit_glue::FormField)
IPC_STRUCT_TRAITS_MEMBER(option_strings)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(webkit_glue::FormFieldPredictions)
+ IPC_STRUCT_TRAITS_MEMBER(field)
+ IPC_STRUCT_TRAITS_MEMBER(signature)
+ IPC_STRUCT_TRAITS_MEMBER(heuristic_type)
+ IPC_STRUCT_TRAITS_MEMBER(server_type)
+ IPC_STRUCT_TRAITS_MEMBER(overall_type)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(webkit_glue::FormData)
IPC_STRUCT_TRAITS_MEMBER(name)
IPC_STRUCT_TRAITS_MEMBER(method)
@@ -34,6 +44,13 @@ IPC_STRUCT_TRAITS_BEGIN(webkit_glue::FormData)
IPC_STRUCT_TRAITS_MEMBER(fields)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(webkit_glue::FormDataPredictions)
+ IPC_STRUCT_TRAITS_MEMBER(data)
+ IPC_STRUCT_TRAITS_MEMBER(signature)
+ IPC_STRUCT_TRAITS_MEMBER(experiment_id)
+ IPC_STRUCT_TRAITS_MEMBER(fields)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(webkit_glue::PasswordFormFillData)
IPC_STRUCT_TRAITS_MEMBER(basic_data)
IPC_STRUCT_TRAITS_MEMBER(additional_logins)
@@ -62,6 +79,10 @@ IPC_MESSAGE_ROUTED2(AutofillMsg_FormDataFilled,
IPC_MESSAGE_ROUTED1(AutofillMsg_FillPasswordForm,
webkit_glue::PasswordFormFillData)
+// Send the heuristic and server field type predictions to the renderer.
+IPC_MESSAGE_ROUTED1(
+ AutofillMsg_FieldTypePredictionsAvailable,
+ std::vector<webkit_glue::FormDataPredictions> /* forms */)
// Autofill messages sent from the renderer to the browser.
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 8c709fb..fb3f1e4 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -891,6 +891,9 @@ const char kSearchInOmniboxHint[] = "search-in-omnibox-hint";
// The LSID of the account to use for the service process.
const char kServiceAccountLsid[] = "service-account-lsid";
+// Annotate forms with Autofill field type predictions.
+const char kShowAutofillTypePredictions[] = "show-autofill-type-predictions";
+
// See kHideIcons.
const char kShowIcons[] = "show-icons";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index f16db7e..7871120 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -242,6 +242,7 @@ extern const char kSbDisableDownloadProtection[];
extern const char kSdchFilter[];
extern const char kSearchInOmniboxHint[];
extern const char kServiceAccountLsid[];
+extern const char kShowAutofillTypePredictions[];
extern const char kShowCompositedLayerBorders[];
extern const char kShowCompositedLayerTree[];
extern const char kShowFPSCounter[];
diff --git a/chrome/renderer/autofill/autofill_agent.cc b/chrome/renderer/autofill/autofill_agent.cc
index 5418dca..ab4c061 100644
--- a/chrome/renderer/autofill/autofill_agent.cc
+++ b/chrome/renderer/autofill/autofill_agent.cc
@@ -20,6 +20,7 @@
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/base/l10n/l10n_util.h"
#include "webkit/glue/form_data.h"
+#include "webkit/glue/form_data_predictions.h"
#include "webkit/glue/form_field.h"
#include "webkit/glue/password_form.h"
@@ -31,6 +32,7 @@ using WebKit::WebKeyboardEvent;
using WebKit::WebNode;
using WebKit::WebString;
using webkit_glue::FormData;
+using webkit_glue::FormDataPredictions;
namespace {
@@ -64,6 +66,8 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(AutofillAgent, message)
IPC_MESSAGE_HANDLER(AutofillMsg_SuggestionsReturned, OnSuggestionsReturned)
IPC_MESSAGE_HANDLER(AutofillMsg_FormDataFilled, OnFormDataFilled)
+ IPC_MESSAGE_HANDLER(AutofillMsg_FieldTypePredictionsAvailable,
+ OnFieldTypePredictionsAvailable)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -305,6 +309,13 @@ void AutofillAgent::OnFormDataFilled(int query_id,
Send(new AutofillHostMsg_DidFillAutofillFormData(routing_id()));
}
+void AutofillAgent::OnFieldTypePredictionsAvailable(
+ const std::vector<FormDataPredictions>& forms) {
+ for (size_t i = 0; i < forms.size(); ++i) {
+ form_manager_.ShowPredictions(forms[i]);
+ }
+}
+
void AutofillAgent::ShowSuggestions(const WebInputElement& element,
bool autofill_on_empty_values,
bool requires_caret_at_end,
diff --git a/chrome/renderer/autofill/autofill_agent.h b/chrome/renderer/autofill/autofill_agent.h
index 6996d31..921744d 100644
--- a/chrome/renderer/autofill/autofill_agent.h
+++ b/chrome/renderer/autofill/autofill_agent.h
@@ -16,6 +16,12 @@
#include "content/renderer/render_view_observer.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebAutoFillClient.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
+#include "webkit/glue/form_data.h"
+#include "webkit/glue/form_field.h"
+
+namespace webkit_glue {
+struct FormDataPredictions;
+}
namespace autofill {
@@ -87,6 +93,8 @@ class AutofillAgent : public RenderViewObserver,
const std::vector<string16>& icons,
const std::vector<int>& unique_ids);
void OnFormDataFilled(int query_id, const webkit_glue::FormData& form);
+ void OnFieldTypePredictionsAvailable(
+ const std::vector<webkit_glue::FormDataPredictions>& forms);
// Called in a posted task by textFieldDidChange() to work-around a WebKit bug
// http://bugs.webkit.org/show_bug.cgi?id=16976
diff --git a/chrome/renderer/autofill/form_manager.cc b/chrome/renderer/autofill/form_manager.cc
index c94bfa0..0adfbae 100644
--- a/chrome/renderer/autofill/form_manager.cc
+++ b/chrome/renderer/autofill/form_manager.cc
@@ -9,6 +9,7 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "grit/generated_resources.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h"
@@ -21,12 +22,13 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSelectElement.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h"
+#include "ui/base/l10n/l10n_util.h"
#include "webkit/glue/form_data.h"
+#include "webkit/glue/form_data_predictions.h"
#include "webkit/glue/form_field.h"
+#include "webkit/glue/form_field_predictions.h"
#include "webkit/glue/web_io_operators.h"
-using webkit_glue::FormData;
-using webkit_glue::FormField;
using WebKit::WebDocument;
using WebKit::WebElement;
using WebKit::WebFormControlElement;
@@ -40,6 +42,10 @@ using WebKit::WebOptionElement;
using WebKit::WebSelectElement;
using WebKit::WebString;
using WebKit::WebVector;
+using webkit_glue::FormData;
+using webkit_glue::FormDataPredictions;
+using webkit_glue::FormField;
+using webkit_glue::FormFieldPredictions;
namespace {
@@ -796,6 +802,47 @@ void FormManager::PreviewForm(const FormData& form, const WebNode& node) {
&PreviewFormField);
}
+bool FormManager::ShowPredictions(const FormDataPredictions& form) {
+ FormElement* form_element = NULL;
+ if (!FindCachedFormElement(form.data, &form_element))
+ return false;
+
+ DCHECK_EQ(form.data.fields.size(), form.fields.size());
+ for (size_t i = 0, j = 0;
+ i < form_element->control_elements.size() && j < form.fields.size();
+ ++i) {
+ WebFormControlElement* element = &form_element->control_elements[i];
+ string16 element_name(element->nameForAutofill());
+
+ // Search forward in the |form| for a corresponding field.
+ size_t k = j;
+ while (k < form.fields.size() && element_name != form.data.fields[k].name)
+ k++;
+
+ if (k >= form.fields.size())
+ continue;
+
+ DCHECK_EQ(form.data.fields[k].name, element_name);
+
+ std::string placeholder = form.fields[k].overall_type;
+ string16 title = l10n_util::GetStringFUTF16(
+ IDS_AUTOFILL_SHOW_PREDICTIONS_TITLE,
+ UTF8ToUTF16(form.fields[k].heuristic_type),
+ UTF8ToUTF16(form.fields[k].server_type),
+ UTF8ToUTF16(form.fields[k].signature),
+ UTF8ToUTF16(form.signature),
+ UTF8ToUTF16(form.experiment_id));
+ if (!element->hasAttribute("placeholder"))
+ element->setAttribute("placeholder", WebString(UTF8ToUTF16(placeholder)));
+ element->setAttribute("title", WebString(title));
+
+ // We found a matching form field so move on to the next.
+ ++j;
+ }
+
+ return true;
+}
+
bool FormManager::ClearFormWithNode(const WebNode& node) {
FormElement* form_element = NULL;
if (!FindCachedFormElementWithNode(node, &form_element))
diff --git a/chrome/renderer/autofill/form_manager.h b/chrome/renderer/autofill/form_manager.h
index 8ef30ac..b32dcb5 100644
--- a/chrome/renderer/autofill/form_manager.h
+++ b/chrome/renderer/autofill/form_manager.h
@@ -16,6 +16,7 @@
namespace webkit_glue {
struct FormData;
+struct FormDataPredictions;
struct FormField;
} // namespace webkit_glue
@@ -98,6 +99,12 @@ class FormManager {
void PreviewForm(const webkit_glue::FormData& form,
const WebKit::WebNode &node);
+ // For each field in the |form|, sets the field's placeholder text to the
+ // field's overall predicted type. Also sets the title to include the field's
+ // heuristic type, server type, and signature; as well as the form's signature
+ // and the experiment id for the server predictions.
+ bool ShowPredictions(const webkit_glue::FormDataPredictions& form);
+
// Clears the values of all input elements in the form that contains |node|.
// Returns false if the form is not found.
bool ClearFormWithNode(const WebKit::WebNode& node);
diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc
index 8011768..9230a66 100644
--- a/ui/base/l10n/l10n_util.cc
+++ b/ui/base/l10n/l10n_util.cc
@@ -697,6 +697,21 @@ string16 GetStringFUTF16(int message_id,
return GetStringF(message_id, replacements, NULL);
}
+string16 GetStringFUTF16(int message_id,
+ const string16& a,
+ const string16& b,
+ const string16& c,
+ const string16& d,
+ const string16& e) {
+ std::vector<string16> replacements;
+ replacements.push_back(a);
+ replacements.push_back(b);
+ replacements.push_back(c);
+ replacements.push_back(d);
+ replacements.push_back(e);
+ return GetStringF(message_id, replacements, NULL);
+}
+
string16 GetStringFUTF16(int message_id, const string16& a, size_t* offset) {
DCHECK(offset);
std::vector<size_t> offsets;
diff --git a/ui/base/l10n/l10n_util.h b/ui/base/l10n/l10n_util.h
index 1478ae2..7a2c458 100644
--- a/ui/base/l10n/l10n_util.h
+++ b/ui/base/l10n/l10n_util.h
@@ -93,8 +93,14 @@ string16 GetStringFUTF16(int message_id,
const string16& b,
const string16& c,
const string16& d);
+string16 GetStringFUTF16(int message_id,
+ const string16& a,
+ const string16& b,
+ const string16& c,
+ const string16& d,
+ const string16& e);
std::string GetStringFUTF8(int message_id,
- const string16& a);
+ const string16& a);
std::string GetStringFUTF8(int message_id,
const string16& a,
const string16& b);
diff --git a/webkit/glue/form_data.cc b/webkit/glue/form_data.cc
index 4e1a6ea..07b0613 100644
--- a/webkit/glue/form_data.cc
+++ b/webkit/glue/form_data.cc
@@ -1,9 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "webkit/glue/form_data.h"
+#include "base/string_util.h"
+
namespace webkit_glue {
FormData::FormData()
diff --git a/webkit/glue/form_data.h b/webkit/glue/form_data.h
index f0011c7..288e734 100644
--- a/webkit/glue/form_data.h
+++ b/webkit/glue/form_data.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,7 +7,7 @@
#include <vector>
-#include "base/string_util.h"
+#include "base/string16.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/form_field.h"
diff --git a/webkit/glue/form_data_predictions.cc b/webkit/glue/form_data_predictions.cc
new file mode 100644
index 0000000..e3ddf70
--- /dev/null
+++ b/webkit/glue/form_data_predictions.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/glue/form_data_predictions.h"
+
+namespace webkit_glue {
+
+FormDataPredictions::FormDataPredictions() {
+}
+
+FormDataPredictions::FormDataPredictions(const FormDataPredictions& other)
+ : data(other.data),
+ signature(other.signature),
+ experiment_id(other.experiment_id),
+ fields(other.fields) {
+}
+
+FormDataPredictions::~FormDataPredictions() {
+}
+
+} // namespace webkit_glue
diff --git a/webkit/glue/form_data_predictions.h b/webkit/glue/form_data_predictions.h
new file mode 100644
index 0000000..7661ff9
--- /dev/null
+++ b/webkit/glue/form_data_predictions.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_FORM_DATA_PREDICTIONS_H__
+#define WEBKIT_GLUE_FORM_DATA_PREDICTIONS_H__
+
+#include <string>
+#include <vector>
+
+#include "webkit/glue/form_data.h"
+#include "webkit/glue/form_field_predictions.h"
+
+namespace webkit_glue {
+
+// Holds information about a form to be filled and/or submitted.
+struct FormDataPredictions {
+ // Data for this form.
+ FormData data;
+ // The form signature for communication with the crowdsourcing server.
+ std::string signature;
+ // The experiment id for the server predictions.
+ std::string experiment_id;
+ // The form fields and their predicted field types.
+ std::vector<FormFieldPredictions> fields;
+
+ FormDataPredictions();
+ FormDataPredictions(const FormDataPredictions& other);
+ ~FormDataPredictions();
+};
+
+} // namespace webkit_glue
+
+#endif // WEBKIT_GLUE_FORM_DATA_PREDICTIONS_H__
diff --git a/webkit/glue/form_field.cc b/webkit/glue/form_field.cc
index 0de8446..1f62044 100644
--- a/webkit/glue/form_field.cc
+++ b/webkit/glue/form_field.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/webkit/glue/form_field.h b/webkit/glue/form_field.h
index c246091..c0f25f9 100644
--- a/webkit/glue/form_field.h
+++ b/webkit/glue/form_field.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/webkit/glue/form_field_predictions.cc b/webkit/glue/form_field_predictions.cc
new file mode 100644
index 0000000..11383bd
--- /dev/null
+++ b/webkit/glue/form_field_predictions.cc
@@ -0,0 +1,23 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/glue/form_field_predictions.h"
+
+namespace webkit_glue {
+
+FormFieldPredictions::FormFieldPredictions() {
+}
+
+FormFieldPredictions::FormFieldPredictions(const FormFieldPredictions& other)
+ : field(other.field),
+ signature(other.signature),
+ heuristic_type(other.heuristic_type),
+ server_type(other.server_type),
+ overall_type(other.overall_type) {
+}
+
+FormFieldPredictions::~FormFieldPredictions() {
+}
+
+} // namespace webkit_glue
diff --git a/webkit/glue/form_field_predictions.h b/webkit/glue/form_field_predictions.h
new file mode 100644
index 0000000..baa8b3f
--- /dev/null
+++ b/webkit/glue/form_field_predictions.h
@@ -0,0 +1,30 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_FORM_FIELD_PREDICTIONS_H_
+#define WEBKIT_GLUE_FORM_FIELD_PREDICTIONS_H_
+
+#include <string>
+#include <vector>
+
+#include "webkit/glue/form_field.h"
+
+namespace webkit_glue {
+
+// Stores information about a field in a form.
+struct FormFieldPredictions {
+ FormFieldPredictions();
+ FormFieldPredictions(const FormFieldPredictions& other);
+ ~FormFieldPredictions();
+
+ FormField field;
+ std::string signature;
+ std::string heuristic_type;
+ std::string server_type;
+ std::string overall_type;
+};
+
+} // namespace webkit_glue
+
+#endif // WEBKIT_GLUE_FORM_FIELD_PREDICTIONS_H_
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index cf2b7f4..33a9646 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -343,8 +343,12 @@
'dom_operations.h',
'form_data.cc',
'form_data.h',
+ 'form_data_predictions.cc',
+ 'form_data_predictions.h',
'form_field.cc',
'form_field.h',
+ 'form_field_predictions.cc',
+ 'form_field_predictions.h',
'ftp_directory_listing_response_delegate.cc',
'ftp_directory_listing_response_delegate.h',
'gl_bindings_skia_cmd_buffer.cc',