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

Unified Diff: ash/display/display_info.cc

Issue 1197243004: Replace some Tokenize calls with SplitString. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android Created 5 years, 6 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 | « android_webview/browser/aw_media_client_android.cc ('k') | base/process/process_iterator_freebsd.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_info.cc
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc
index e58b51a0e6ac4ca9663c91b404fa48253984fb88..3e088853fc4e279efa2ac0077abc170838abeece 100644
--- a/ash/display/display_info.cc
+++ b/ash/display/display_info.cc
@@ -9,6 +9,7 @@
#include "ash/display/display_info.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "ui/gfx/display.h"
@@ -129,20 +130,22 @@ DisplayInfo DisplayInfo::CreateFromSpecWithID(const std::string& spec,
std::string main_spec = spec;
float ui_scale = 1.0f;
- std::vector<std::string> parts;
- if (Tokenize(main_spec, "@", &parts) == 2) {
+ std::vector<std::string> parts = base::SplitString(
+ main_spec, "@", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
+ if (parts.size() == 2) {
double scale_in_double = 0;
if (base::StringToDouble(parts[1], &scale_in_double))
ui_scale = scale_in_double;
main_spec = parts[0];
}
- size_t count = Tokenize(main_spec, "/", &parts);
+ parts = base::SplitString(main_spec, "/", base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY);
gfx::Display::Rotation rotation(gfx::Display::ROTATE_0);
bool has_overscan = false;
- if (count) {
+ if (!parts.empty()) {
main_spec = parts[0];
- if (count >= 2) {
+ if (parts.size() >= 2) {
std::string options = parts[1];
for (size_t i = 0; i < options.size(); ++i) {
char c = options[i];
@@ -172,18 +175,21 @@ DisplayInfo DisplayInfo::CreateFromSpecWithID(const std::string& spec,
}
std::vector<DisplayMode> display_modes;
- if (Tokenize(main_spec, "#", &parts) == 2) {
+ parts = base::SplitString(main_spec, "#", base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY);
+ if (parts.size() == 2) {
size_t native_mode = 0;
int largest_area = -1;
float highest_refresh_rate = -1.0f;
main_spec = parts[0];
std::string resolution_list = parts[1];
- count = Tokenize(resolution_list, "|", &parts);
- for (size_t i = 0; i < count; ++i) {
+ parts = base::SplitString(resolution_list, "|", base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY);
+ for (size_t i = 0; i < parts.size(); ++i) {
DisplayMode mode;
gfx::Rect mode_bounds;
- std::vector<std::string> resolution;
- Tokenize(parts[i], "%", &resolution);
+ std::vector<std::string> resolution = base::SplitString(
+ parts[i], "%", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (GetDisplayBounds(
resolution[0], &mode_bounds, &mode.device_scale_factor)) {
mode.size = mode_bounds.size();
« no previous file with comments | « android_webview/browser/aw_media_client_android.cc ('k') | base/process/process_iterator_freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698