summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-30 22:50:45 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-30 22:50:45 +0000
commit226cccfafa0f6a3b7a57d11937d4f3b8ea6e9296 (patch)
treefdfae23da7d22eede7c00bea4120718bff8b1872
parent1ce7c92a8b2620058e748411a4674fa59da8c666 (diff)
downloadchromium_src-226cccfafa0f6a3b7a57d11937d4f3b8ea6e9296.zip
chromium_src-226cccfafa0f6a3b7a57d11937d4f3b8ea6e9296.tar.gz
chromium_src-226cccfafa0f6a3b7a57d11937d4f3b8ea6e9296.tar.bz2
Revert 112305 - Pull the phone library directly. Delete old version.
TEST=unit-tests BUG=105577 Review URL: http://codereview.chromium.org/8736001 TBR=georgey@chromium.org Review URL: http://codereview.chromium.org/8759004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112319 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS11
-rw-r--r--chrome/browser/autofill/phone_number_i18n.cc12
-rw-r--r--third_party/libphonenumber/README.chromium22
-rw-r--r--third_party/libphonenumber/libphonenumber.gyp64
-rw-r--r--third_party/libphonenumber/patches/version277a.patch21
-rw-r--r--third_party/libphonenumber/src/LICENSE13
-rw-r--r--third_party/libphonenumber/src/phonenumber_api.h13
7 files changed, 65 insertions, 91 deletions
diff --git a/DEPS b/DEPS
index 526644f..eab6192 100644
--- a/DEPS
+++ b/DEPS
@@ -31,7 +31,6 @@ vars = {
"nacl_toolchain_revision": "7258",
"libjingle_revision": "95",
- "libphonenumber_revision": "403",
"libvpx_revision": "109236",
"ffmpeg_revision": "112050",
"sfntly_revision": "98",
@@ -299,16 +298,6 @@ deps = {
"src/third_party/smhasher/src":
(Var("googlecode_url") % "smhasher") + "/trunk@136",
-
- "src/third_party/libphonenumber/src/phonenumbers":
- (Var("googlecode_url") % "libphonenumber") +
- "/trunk/cpp/src/phonenumbers@" + Var("libphonenumber_revision"),
- "src/third_party/libphonenumber/src/test":
- (Var("googlecode_url") % "libphonenumber") + "/trunk/cpp/test@" +
- Var("libphonenumber_revision"),
- "src/third_party/libphonenumber/src/resources":
- (Var("googlecode_url") % "libphonenumber") + "/trunk/resources@" +
- Var("libphonenumber_revision"),
}
diff --git a/chrome/browser/autofill/phone_number_i18n.cc b/chrome/browser/autofill/phone_number_i18n.cc
index a411dc7..8560c92 100644
--- a/chrome/browser/autofill/phone_number_i18n.cc
+++ b/chrome/browser/autofill/phone_number_i18n.cc
@@ -10,7 +10,7 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_country.h"
-#include "third_party/libphonenumber/src/phonenumber_api.h"
+#include "third_party/libphonenumber/cpp/src/phonenumberutil.h"
using i18n::phonenumbers::PhoneNumber;
using i18n::phonenumbers::PhoneNumberUtil;
@@ -108,7 +108,7 @@ bool ParsePhoneNumberInternal(const string16& value,
*city_code = UTF8ToUTF16(area_code);
*country_code = string16();
- phone_util->NormalizeDigitsOnly(&number_text);
+ PhoneNumberUtil::NormalizeDigitsOnly(&number_text);
string16 normalized_number(UTF8ToUTF16(number_text));
// Check if parsed number has country code and it was not inferred from the
// locale.
@@ -148,7 +148,7 @@ string16 NormalizePhoneNumber(const string16& value,
return string16();
}
std::string result_utf8(UTF16ToUTF8(result));
- PhoneNumberUtil::GetInstance()->NormalizeDigitsOnly(&result_utf8);
+ PhoneNumberUtil::NormalizeDigitsOnly(&result_utf8);
return UTF8ToUTF16(result_utf8);
}
@@ -176,9 +176,7 @@ bool ConstructPhoneNumber(const string16& country_code,
std::string normalized_number(UTF16ToUTF8(city_code));
normalized_number.append(UTF16ToUTF8(number));
- PhoneNumberUtil* phone_util = PhoneNumberUtil::GetInstance();
-
- phone_util->NormalizeDigitsOnly(&normalized_number);
+ PhoneNumberUtil::NormalizeDigitsOnly(&normalized_number);
int64 number_int = 0;
if (!base::StringToInt64(normalized_number, &number_int) || !number_int)
@@ -187,6 +185,8 @@ bool ConstructPhoneNumber(const string16& country_code,
PhoneNumber i18n_number;
i18n_number.set_national_number(static_cast<uint64>(number_int));
+ PhoneNumberUtil* phone_util = PhoneNumberUtil::GetInstance();
+
int country_int = phone_util->GetCountryCodeForRegion(
SanitizeLocaleCode(locale));
if (!country_code.empty() && !base::StringToInt(country_code, &country_int))
diff --git a/third_party/libphonenumber/README.chromium b/third_party/libphonenumber/README.chromium
index 94700e8..e662452 100644
--- a/third_party/libphonenumber/README.chromium
+++ b/third_party/libphonenumber/README.chromium
@@ -2,7 +2,7 @@ Name: International Phone Number Library
Short Name: libphonenumber
URL: http://libphonenumber.googlecode.com/svn/trunk/
Version: unknown
-Revision: 403
+Revision: 277
Security Critical: yes
This directory contains the source code of International Phone Number Library
@@ -17,13 +17,15 @@ This library depends on
Additional files, not in the original library:
libphonenumber.gyp
README.chromium
- src/LICENSE # Taken from http://code.google.com/p/libphonenumber.
- src/phonenumber_api.h
-The library is mapped through the DEPS file into src/ folder. To update:
-1. Get the latest version number from
- http://code.google.com/p/libphonenumber/source/list
-2. Locally update this file and DEPS.
-3. run 'gclient sync'
-4. Adjust libphonenumber.gyp if necessary.
-5. Verify that all compiles and all of the tests are successfull.
+Until the changes are upstreamed library is included directly, with patches
+in patches/version277.patch and patches/version277a.patch applied.
+
+The folders included in our repository for now are
+ cpp/
+ resource/
+
+TODO(georgey) : remove following lines when updated to version after 186
+ cpp/src/phonelibutil.cc made icu::Transliteration member of PhoneUtil
+ to improve performance, Not needed in recent versions.
+
diff --git a/third_party/libphonenumber/libphonenumber.gyp b/third_party/libphonenumber/libphonenumber.gyp
index d5a4bf5..92415da 100644
--- a/third_party/libphonenumber/libphonenumber.gyp
+++ b/third_party/libphonenumber/libphonenumber.gyp
@@ -8,17 +8,15 @@
'../..', # add it first, so src/base headers are used instead of the ones
# brought with the library as cc files would be taken from the
# main chrome tree as well.
- 'src',
- 'src/test',
+ 'cpp/src',
# The libphonenumber source (and test code) expects the
- # generated protocol headers to be available with "phonenumbers" include
- # path, e.g. #include "phonenumbers/foo.pb.h".
+ # generated protocol headers to be available with no include
+ # path, e.g. #include "foo.pb.h".
'<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber',
],
'defines': [
'USE_HASH_MAP=1',
'USE_GOOGLE_BASE=1',
- 'USE_ICU_REGEXP=1',
],
},
'includes': [
@@ -34,36 +32,32 @@
'../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
],
'sources': [
- 'src/phonenumbers/asyoutypeformatter.cc',
- 'src/phonenumbers/default_logger.cc',
- # Comment next line and uncomment the line after, if complete metadata
- # (with examples) is needed.
- 'src/phonenumbers/lite_metadata.cc',
- #'src/phonenumbers/metadata.cc',
- 'src/phonenumbers/logger.cc',
- 'src/phonenumbers/phonenumber.cc',
- # The following two files should be added on 'as needed' basis.
- #'src/phonenumbers/phonenumbermatch.cc',
- #'src/phonenumbers/phonenumbermatcher.cc',
- 'src/phonenumbers/phonenumberutil.cc',
- 'src/phonenumbers/regexp_adapter_icu.cc',
- 'src/phonenumbers/regexp_cache.cc',
- 'src/phonenumbers/stringutil.cc',
- 'src/phonenumbers/unicodestring.cc',
- 'src/phonenumbers/utf/rune.c',
- 'src/phonenumbers/utf/unicodetext.cc',
- 'src/phonenumbers/utf/unilib.cc',
- 'src/resources/phonemetadata.proto',
- 'src/resources/phonenumber.proto',
+ # 'chrome/regexp_adapter_icuregexp.cc',
+ 'cpp/src/default_logger.cc',
+ 'cpp/src/lite_metadata.cc',
+ 'cpp/src/logger.cc',
+ 'cpp/src/phonenumber.cc',
+ 'cpp/src/phonenumberutil.cc',
+ 'cpp/src/regexp_adapter_icu.cc',
+ 'cpp/src/regexp_cache.cc',
+ 'cpp/src/stringutil.cc',
+ 'cpp/src/utf/rune.c',
+ 'cpp/src/utf/unicodetext.cc',
+ 'cpp/src/utf/unilib.cc',
+ 'resources/phonemetadata.proto',
+ 'resources/phonenumber.proto',
],
'direct_dependent_settings': {
'include_dirs': [
+ # The libphonenumber headers expect generated protocol headers
+ # to be available with no include path, e.g. #include
+ # "foo.pb.h".
'<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber',
],
},
'variables': {
- 'proto_in_dir': 'src/resources',
- 'proto_out_dir': 'third_party/libphonenumber/phonenumbers',
+ 'proto_in_dir': 'resources',
+ 'proto_out_dir': 'third_party/libphonenumber',
},
'includes': [ '../../build/protoc.gypi' ],
'conditions': [
@@ -79,16 +73,10 @@
'type': 'executable',
'sources': [
'../../base/test/run_all_unittests.cc',
- 'src/phonenumbers/test_metadata.cc',
- 'src/test/phonenumbers/asyoutypeformatter_test.cc',
- # The following two files should be added on 'as needed' basis.
- #'src/test/phonenumbers/phonenumbermatch_test.cc',
- #'src/test/phonenumbers/phonenumbermatcher_test.cc',
- 'src/test/phonenumbers/phonenumberutil_test.cc',
- 'src/test/phonenumbers/regexp_adapter_test.cc',
- 'src/test/phonenumbers/stringutil_test.cc',
- 'src/test/phonenumbers/test_util.cc',
- 'src/test/phonenumbers/unicodestring_test.cc',
+ 'cpp/src/phonenumberutil_test.cc',
+ 'cpp/src/regexp_adapter_test.cc',
+ 'cpp/src/stringutil_test.cc',
+ 'cpp/src/test_metadata.cc',
],
'dependencies': [
'../icu/icu.gyp:icui18n',
diff --git a/third_party/libphonenumber/patches/version277a.patch b/third_party/libphonenumber/patches/version277a.patch
new file mode 100644
index 0000000..8757107
--- /dev/null
+++ b/third_party/libphonenumber/patches/version277a.patch
@@ -0,0 +1,21 @@
+diff -Naur src-orig/default_logger.h src/default_logger.h
+--- src-orig/default_logger.h 2011-07-02 16:27:58.000000000 -0700
++++ src/default_logger.h 2011-07-02 16:28:29.000000000 -0700
+@@ -17,6 +17,8 @@
+ #ifndef I18N_PHONENUMBERS_DEFAULT_LOGGER_H_
+ #define I18N_PHONENUMBERS_DEFAULT_LOGGER_H_
+
++#include <stdio.h>
++
+ #include <string>
+
+ #include "logger.h"
+@@ -45,7 +47,7 @@
+ struct ConvertToString<int> {
+ static inline string DoWork(const int& n) {
+ char buffer[16];
+- std::snprintf(buffer, sizeof(buffer), "%d", n);
++ snprintf(buffer, sizeof(buffer), "%d", n);
+ return string(buffer);
+ }
+ };
diff --git a/third_party/libphonenumber/src/LICENSE b/third_party/libphonenumber/src/LICENSE
deleted file mode 100644
index 145f008..0000000
--- a/third_party/libphonenumber/src/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright (C) 2011 Google Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/third_party/libphonenumber/src/phonenumber_api.h b/third_party/libphonenumber/src/phonenumber_api.h
deleted file mode 100644
index 4a7fcd1..0000000
--- a/third_party/libphonenumber/src/phonenumber_api.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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 THIRD_PARTY_LIBPHONENUMBER_SRC_PHONENUMBER_API_H_
-#define THIRD_PARTY_LIBPHONENUMBER_SRC_PHONENUMBER_API_H_
-#pragma once
-
-#define USE_GOOGLE_BASE
-#include "third_party/libphonenumber/src/phonenumbers/phonenumberutil.h"
-#undef USE_GOOGLE_BASE
-
-#endif // THIRD_PARTY_LIBPHONENUMBER_SRC_PHONENUMBER_API_H_