diff options
author | brettw <brettw@chromium.org> | 2015-06-29 15:53:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-29 22:54:47 +0000 |
commit | b45192d3bd4592b3703dd8a025d238688ba162cd (patch) | |
tree | 6d08a16c7268c4ff2894dacdcd866f93f0719203 /cloud_print/service | |
parent | f59ef141c9c00f1b60071f91636836ec506ebd95 (diff) | |
download | chromium_src-b45192d3bd4592b3703dd8a025d238688ba162cd.zip chromium_src-b45192d3bd4592b3703dd8a025d238688ba162cd.tar.gz chromium_src-b45192d3bd4592b3703dd8a025d238688ba162cd.tar.bz2 |
Replace more Tokenize calls with base::SplitString
This also replaces a few StartsWithASCII calls with the new StartsWith in cases where the deprecated ASCII version appeared in code I was changing.
NOPRESUBMIT=true
(due to weird include ordering of _kde.cc file which a comment in the file says is required)
Review URL: https://codereview.chromium.org/1202963003
Cr-Commit-Position: refs/heads/master@{#336670}
Diffstat (limited to 'cloud_print/service')
-rw-r--r-- | cloud_print/service/service_state.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cloud_print/service/service_state.cc b/cloud_print/service/service_state.cc index 80dbd8c..070d4ef7 100644 --- a/cloud_print/service/service_state.cc +++ b/cloud_print/service/service_state.cc @@ -8,6 +8,7 @@ #include "base/json/json_writer.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" +#include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "net/base/elements_upload_data_stream.h" @@ -196,11 +197,13 @@ std::string ServiceState::LoginToGoogle(const std::string& service, base::MessageLoop::current()->Run(); const char kAuthStart[] = "Auth="; - std::vector<std::string> lines; - Tokenize(fetcher_delegate.data(), "\r\n", &lines); - for (size_t i = 0; i < lines.size(); ++i) { - if (base::StartsWithASCII(lines[i], kAuthStart, false)) - return lines[i].substr(arraysize(kAuthStart) - 1); + for (const base::StringPiece& line : + base::SplitStringPiece(fetcher_delegate.data(), "\r\n", + base::KEEP_WHITESPACE, + base::SPLIT_WANT_NONEMPTY)) { + if (base::StartsWith(line, kAuthStart, + base::CompareCase::INSENSITIVE_ASCII)) + return line.substr(arraysize(kAuthStart) - 1).as_string(); } return std::string(); |