diff options
author | brettw <brettw@chromium.org> | 2015-08-06 17:11:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-07 00:12:13 +0000 |
commit | 0aa7c64253cca8b636d52d1d01d94f96ab9c13fa (patch) | |
tree | 29b825a84dffc4d7310c69b22da0cfd7b1228277 /ash | |
parent | 924597ba8b5def174aebdc96368545f51df1bee2 (diff) | |
download | chromium_src-0aa7c64253cca8b636d52d1d01d94f96ab9c13fa.zip chromium_src-0aa7c64253cca8b636d52d1d01d94f96ab9c13fa.tar.gz chromium_src-0aa7c64253cca8b636d52d1d01d94f96ab9c13fa.tar.bz2 |
Update SplitString calls to new form
Uses the new form for most (but not quite all) of the remaining users of the old form.
Changes media mime util codec list parsing to expect no result from the string "," rather than two empty strings. The old SplitString call had a special case where if the input was empty, it would return empty, but if it had one split character, it would return two empty strings as results.
The new one lets you choose but the options are either (1) empty string -> one empty string and "," -> two empty strings, or (2) map both to no results for when you don't want empty results. I'm pretty sure media codec parsing actually wants the latter behavior, so I updated the call to discard empty results and MimeUtilTest.ParseCodecString is updated.
Review URL: https://codereview.chromium.org/1272823003
Cr-Commit-Position: refs/heads/master@{#342238}
Diffstat (limited to 'ash')
-rw-r--r-- | ash/display/display_manager.cc | 8 | ||||
-rw-r--r-- | ash/test/display_manager_test_api.cc | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc index dba2e0a..6c0fca1 100644 --- a/ash/display/display_manager.cc +++ b/ash/display/display_manager.cc @@ -171,11 +171,9 @@ bool DisplayManager::InitFromCommandLine() { return false; const string size_str = command_line->GetSwitchValueASCII(switches::kAshHostWindowBounds); - vector<string> parts; - base::SplitString(size_str, ',', &parts); - for (vector<string>::const_iterator iter = parts.begin(); - iter != parts.end(); ++iter) { - info_list.push_back(DisplayInfo::CreateFromSpec(*iter)); + for (const std::string& part : base::SplitString( + size_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { + info_list.push_back(DisplayInfo::CreateFromSpec(part)); info_list.back().set_native(true); } MaybeInitInternalDisplay(&info_list[0]); diff --git a/ash/test/display_manager_test_api.cc b/ash/test/display_manager_test_api.cc index 77d88ec..9bad891 100644 --- a/ash/test/display_manager_test_api.cc +++ b/ash/test/display_manager_test_api.cc @@ -34,8 +34,8 @@ std::vector<DisplayInfo> CreateDisplayInfoListFromString( const std::string specs, DisplayManager* display_manager) { std::vector<DisplayInfo> display_info_list; - std::vector<std::string> parts; - base::SplitString(specs, ',', &parts); + std::vector<std::string> parts = base::SplitString( + specs, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); size_t index = 0; DisplayManager::DisplayList list = |