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

Unified Diff: chrome/test/chromedriver/chrome/devtools_http_client.cc

Issue 2127373006: Use base::StartWith() in more places when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, resolve conflict Created 4 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
Index: chrome/test/chromedriver/chrome/devtools_http_client.cc
diff --git a/chrome/test/chromedriver/chrome/devtools_http_client.cc b/chrome/test/chromedriver/chrome/devtools_http_client.cc
index eb83d768008398ff9b9039c3a4ed0b42f4036c96..5174512e4980e8ab8c7dbb854fbc36b914593073 100644
--- a/chrome/test/chromedriver/chrome/devtools_http_client.cc
+++ b/chrome/test/chromedriver/chrome/devtools_http_client.cc
@@ -9,6 +9,8 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/json/json_reader.h"
+#include "base/stl_util.h"
+#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
@@ -32,7 +34,8 @@ WebViewInfo::WebViewInfo(const WebViewInfo& other) = default;
WebViewInfo::~WebViewInfo() {}
bool WebViewInfo::IsFrontend() const {
- return url.find("chrome-devtools://") == 0u;
+ return base::StartsWith(url, "chrome-devtools://",
+ base::CompareCase::SENSITIVE);
}
bool WebViewInfo::IsInactiveBackgroundPage() const {
@@ -153,11 +156,12 @@ const DeviceMetrics* DevToolsHttpClient::device_metrics() {
}
bool DevToolsHttpClient::IsBrowserWindow(const WebViewInfo& view) const {
- return window_types_->find(view.type) != window_types_->end() ||
- (view.type == WebViewInfo::kOther &&
- (view.url.find("chrome-extension://") == 0 ||
- view.url == "chrome://print/" ||
- view.url == "chrome://media-router/"));
+ return ContainsKey(*window_types_, view.type) ||
+ (view.type == WebViewInfo::kOther &&
+ (base::StartsWith(view.url, "chrome-extension://",
+ base::CompareCase::SENSITIVE) ||
+ view.url == "chrome://print/" ||
+ view.url == "chrome://media-router/"));
}
Status DevToolsHttpClient::CloseFrontends(const std::string& for_client_id) {
« no previous file with comments | « chrome/test/chromedriver/chrome/chrome_desktop_impl.cc ('k') | chrome/test/ppapi/ppapi_filechooser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698