Clean up RenderViewHostDelegate::AutoFill interface -- remove |value| and |label| parameters from FillAutoFillFormData()

BUG=none
TEST=it compiles

Review URL: http://codereview.chromium.org/3319006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59438 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 3f04f20e..2cddabc 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -10,8 +10,8 @@
 #include "base/basictypes.h"
 #include "base/string16.h"
 #include "base/utf_string_conversions.h"
-#include "chrome/browser/autofill/autofill_dialog.h"
 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h"
+#include "chrome/browser/autofill/autofill_dialog.h"
 #include "chrome/browser/autofill/form_structure.h"
 #include "chrome/browser/autofill/select_control_handler.h"
 #include "chrome/browser/prefs/pref_service.h"
@@ -203,7 +203,7 @@
     }
   }
 
-  if (autofill_field == NULL)
+  if (!autofill_field)
     return false;
 
   std::vector<string16> values;
@@ -254,11 +254,8 @@
   return true;
 }
 
-// TODO(jhawkins): Remove the |value| parameter.
 bool AutoFillManager::FillAutoFillFormData(int query_id,
                                            const FormData& form,
-                                           const string16& value,
-                                           const string16& label,
                                            int unique_id) {
   if (!IsAutoFillEnabled())
     return false;
diff --git a/chrome/browser/autofill/autofill_manager.h b/chrome/browser/autofill/autofill_manager.h
index a9ebdc1..5ee7b09 100644
--- a/chrome/browser/autofill/autofill_manager.h
+++ b/chrome/browser/autofill/autofill_manager.h
@@ -58,8 +58,6 @@
                                       const webkit_glue::FormField& field);
   virtual bool FillAutoFillFormData(int query_id,
                                     const webkit_glue::FormData& form,
-                                    const string16& value,
-                                    const string16& label,
                                     int unique_id);
   virtual void ShowAutoFillDialog();
 
diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc
index f76cc04b..7d78a9b 100644
--- a/chrome/browser/autofill/autofill_manager_unittest.cc
+++ b/chrome/browser/autofill/autofill_manager_unittest.cc
@@ -777,8 +777,7 @@
   // an IPC message back to the renderer.
   const int kPageID = 1;
   EXPECT_TRUE(autofill_manager_->FillAutoFillFormData(
-      kPageID, form, string16(), ASCIIToUTF16("Elvis Aaron Presley; *3456"),
-      AutoFillManager::PackIDs(4, 1)));
+      kPageID, form, AutoFillManager::PackIDs(4, 1)));
 
   int page_id = 0;
   FormData results;
@@ -861,8 +860,7 @@
   // an IPC message back to the renderer.
   const int kPageID = 1;
   EXPECT_TRUE(autofill_manager_->FillAutoFillFormData(
-      kPageID, form, string16(), ASCIIToUTF16("Elvis Aaron Presley; 8765"),
-      AutoFillManager::PackIDs(4, 7)));
+      kPageID, form, AutoFillManager::PackIDs(4, 7)));
 
   int page_id = 0;
   FormData results;
@@ -932,8 +930,7 @@
   // an IPC message back to the renderer.
   const int kPageID = 1;
   EXPECT_TRUE(autofill_manager_->FillAutoFillFormData(
-      kPageID, form, string16(), ASCIIToUTF16("Home; 8765; *3456"),
-      AutoFillManager::PackIDs(4, 7)));
+      kPageID, form, AutoFillManager::PackIDs(4, 7)));
 
   int page_id = 0;
   FormData results;
@@ -1046,8 +1043,6 @@
     EXPECT_TRUE(
         autofill_manager_->FillAutoFillFormData(page_id,
                                                 form,
-                                                ASCIIToUTF16(test_data),
-                                                ASCIIToUTF16("Work"),
                                                 work_profile->unique_id()));
     page_id = 0;
     FormData results;
@@ -1103,9 +1098,7 @@
   // The page ID sent to the AutoFillManager from the RenderView, used to send
   // an IPC message back to the renderer.
   const int kPageID = 1;
-  EXPECT_TRUE(autofill_manager_->FillAutoFillFormData(
-      kPageID, form, ASCIIToUTF16("Elvis"), ASCIIToUTF16("Elvis Aaron Presley"),
-      1));
+  EXPECT_TRUE(autofill_manager_->FillAutoFillFormData(kPageID, form, 1));
 
   int page_id = 0;
   FormData results;
@@ -1168,9 +1161,7 @@
   // The page ID sent to the AutoFillManager from the RenderView, used to send
   // an IPC message back to the renderer.
   const int kPageID = 1;
-  EXPECT_TRUE(autofill_manager_->FillAutoFillFormData(
-      kPageID, form, ASCIIToUTF16("Elvis"), ASCIIToUTF16("Elvis Aaron Presley"),
-      1));
+  EXPECT_TRUE(autofill_manager_->FillAutoFillFormData(kPageID, form, 1));
 
   int page_id = 0;
   FormData results;
diff --git a/chrome/browser/chromeos/login/account_creation_view.cc b/chrome/browser/chromeos/login/account_creation_view.cc
index 054e966..82ff793 100644
--- a/chrome/browser/chromeos/login/account_creation_view.cc
+++ b/chrome/browser/chromeos/login/account_creation_view.cc
@@ -61,8 +61,6 @@
 
   virtual bool FillAutoFillFormData(int query_id,
                                     const webkit_glue::FormData& form,
-                                    const string16& name,
-                                    const string16& label,
                                     int unique_id) {
     return false;
   }
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index cbbe369..ee80ce03 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -1713,16 +1713,13 @@
 
 void RenderViewHost::OnFillAutoFillFormData(int query_id,
                                             const FormData& form,
-                                            const string16& name,
-                                            const string16& label,
                                             int unique_id) {
   RenderViewHostDelegate::AutoFill* autofill_delegate =
       delegate_->GetAutoFillDelegate();
   if (!autofill_delegate)
     return;
 
-  autofill_delegate->FillAutoFillFormData(
-      query_id, form, name, label, unique_id);
+  autofill_delegate->FillAutoFillFormData(query_id, form, unique_id);
 }
 
 void RenderViewHost::AutoFillSuggestionsReturned(
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 4d50fb8..248a635c5 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -645,8 +645,6 @@
   void OnShowAutoFillDialog();
   void OnFillAutoFillFormData(int query_id,
                               const webkit_glue::FormData& form,
-                              const string16& value,
-                              const string16& label,
                               int unique_id);
 
   void OnShowDesktopNotification(
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index 5c40b460..69d759b 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -528,8 +528,6 @@
     // RenderViewHost::AutoFillFormDataFilled has been called.
     virtual bool FillAutoFillFormData(int query_id,
                                       const webkit_glue::FormData& form,
-                                      const string16& value,
-                                      const string16& label,
                                       int unique_id) = 0;
 
     // Called when the user selects the 'AutoFill Options...' suggestions in the
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index b4e9cf6..da1632c 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1994,11 +1994,9 @@
 
   // Instructs the browser to fill in the values for a form using AutoFill
   // profile data.
-  IPC_MESSAGE_ROUTED5(ViewHostMsg_FillAutoFillFormData,
+  IPC_MESSAGE_ROUTED3(ViewHostMsg_FillAutoFillFormData,
                       int /* id of this message */,
                       webkit_glue::FormData /* the form  */,
-                      string16 /* profile name */,
-                      string16 /* profile label */,
                       int /* profile unique ID */)
 
   // Instructs the browser to remove the specified Autocomplete entry from the
diff --git a/chrome/renderer/autofill_helper.cc b/chrome/renderer/autofill_helper.cc
index 3737726..273a7c8 100644
--- a/chrome/renderer/autofill_helper.cc
+++ b/chrome/renderer/autofill_helper.cc
@@ -40,9 +40,7 @@
       suggestions_options_index_(-1) {
 }
 
-void AutoFillHelper::QueryAutoFillSuggestions(const WebNode& node,
-                                              const WebString& name,
-                                              const WebString& value) {
+void AutoFillHelper::QueryAutoFillSuggestions(const WebNode& node) {
   static int query_counter = 0;
   autofill_query_id_ = query_counter++;
   autofill_query_node_ = node;
@@ -151,16 +149,13 @@
 }
 
 void AutoFillHelper::DidSelectAutoFillSuggestion(const WebNode& node,
-                                                 const WebString& value,
-                                                 const WebString& label,
                                                  int unique_id) {
   DidClearAutoFillSelection(node);
-  QueryAutoFillFormData(node, value, label, unique_id, AUTOFILL_PREVIEW);
+  QueryAutoFillFormData(node, unique_id, AUTOFILL_PREVIEW);
 }
 
 void AutoFillHelper::DidAcceptAutoFillSuggestion(const WebNode& node,
                                                  const WebString& value,
-                                                 const WebString& label,
                                                  int unique_id,
                                                  unsigned index) {
   if (suggestions_options_index_ != -1 &&
@@ -190,7 +185,7 @@
       webframe->notifiyPasswordListenerOfAutocomplete(element);
   } else {
     // Fill the values for the whole form.
-    QueryAutoFillFormData(node, value, label, unique_id, AUTOFILL_FILL);
+    QueryAutoFillFormData(node, unique_id, AUTOFILL_FILL);
   }
 
   suggestions_clear_index_ = -1;
@@ -258,12 +253,10 @@
     return;
   }
 
-  QueryAutoFillSuggestions(element, name, value);
+  QueryAutoFillSuggestions(element);
 }
 
 void AutoFillHelper::QueryAutoFillFormData(const WebNode& node,
-                                           const WebString& value,
-                                           const WebString& label,
                                            int unique_id,
                                            AutoFillAction action) {
   static int query_counter = 0;
@@ -277,8 +270,7 @@
 
   autofill_action_ = action;
   render_view_->Send(new ViewHostMsg_FillAutoFillFormData(
-      render_view_->routing_id(), autofill_query_id_, form, value, label,
-      unique_id));
+      render_view_->routing_id(), autofill_query_id_, form, unique_id));
 }
 
 void AutoFillHelper::SendForms(WebFrame* frame) {
diff --git a/chrome/renderer/autofill_helper.h b/chrome/renderer/autofill_helper.h
index d4940d0..c859725 100644
--- a/chrome/renderer/autofill_helper.h
+++ b/chrome/renderer/autofill_helper.h
@@ -33,11 +33,9 @@
 
   // Queries the browser for Autocomplete and AutoFill suggestions for the given
   // |node|.
-  void QueryAutoFillSuggestions(const WebKit::WebNode& node,
-                                const WebKit::WebString& name,
-                                const WebKit::WebString& value);
+  void QueryAutoFillSuggestions(const WebKit::WebNode& node);
 
-  // Removes the Autocomplete suggestion |value| for the field names |name|.
+  // Removes the Autocomplete suggestion |value| for the field named |name|.
   void RemoveAutocompleteSuggestion(const WebKit::WebString& name,
                                     const WebKit::WebString& value);
 
@@ -56,14 +54,11 @@
   // happens when the user hovers over an suggestion or navigates the popup with
   // the arrow keys).
   void DidSelectAutoFillSuggestion(const WebKit::WebNode& node,
-                                   const WebKit::WebString& value,
-                                   const WebKit::WebString& label,
                                    int unique_id);
 
   // Called by Webkit when the user has accepted a suggestion in the popup.
   void DidAcceptAutoFillSuggestion(const WebKit::WebNode& node,
                                    const WebKit::WebString& value,
-                                   const WebKit::WebString& label,
                                    int unique_id,
                                    unsigned index);
 
@@ -121,8 +116,6 @@
   // profile's unique ID.  |action| specifies whether to Fill or Preview the
   // values returned from the AutoFillManager.
   void QueryAutoFillFormData(const WebKit::WebNode& node,
-                             const WebKit::WebString& value,
-                             const WebKit::WebString& label,
                              int unique_id,
                              AutoFillAction action);
 
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index d68bca1..39a65e8 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2212,7 +2212,7 @@
 void RenderView::queryAutofillSuggestions(const WebNode& node,
                                           const WebString& name,
                                           const WebString& value) {
-  autofill_helper_->QueryAutoFillSuggestions(node, name, value);
+  autofill_helper_->QueryAutoFillSuggestions(node);
 }
 
 void RenderView::removeAutofillSuggestions(const WebString& name,
@@ -2225,15 +2225,14 @@
                                              const WebKit::WebString& label,
                                              int unique_id,
                                              unsigned index) {
-  autofill_helper_->DidAcceptAutoFillSuggestion(node, value, label, unique_id,
-                                                index);
+  autofill_helper_->DidAcceptAutoFillSuggestion(node, value, unique_id, index);
 }
 
 void RenderView::didSelectAutoFillSuggestion(const WebKit::WebNode& node,
                                              const WebKit::WebString& value,
                                              const WebKit::WebString& label,
                                              int unique_id) {
-  autofill_helper_->DidSelectAutoFillSuggestion(node, value, label, unique_id);
+  autofill_helper_->DidSelectAutoFillSuggestion(node, unique_id);
 }
 
 void RenderView::didClearAutoFillSelection(const WebKit::WebNode& node) {