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

Side by Side Diff: components/bookmarks/browser/titled_url_index.cc

Issue 2740673002: Prepare Chromium and Blink for ICU 59 (Closed)
Patch Set: revert accidental revert of sftnly roll during rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/bookmarks/browser/titled_url_index.h" 5 #include "components/bookmarks/browser/titled_url_index.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/i18n/unicodestring.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/stl_util.h" 12 #include "base/stl_util.h"
12 #include "base/strings/utf_offset_string_conversions.h" 13 #include "base/strings/utf_offset_string_conversions.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "components/bookmarks/browser/bookmark_utils.h" 15 #include "components/bookmarks/browser/bookmark_utils.h"
15 #include "components/bookmarks/browser/titled_url_match.h" 16 #include "components/bookmarks/browser/titled_url_match.h"
16 #include "components/bookmarks/browser/titled_url_node.h" 17 #include "components/bookmarks/browser/titled_url_node.h"
17 #include "components/bookmarks/browser/titled_url_node_sorter.h" 18 #include "components/bookmarks/browser/titled_url_node_sorter.h"
18 #include "components/query_parser/snippet.h" 19 #include "components/query_parser/snippet.h"
19 #include "third_party/icu/source/common/unicode/normalizer2.h" 20 #include "third_party/icu/source/common/unicode/normalizer2.h"
(...skipping 15 matching lines...) Expand all
35 } 36 }
36 icu::UnicodeString unicode_text( 37 icu::UnicodeString unicode_text(
37 text.data(), static_cast<int32_t>(text.length())); 38 text.data(), static_cast<int32_t>(text.length()));
38 icu::UnicodeString unicode_normalized_text; 39 icu::UnicodeString unicode_normalized_text;
39 normalizer2->normalize(unicode_text, unicode_normalized_text, status); 40 normalizer2->normalize(unicode_text, unicode_normalized_text, status);
40 if (U_FAILURE(status)) { 41 if (U_FAILURE(status)) {
41 // This should not happen. Log the error and fall back. 42 // This should not happen. Log the error and fall back.
42 LOG(ERROR) << "normalization failed: " << u_errorName(status); 43 LOG(ERROR) << "normalization failed: " << u_errorName(status);
43 return text; 44 return text;
44 } 45 }
45 return base::string16(unicode_normalized_text.getBuffer(), 46 return base::i18n::UnicodeStringToString16(unicode_normalized_text);
46 unicode_normalized_text.length());
47 } 47 }
48 48
49 } // namespace 49 } // namespace
50 50
51 TitledUrlIndex::TitledUrlIndex(std::unique_ptr<TitledUrlNodeSorter> sorter) 51 TitledUrlIndex::TitledUrlIndex(std::unique_ptr<TitledUrlNodeSorter> sorter)
52 : sorter_(std::move(sorter)) { 52 : sorter_(std::move(sorter)) {
53 } 53 }
54 54
55 TitledUrlIndex::~TitledUrlIndex() { 55 TitledUrlIndex::~TitledUrlIndex() {
56 } 56 }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // We can get here if the node has the same term more than once. For 251 // We can get here if the node has the same term more than once. For
252 // example, a node with the title 'foo foo' would end up here. 252 // example, a node with the title 'foo foo' would end up here.
253 return; 253 return;
254 } 254 }
255 i->second.erase(node); 255 i->second.erase(node);
256 if (i->second.empty()) 256 if (i->second.empty())
257 index_.erase(i); 257 index_.erase(i);
258 } 258 }
259 259
260 } // namespace bookmarks 260 } // namespace bookmarks
OLDNEW
« no previous file with comments | « components/autofill/core/browser/credit_card.cc ('k') | content/browser/android/date_time_chooser_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698