diff options
author | brettw <brettw@chromium.org> | 2015-06-11 18:57:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-12 01:59:01 +0000 |
commit | 44ce0ec5b05184c4e33d597d4e5a32d9f38b15c2 (patch) | |
tree | 30eccdbbe72fb47810535fe56e0a8313be2db4b2 /extensions/browser | |
parent | 57ca2cd795596162f06a6aa67367d8ce0d9ded52 (diff) | |
download | chromium_src-44ce0ec5b05184c4e33d597d4e5a32d9f38b15c2.zip chromium_src-44ce0ec5b05184c4e33d597d4e5a32d9f38b15c2.tar.gz chromium_src-44ce0ec5b05184c4e33d597d4e5a32d9f38b15c2.tar.bz2 |
Move StartsWith[ASCII] to base namespace.
NOPRESUBMIT=true
(no presubmit due to removing base:: from a ScopedAllowIO)
Review URL: https://codereview.chromium.org/1172183002
Cr-Commit-Position: refs/heads/master@{#334108}
Diffstat (limited to 'extensions/browser')
7 files changed, 17 insertions, 16 deletions
diff --git a/extensions/browser/api/cast_channel/logger.cc b/extensions/browser/api/cast_channel/logger.cc index 9390210..38d8e61 100644 --- a/extensions/browser/api/cast_channel/logger.cc +++ b/extensions/browser/api/cast_channel/logger.cc @@ -251,7 +251,7 @@ void Logger::LogSocketEventForMessage(int channel_id, DCHECK(thread_checker_.CalledOnValidThread()); SocketEvent event = CreateEvent(event_type); - if (StartsWithASCII(message_namespace, kInternalNamespacePrefix, false)) + if (base::StartsWithASCII(message_namespace, kInternalNamespacePrefix, false)) event.set_message_namespace(message_namespace); event.set_details(details); diff --git a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc index 49680ad..c428af9 100644 --- a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc +++ b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc @@ -422,12 +422,12 @@ bool HeaderMatcher::StringMatchTest::Matches( const std::string& str) const { switch (type_) { case kPrefix: - return StartsWithASCII(str, data_, case_sensitive_); + return base::StartsWithASCII(str, data_, case_sensitive_); case kSuffix: return EndsWith(str, data_, case_sensitive_); case kEquals: return str.size() == data_.size() && - StartsWithASCII(str, data_, case_sensitive_); + base::StartsWithASCII(str, data_, case_sensitive_); case kContains: if (!case_sensitive_) { return std::search(str.begin(), str.end(), data_.begin(), data_.end(), diff --git a/extensions/browser/api/web_request/web_request_api.cc b/extensions/browser/api/web_request/web_request_api.cc index 836cae3..082e3ef 100644 --- a/extensions/browser/api/web_request/web_request_api.cc +++ b/extensions/browser/api/web_request/web_request_api.cc @@ -137,8 +137,8 @@ int GetFrameId(bool is_main_frame, int frame_id) { bool IsWebRequestEvent(const std::string& event_name) { std::string web_request_event_name(event_name); - if (StartsWithASCII( - web_request_event_name, webview::kWebViewEventPrefix, true)) { + if (base::StartsWithASCII(web_request_event_name, + webview::kWebViewEventPrefix, true)) { web_request_event_name.replace( 0, strlen(webview::kWebViewEventPrefix), kWebRequestEventPrefix); } diff --git a/extensions/browser/api/web_request/web_request_permissions.cc b/extensions/browser/api/web_request/web_request_permissions.cc index ea46307..19d85b8 100644 --- a/extensions/browser/api/web_request/web_request_permissions.cc +++ b/extensions/browser/api/web_request/web_request_permissions.cc @@ -35,7 +35,7 @@ bool IsSensitiveURL(const GURL& url) { // This protects requests to several internal services such as sync, // extension update pings, captive portal detection, fraudulent certificate // reporting, autofill and others. - if (StartsWithASCII(host, kClient, true)) { + if (base::StartsWithASCII(host, kClient, true)) { bool match = true; for (std::string::const_iterator i = host.begin() + strlen(kClient), end = host.end() - strlen(kGoogleCom); i != end; ++i) { @@ -48,11 +48,12 @@ bool IsSensitiveURL(const GURL& url) { } // This protects requests to safe browsing, link doctor, and possibly // others. - sensitive_chrome_url = sensitive_chrome_url || + sensitive_chrome_url = + sensitive_chrome_url || EndsWith(url.host(), ".clients.google.com", true) || url.host() == "sb-ssl.google.com" || - (url.host() == "chrome.google.com" && - StartsWithASCII(url.path(), "/webstore", true)); + (url.host() == "chrome.google.com" && + base::StartsWithASCII(url.path(), "/webstore", true)); } GURL::Replacements replacements; replacements.ClearQuery(); diff --git a/extensions/browser/guest_view/web_view/web_view_apitest.cc b/extensions/browser/guest_view/web_view/web_view_apitest.cc index 369bc73..26e91b1 100644 --- a/extensions/browser/guest_view/web_view/web_view_apitest.cc +++ b/extensions/browser/guest_view/web_view/web_view_apitest.cc @@ -58,13 +58,13 @@ static scoped_ptr<net::test_server::HttpResponse> UserAgentResponseHandler( const std::string& path, const GURL& redirect_target, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(path, request.relative_url, true)) + if (!base::StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(); std::map<std::string, std::string>::const_iterator it = request.headers.find("User-Agent"); EXPECT_TRUE(it != request.headers.end()); - if (!StartsWithASCII("foobar", it->second, true)) + if (!base::StartsWithASCII("foobar", it->second, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( @@ -103,7 +103,7 @@ scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( const std::string& path, const GURL& redirect_target, const net::test_server::HttpRequest& request) { - if (!StartsWithASCII(path, request.relative_url, true)) + if (!base::StartsWithASCII(path, request.relative_url, true)) return scoped_ptr<net::test_server::HttpResponse>(); scoped_ptr<net::test_server::BasicHttpResponse> http_response( @@ -117,7 +117,7 @@ scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( scoped_ptr<net::test_server::HttpResponse> EmptyResponseHandler( const std::string& path, const net::test_server::HttpRequest& request) { - if (StartsWithASCII(path, request.relative_url, true)) { + if (base::StartsWithASCII(path, request.relative_url, true)) { return scoped_ptr<net::test_server::HttpResponse>(new EmptyHttpResponse); } diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc index 73e5daa..add40d7 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.cc +++ b/extensions/browser/guest_view/web_view/web_view_guest.cc @@ -147,11 +147,11 @@ void ParsePartitionParam(const base::DictionaryValue& create_params, return; } - // Since the "persist:" prefix is in ASCII, StartsWith will work fine on + // Since the "persist:" prefix is in ASCII, base::StartsWith will work fine on // UTF-8 encoded |partition_id|. If the prefix is a match, we can safely // remove the prefix without splicing in the middle of a multi-byte codepoint. // We can use the rest of the string as UTF-8 encoded one. - if (StartsWithASCII(partition_str, "persist:", true)) { + if (base::StartsWithASCII(partition_str, "persist:", true)) { size_t index = partition_str.find(":"); CHECK(index != std::string::npos); // It is safe to do index + 1, since we tested for the full prefix above. diff --git a/extensions/browser/warning_set.cc b/extensions/browser/warning_set.cc index 54c1c8b..5cd7190 100644 --- a/extensions/browser/warning_set.cc +++ b/extensions/browser/warning_set.cc @@ -195,7 +195,7 @@ std::string Warning::GetLocalizedMessage(const ExtensionSet* extensions) const { std::vector<base::string16> final_parameters; for (size_t i = 0; i < message_parameters_.size(); ++i) { std::string message = message_parameters_[i]; - if (StartsWithASCII(message, kTranslate, true)) { + if (base::StartsWithASCII(message, kTranslate, true)) { std::string extension_id = message.substr(sizeof(kTranslate) - 1); const extensions::Extension* extension = extensions->GetByID(extension_id); |