| 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/email_detector.h" | 5 #include "content/renderer/android/email_detector.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 UErrorCode status = U_ZERO_ERROR; | 55 UErrorCode status = U_ZERO_ERROR; |
| 56 std::unique_ptr<icu::RegexMatcher> matcher( | 56 std::unique_ptr<icu::RegexMatcher> matcher( |
| 57 new icu::RegexMatcher(pattern, input, UREGEX_CASE_INSENSITIVE, status)); | 57 new icu::RegexMatcher(pattern, input, UREGEX_CASE_INSENSITIVE, status)); |
| 58 if (matcher->find()) { | 58 if (matcher->find()) { |
| 59 *start_pos = matcher->start(status); | 59 *start_pos = matcher->start(status); |
| 60 DCHECK(U_SUCCESS(status)); | 60 DCHECK(U_SUCCESS(status)); |
| 61 *end_pos = matcher->end(status); | 61 *end_pos = matcher->end(status); |
| 62 DCHECK(U_SUCCESS(status)); | 62 DCHECK(U_SUCCESS(status)); |
| 63 icu::UnicodeString content_ustr(matcher->group(status)); | 63 icu::UnicodeString content_ustr(matcher->group(status)); |
| 64 DCHECK(U_SUCCESS(status)); | 64 DCHECK(U_SUCCESS(status)); |
| 65 base::UTF16ToUTF8(content_ustr.getBuffer(), content_ustr.length(), | 65 content_text->clear(); |
| 66 content_text); | 66 content_ustr.toUTF8String(*content_text); |
| 67 return true; | 67 return true; |
| 68 } | 68 } |
| 69 | 69 |
| 70 return false; | 70 return false; |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace content | 73 } // namespace content |
| OLD | NEW |