| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/android/phone_number_detector.h" | 5 #include "content/renderer/android/phone_number_detector.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 | 31 |
| 32 PhoneNumberDetector::PhoneNumberDetector() | 32 PhoneNumberDetector::PhoneNumberDetector() |
| 33 : region_code_(RegionCode::GetUnknown()) { | 33 : region_code_(RegionCode::GetUnknown()) { |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Region should be empty or an ISO 3166-1 alpha-2 country code. | 36 // Region should be empty or an ISO 3166-1 alpha-2 country code. |
| 37 PhoneNumberDetector::PhoneNumberDetector(const std::string& region) | 37 PhoneNumberDetector::PhoneNumberDetector(const std::string& region) |
| 38 : region_code_(region.empty() ? RegionCode::GetUnknown() | 38 : region_code_(region.empty() ? RegionCode::GetUnknown() |
| 39 : StringToUpperASCII(region)) { | 39 : base::StringToUpperASCII(region)) { |
| 40 } | 40 } |
| 41 | 41 |
| 42 PhoneNumberDetector::~PhoneNumberDetector() { | 42 PhoneNumberDetector::~PhoneNumberDetector() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 size_t PhoneNumberDetector::GetMaximumContentLength() { | 45 size_t PhoneNumberDetector::GetMaximumContentLength() { |
| 46 return kMaximumTelephoneLength; | 46 return kMaximumTelephoneLength; |
| 47 } | 47 } |
| 48 | 48 |
| 49 GURL PhoneNumberDetector::GetIntentURL(const std::string& content_text) { | 49 GURL PhoneNumberDetector::GetIntentURL(const std::string& content_text) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 base::UTF8ToUTF16(utf8_input.substr(0, match.start())).length(); | 82 base::UTF8ToUTF16(utf8_input.substr(0, match.start())).length(); |
| 83 *end_pos = *start_pos + base::UTF8ToUTF16(match.raw_string()).length(); | 83 *end_pos = *start_pos + base::UTF8ToUTF16(match.raw_string()).length(); |
| 84 | 84 |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 | 87 |
| 88 return false; | 88 return false; |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace content | 91 } // namespace content |
| OLD | NEW |