blob: 6dbe5f523fc95093cee57b9b15dba938d09be8ea [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SRC_LIB_URL_URL_UTIL_INTERNAL_H_
#define SRC_LIB_URL_URL_UTIL_INTERNAL_H_
#include <string>
#include "src/lib/fxl/strings/ascii.h"
#include "src/lib/fxl/strings/string_view.h"
#include "src/lib/url/third_party/mozilla/url_parse.h"
namespace url {
// Given a string and a range inside the string, compares it to the given
// lower-case |compare_to| buffer.
bool CompareSchemeComponent(const char* spec, const Component& component, const char* compare_to);
static inline bool LowerCaseEqualsASCII(fxl::StringView str, fxl::StringView lowercase_ascii) {
if (str.size() != lowercase_ascii.size())
return false;
for (size_t i = 0; i < str.size(); i++) {
if (fxl::ToLowerASCII(str[i]) != lowercase_ascii[i])
return false;
}
return true;
}
} // namespace url
#endif // SRC_LIB_URL_URL_UTIL_INTERNAL_H_