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

Unified Diff: chrome/browser/ui/webui/options/autofill_options_handler.cc

Issue 6930052: Revert 84320 - Autofill DOMUI Prefs should work with i18n phone numbers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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/ui/webui/options/autofill_options_handler.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/autofill_options_handler.cc
===================================================================
--- chrome/browser/ui/webui/options/autofill_options_handler.cc (revision 84345)
+++ chrome/browser/ui/webui/options/autofill_options_handler.cc (working copy)
@@ -14,7 +14,6 @@
#include "chrome/browser/autofill/autofill_country.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/credit_card.h"
-#include "chrome/browser/autofill/phone_number_i18n.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
#include "chrome/common/guid.h"
@@ -116,64 +115,6 @@
profile->SetMultiInfo(type, values);
}
-// Pulls the phone number |index|, |list_value|, and |country_code| from the
-// |args| input.
-void ExtractPhoneNumberInformation(const ListValue* args,
- size_t* index,
- ListValue** list_value,
- std::string* country_code) {
- double number = 0.0;
- if (!args->GetDouble(0, &number)) {
- NOTREACHED();
- return;
- }
- *index = number;
-
- if (!args->GetList(1, list_value)) {
- NOTREACHED();
- return;
- }
-
- if (!args->GetString(2, country_code)) {
- NOTREACHED();
- return;
- }
-}
-
-// Searches the |list| for the value at |index|. If this value is present
-// in any of the rest of the list, then the item (at |index|) is removed.
-// The comparison of phone number values is done on normalized versions of the
-// phone number values.
-void RemoveDuplicatePhoneNumberAtIndex(size_t index,
- const std::string& country_code,
- ListValue* list) {
- string16 new_value;
- list->GetString(index, &new_value);
-
- bool is_duplicate = false;
- for (size_t i = 0; i < list->GetSize() && !is_duplicate; ++i) {
- if (i == index)
- continue;
-
- string16 existing_value;
- list->GetString(i, &existing_value);
- is_duplicate = autofill_i18n::PhoneNumbersMatch(new_value,
- existing_value,
- country_code);
- }
-
- if (is_duplicate)
- list->Remove(index, NULL);
-}
-
-void ValidatePhoneArguments(const ListValue* args, ListValue** list) {
- size_t index = 0;
- std::string country_code;
- ExtractPhoneNumberInformation(args, &index, list, &country_code);
-
- RemoveDuplicatePhoneNumberAtIndex(index, country_code, *list);
-}
-
} // namespace
AutofillOptionsHandler::AutofillOptionsHandler()
@@ -240,12 +181,6 @@
web_ui_->RegisterMessageCallback(
"setCreditCard",
NewCallback(this, &AutofillOptionsHandler::SetCreditCard));
- web_ui_->RegisterMessageCallback(
- "validatePhoneNumbers",
- NewCallback(this, &AutofillOptionsHandler::ValidatePhoneNumbers));
- web_ui_->RegisterMessageCallback(
- "validateFaxNumbers",
- NewCallback(this, &AutofillOptionsHandler::ValidateFaxNumbers));
}
/////////////////////////////////////////////////////////////////////////////
@@ -517,25 +452,3 @@
personal_data_->UpdateCreditCard(credit_card);
}
}
-
-void AutofillOptionsHandler::ValidatePhoneNumbers(const ListValue* args) {
- if (!personal_data_->IsDataLoaded())
- return;
-
- ListValue* list_value = NULL;
- ValidatePhoneArguments(args, &list_value);
-
- web_ui_->CallJavascriptFunction(
- "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value);
-}
-
-void AutofillOptionsHandler::ValidateFaxNumbers(const ListValue* args) {
- if (!personal_data_->IsDataLoaded())
- return;
-
- ListValue* list_value = NULL;
- ValidatePhoneArguments(args, &list_value);
-
- web_ui_->CallJavascriptFunction(
- "AutofillEditAddressOverlay.setValidatedFaxNumbers", *list_value);
-}
« no previous file with comments | « chrome/browser/ui/webui/options/autofill_options_handler.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698