summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/android/autofill/autofill_dialog_result.cc5
-rw-r--r--chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc8
-rw-r--r--chrome/browser/ui/autofill/autofill_dialog_types.cc5
-rw-r--r--chrome/browser/ui/autofill/generated_credit_card_bubble_controller.cc13
-rw-r--r--chrome/browser/ui/elide_url.cc11
-rw-r--r--chrome/browser/ui/libgtk2ui/gtk2_ui.cc5
-rw-r--r--chrome/browser/ui/tabs/tab_strip_model_unittest.cc8
-rw-r--r--chrome/browser/ui/views/autofill/expanding_textfield.cc5
-rw-r--r--chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc6
-rw-r--r--chrome/browser/ui/webui/cookies_tree_model_util.cc8
-rw-r--r--chrome/browser/ui/webui/extensions/extension_icon_source.cc5
-rw-r--r--chrome/browser/ui/webui/net_internals/net_internals_ui.cc4
-rw-r--r--chrome/browser/ui/webui/print_preview/extension_printer_handler.cc4
-rw-r--r--chrome/browser/ui/webui/print_preview/print_preview_ui.cc4
-rw-r--r--chrome/browser/ui/webui/signin/inline_login_ui.cc4
15 files changed, 47 insertions, 48 deletions
diff --git a/chrome/browser/ui/android/autofill/autofill_dialog_result.cc b/chrome/browser/ui/android/autofill/autofill_dialog_result.cc
index d17ff4c..9d30526 100644
--- a/chrome/browser/ui/android/autofill/autofill_dialog_result.cc
+++ b/chrome/browser/ui/android/autofill/autofill_dialog_result.cc
@@ -46,10 +46,11 @@ scoped_ptr<wallet::Address> ParseJavaWalletAddress(
const base::string16 recipient_name =
FETCH_JSTRING(UTF16, env, address, ResultAddress, Name);
- std::vector<base::string16> address_lines;
const base::string16 street_address =
FETCH_JSTRING(UTF16, env, address, ResultAddress, StreetAddress);
- base::SplitString(street_address, base::char16('\n'), &address_lines);
+ std::vector<base::string16> address_lines = base::SplitString(
+ street_address, base::string16(1, '\n'),
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
const base::string16 locality_name =
FETCH_JSTRING(UTF16, env, address, ResultAddress, Locality);
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index d700e8b..326278f 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -295,11 +295,9 @@ const wallet::Address* FindDuplicateAddress(
}
bool IsCardHolderNameValidForWallet(const base::string16& name) {
- base::string16 whitespace_collapsed_name =
- base::CollapseWhitespace(name, true);
- std::vector<base::string16> split_name;
- base::SplitString(whitespace_collapsed_name, ' ', &split_name);
- return split_name.size() >= 2;
+ return base::SplitStringPiece(name, base::string16(1, ' '),
+ base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY).size() >= 2;
}
DialogSection SectionFromLocation(wallet::FormFieldError::Location location) {
diff --git a/chrome/browser/ui/autofill/autofill_dialog_types.cc b/chrome/browser/ui/autofill/autofill_dialog_types.cc
index b990097..90af148 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_types.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_types.cc
@@ -28,8 +28,9 @@ DialogNotification::DialogNotification(Type type,
display_text_(display_text),
checked_(false) {
// If there's a range separated by bars, mark that as the anchor text.
- std::vector<base::string16> pieces;
- base::SplitStringDontTrim(display_text, kRangeSeparator, &pieces);
+ std::vector<base::string16> pieces = base::SplitString(
+ display_text, base::string16(1, kRangeSeparator),
+ base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
if (pieces.size() > 1) {
size_t start = pieces[0].size();
size_t end = start + pieces[1].size();
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 405d942..1fabb5c 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;
diff --git a/chrome/browser/ui/elide_url.cc b/chrome/browser/ui/elide_url.cc
index afa6d7a..b5c7ca6 100644
--- a/chrome/browser/ui/elide_url.cc
+++ b/chrome/browser/ui/elide_url.cc
@@ -156,14 +156,14 @@ base::string16 ElideUrl(const GURL& url,
// domain is now C: - this is a nice hack for eliding to work pleasantly.
if (url.SchemeIsFile()) {
// Split the path string using ":"
- std::vector<base::string16> file_path_split;
- base::SplitString(url_path, ':', &file_path_split);
+ const base::string16 kColon(1, ':');
+ std::vector<base::string16> file_path_split = base::SplitString(
+ url_path, kColon, base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (file_path_split.size() > 1) { // File is of type "file:///C:/.."
url_host.clear();
url_domain.clear();
url_subdomain.clear();
- const base::string16 kColon = UTF8ToUTF16(":");
url_host = url_domain = file_path_split.at(0).substr(1) + kColon;
url_path_query_etc = url_path = file_path_split.at(1);
}
@@ -201,8 +201,9 @@ base::string16 ElideUrl(const GURL& url,
}
// Parse url_path using '/'.
- std::vector<base::string16> url_path_elements;
- base::SplitString(url_path, kForwardSlash, &url_path_elements);
+ std::vector<base::string16> url_path_elements = base::SplitString(
+ url_path, base::string16(1, kForwardSlash),
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
// Get filename - note that for a path ending with /
// such as www.google.com/intl/ads/, the file name is ads/.
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
index 698af98..82cff62 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -1390,8 +1390,9 @@ void Gtk2UI::UpdateDefaultFont(const PangoFontDescription* desc) {
// Use gfx::FontRenderParams to select a family and determine the rendering
// settings.
gfx::FontRenderParamsQuery query;
- base::SplitString(pango_font_description_get_family(desc), ',',
- &query.families);
+ query.families = base::SplitString(pango_font_description_get_family(desc),
+ ",", base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_ALL);
if (pango_font_description_get_size_is_absolute(desc)) {
// If the size is absolute, it's specified in Pango units. There are
diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
index cc5323f..dba7d9f 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
@@ -246,11 +246,11 @@ class TabStripModelTest : public ChromeRenderViewHostTestHarness {
model->SetTabPinned(i, true);
ui::ListSelectionModel selection_model;
- std::vector<std::string> selection;
- base::SplitStringAlongWhitespace(selected_tabs, &selection);
- for (size_t i = 0; i < selection.size(); ++i) {
+ for (const base::StringPiece& sel : base::SplitStringPiece(
+ selected_tabs, base::kWhitespaceASCII,
+ base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
int value;
- ASSERT_TRUE(base::StringToInt(selection[i], &value));
+ ASSERT_TRUE(base::StringToInt(sel, &value));
selection_model.AddIndexToSelection(value);
}
selection_model.set_active(selection_model.selected_indices()[0]);
diff --git a/chrome/browser/ui/views/autofill/expanding_textfield.cc b/chrome/browser/ui/views/autofill/expanding_textfield.cc
index 147742b..c7957d5 100644
--- a/chrome/browser/ui/views/autofill/expanding_textfield.cc
+++ b/chrome/browser/ui/views/autofill/expanding_textfield.cc
@@ -50,8 +50,9 @@ ExpandingTextfield::~ExpandingTextfield() {}
void ExpandingTextfield::SetText(const base::string16& text) {
textfields_.front()->SetText(text);
- std::vector<base::string16> strings;
- base::SplitStringDontTrim(text, '\n', &strings);
+ std::vector<base::string16> strings = base::SplitString(
+ text, base::string16(1, '\n'),
+ base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);
size_t i = 0;
for (std::list<DecoratedTextfield*>::iterator iter = textfields_.begin();
diff --git a/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc
index 51a1634..83d8663 100644
--- a/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler.cc
@@ -149,15 +149,13 @@ void TermsOfServiceScreenHandler::OnLanguageChangedCallback(
void TermsOfServiceScreenHandler::DoShow() {
// Determine the user's most preferred input method.
- std::vector<std::string> input_methods;
- base::SplitString(
+ std::vector<std::string> input_methods = base::SplitString(
ProfileHelper::Get()
->GetProfileByUserUnsafe(
user_manager::UserManager::Get()->GetActiveUser())
->GetPrefs()
->GetString(prefs::kLanguagePreloadEngines),
- ',',
- &input_methods);
+ ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (!input_methods.empty()) {
// If the user has a preferred input method, enable it and switch to it.
diff --git a/chrome/browser/ui/webui/cookies_tree_model_util.cc b/chrome/browser/ui/webui/cookies_tree_model_util.cc
index 72bb7a9..3a15aca 100644
--- a/chrome/browser/ui/webui/cookies_tree_model_util.cc
+++ b/chrome/browser/ui/webui/cookies_tree_model_util.cc
@@ -317,17 +317,15 @@ void CookiesTreeModelUtil::GetChildNodeList(const CookieTreeNode* parent,
const CookieTreeNode* CookiesTreeModelUtil::GetTreeNodeFromPath(
const CookieTreeNode* root,
const std::string& path) {
- std::vector<std::string> node_ids;
- base::SplitString(path, ',', &node_ids);
-
const CookieTreeNode* child = NULL;
const CookieTreeNode* parent = root;
int child_index = -1;
// Validate the tree path and get the node pointer.
- for (size_t i = 0; i < node_ids.size(); ++i) {
+ for (const base::StringPiece& cur_node : base::SplitStringPiece(
+ path, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
int32 node_id = 0;
- if (!base::StringToInt(node_ids[i], &node_id))
+ if (!base::StringToInt(cur_node, &node_id))
break;
child = id_map_.Lookup(node_id);
diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chrome/browser/ui/webui/extensions/extension_icon_source.cc
index aa4fc2e..2b40ccd 100644
--- a/chrome/browser/ui/webui/extensions/extension_icon_source.cc
+++ b/chrome/browser/ui/webui/extensions/extension_icon_source.cc
@@ -278,9 +278,8 @@ bool ExtensionIconSource::ParseData(
const content::URLDataSource::GotDataCallback& callback) {
// Extract the parameters from the path by lower casing and splitting.
std::string path_lower = base::StringToLowerASCII(path);
- std::vector<std::string> path_parts;
-
- base::SplitString(path_lower, '/', &path_parts);
+ std::vector<std::string> path_parts = base::SplitString(
+ path_lower, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (path_lower.empty() || path_parts.size() < 3)
return false;
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
index d5f023e..145294a 100644
--- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
+++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -130,8 +130,8 @@ std::string HashesToBase64String(const net::HashValueVector& hashes) {
bool Base64StringToHashes(const std::string& hashes_str,
net::HashValueVector* hashes) {
hashes->clear();
- std::vector<std::string> vector_hash_str;
- base::SplitString(hashes_str, ',', &vector_hash_str);
+ std::vector<std::string> vector_hash_str = base::SplitString(
+ hashes_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
for (size_t i = 0; i != vector_hash_str.size(); ++i) {
std::string hash_str;
diff --git a/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc b/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
index 8ff25c6..8866763 100644
--- a/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
@@ -103,8 +103,8 @@ std::string GenerateProvisionalUsbPrinterId(const Extension* extension,
bool ParseProvisionalUsbPrinterId(const std::string& printer_id,
std::string* extension_id,
std::string* device_guid) {
- std::vector<std::string> components;
- base::SplitString(printer_id, ':', &components);
+ std::vector<std::string> components = base::SplitString(
+ printer_id, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (components.size() != 3)
return false;
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
index 6cd974b..ad53e9a 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -129,8 +129,8 @@ bool HandleRequestCallback(
// Print Preview data.
scoped_refptr<base::RefCountedBytes> data;
- std::vector<std::string> url_substr;
- base::SplitString(path, '/', &url_substr);
+ std::vector<std::string> url_substr = base::SplitString(
+ path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
int preview_ui_id = -1;
int page_index = 0;
if (url_substr.size() == 3 &&
diff --git a/chrome/browser/ui/webui/signin/inline_login_ui.cc b/chrome/browser/ui/webui/signin/inline_login_ui.cc
index 843bae5..98f736a 100644
--- a/chrome/browser/ui/webui/signin/inline_login_ui.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_ui.cc
@@ -34,8 +34,8 @@ namespace {
bool HandleTestFileRequestCallback(
const std::string& path,
const content::WebUIDataSource::GotDataCallback& callback) {
- std::vector<std::string> url_substr;
- base::SplitString(path, '/', &url_substr);
+ std::vector<std::string> url_substr = base::SplitString(
+ path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
if (url_substr.size() != 2 || url_substr[0] != "test")
return false;