Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / components / autofill / core / browser / credit_card.cc
index e3e2b99..ee4aa1e 100644 (file)
 #include "components/autofill/core/browser/autofill_type.h"
 #include "components/autofill/core/browser/validation.h"
 #include "components/autofill/core/common/form_field_data.h"
-#include "grit/component_strings.h"
+#include "grit/component_scaled_resources.h"
+#include "grit/components_strings.h"
 #include "third_party/icu/source/common/unicode/uloc.h"
 #include "third_party/icu/source/i18n/unicode/dtfmtsym.h"
 #include "ui/base/l10n/l10n_util.h"
 
-// TODO(blundell): Eliminate the need for this conditional include.
-// crbug.com/328150
-#if !defined(OS_IOS)
-#include "grit/webkit_resources.h"
-#endif
-
 namespace autofill {
 
 namespace {
@@ -80,7 +75,7 @@ bool ConvertMonth(const base::string16& month,
 
   // Otherwise, try parsing the |month| as a named month, e.g. "January" or
   // "Jan".
-  base::string16 lowercased_month = StringToLowerASCII(month);
+  base::string16 lowercased_month = base::StringToLowerASCII(month);
 
   UErrorCode status = U_ZERO_ERROR;
   icu::Locale locale(app_locale.c_str());
@@ -93,7 +88,7 @@ bool ConvertMonth(const base::string16& month,
   for (int32_t i = 0; i < num_months; ++i) {
     const base::string16 icu_month = base::string16(months[i].getBuffer(),
                                         months[i].length());
-    if (lowercased_month == StringToLowerASCII(icu_month)) {
+    if (lowercased_month == base::StringToLowerASCII(icu_month)) {
       *num = i + 1;  // Adjust from 0-indexed to 1-indexed.
       return true;
     }
@@ -103,7 +98,7 @@ bool ConvertMonth(const base::string16& month,
   for (int32_t i = 0; i < num_months; ++i) {
     const base::string16 icu_month = base::string16(months[i].getBuffer(),
                                         months[i].length());
-    if (lowercased_month == StringToLowerASCII(icu_month)) {
+    if (lowercased_month == base::StringToLowerASCII(icu_month)) {
       *num = i + 1;  // Adjust from 0-indexed to 1-indexed.
       return true;
     }
@@ -138,9 +133,8 @@ CreditCard::~CreditCard() {}
 
 // static
 const base::string16 CreditCard::StripSeparators(const base::string16& number) {
-  const base::char16 kSeparators[] = {'-', ' ', '\0'};
   base::string16 stripped;
-  base::RemoveChars(number, kSeparators, &stripped);
+  base::RemoveChars(number, base::ASCIIToUTF16("- "), &stripped);
   return stripped;
 }
 
@@ -169,12 +163,6 @@ base::string16 CreditCard::TypeForDisplay(const std::string& type) {
 
 // static
 int CreditCard::IconResourceId(const std::string& type) {
-  // TODO(blundell): Either move these resources out of webkit_resources or
-  // this function into //components/autofill/content/browser to eliminate the
-  // need for this ifdef-ing. crbug.com/328150
-#if defined(OS_IOS)
-  return 0;
-#else
   if (type == kAmericanExpressCard)
     return IDR_AUTOFILL_CC_AMEX;
   if (type == kDinersCard)
@@ -194,11 +182,10 @@ int CreditCard::IconResourceId(const std::string& type) {
   // include a new card.
   DCHECK_EQ(kGenericCard, type);
   return IDR_AUTOFILL_CC_GENERIC;
-#endif  // defined(OS_IOS)
 }
 
 // static
-std::string CreditCard::GetCreditCardType(const base::string16& number) {
+const char* CreditCard::GetCreditCardType(const base::string16& number) {
   // Credit card number specifications taken from:
   // http://en.wikipedia.org/wiki/Credit_card_numbers,
   // http://en.wikipedia.org/wiki/List_of_Issuer_Identification_Numbers,