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

Unified Diff: chrome/browser/ui/autofill/generated_credit_card_bubble_controller.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_types.cc ('k') | chrome/browser/ui/elide_url.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/generated_credit_card_bubble_controller.cc
diff --git a/chrome/browser/ui/autofill/generated_credit_card_bubble_controller.cc b/chrome/browser/ui/autofill/generated_credit_card_bubble_controller.cc
index 405d942d7a334cd6ea24a7a5d0e8bbc43445f2e3..1fabb5cd9ed54819aa651ff81be445f936d9be8a 100644
--- a/chrome/browser/ui/autofill/generated_credit_card_bubble_controller.cc
+++ b/chrome/browser/ui/autofill/generated_credit_card_bubble_controller.cc
@@ -193,16 +193,17 @@ void GeneratedCreditCardBubbleController::SetupAndShow(
// Split the full text on '|' to highlight certain parts. For example, "sly"
// and "jumped" would be bolded in "The |sly| fox |jumped| over the lazy dog".
- std::vector<base::string16> pieces;
- base::SplitStringDontTrim(to_split, kRangeSeparator, &pieces);
+ std::vector<base::string16> pieces = base::SplitString(
+ to_split, base::string16(1, kRangeSeparator),
+ base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
while (!pieces.empty()) {
base::string16 piece = pieces.front();
- // Every second piece should be bolded. Because |base::SplitString*()|
- // leaves an empty "" even if '|' is the first character, this is guaranteed
- // to work for "|highlighting| starts here". Ignore empty pieces because
- // there's nothing to highlight.
+ // Every second piece should be bolded. Because SPLIT_WANT_ALL makes
+ // SplitString leave an empty "" even if '|' is the first character, this
+ // is guaranteed to work for "|highlighting| starts here". Ignore empty
+ // pieces because there's nothing to highlight.
if (!piece.empty() && pieces.size() % 2 == 0) {
const size_t start = contents_text_.size();
TextRange bold_text;
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_types.cc ('k') | chrome/browser/ui/elide_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698