summaryrefslogtreecommitdiffstats
path: root/webkit/port
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-19 21:16:32 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-19 21:16:32 +0000
commit28461252ccd08f81ba91e89428fce03f9d66530a (patch)
tree34b782a4665736d8cc2a11f0806f13aa4c765919 /webkit/port
parent0fbdcc2edbc4a1d4a81e4135183b09382e4cbf45 (diff)
downloadchromium_src-28461252ccd08f81ba91e89428fce03f9d66530a.zip
chromium_src-28461252ccd08f81ba91e89428fce03f9d66530a.tar.gz
chromium_src-28461252ccd08f81ba91e89428fce03f9d66530a.tar.bz2
Remove dependency on base/string_util.h, and rename some methods to better
match WebKit style. R=brettw Review URL: http://codereview.chromium.org/15058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7316 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r--webkit/port/platform/GKURL.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/webkit/port/platform/GKURL.cpp b/webkit/port/platform/GKURL.cpp
index 045d06d..1f215cb 100644
--- a/webkit/port/platform/GKURL.cpp
+++ b/webkit/port/platform/GKURL.cpp
@@ -1,5 +1,4 @@
-// Copyright (c) 2008, Google Inc.
-// All rights reserved.
+// Copyright (c) 2008, Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
@@ -37,7 +36,6 @@
#if USE(GOOGLEURL)
#undef LOG
-#include "base/string_util.h"
#include "googleurl/src/url_canon_internal.h"
#include "googleurl/src/url_util.h"
@@ -71,7 +69,7 @@ private:
// Note that this function must be named differently than the one in KURL.cpp
// since our unit tests evilly include both files, and their local definition
// will be ambiguous.
-inline void AssertProtocolIsGood(const char* protocol)
+inline void assertProtocolIsGood(const char* protocol)
{
#ifndef NDEBUG
const char* p = protocol;
@@ -92,11 +90,20 @@ inline const url_parse::UTF16Char* CharactersOrEmpty(const String& str) {
&zero;
}
-inline bool IsUnicodeEncoding(const TextEncoding* encoding)
+inline bool isUnicodeEncoding(const TextEncoding* encoding)
{
return encoding->encodingForFormSubmission() == UTF8Encoding();
}
+bool lowerCaseEqualsASCII(const char* begin, const char* end, const char* str)
+{
+ while (begin != end && *str) {
+ if (toASCIILower(*begin++) != *str++)
+ return false;
+ }
+ return true;
+}
+
} // namespace
// GoogleURLPrivate ------------------------------------------------------------
@@ -165,7 +172,7 @@ void GoogleURLPrivate::init(const KURL& base, const char* rel, int rel_len,
// just a wrapper around a reference.
WebCoreCharsetConverter charset_converter_object(query_encoding);
WebCoreCharsetConverter* charset_converter =
- (!query_encoding || IsUnicodeEncoding(query_encoding)) ? 0 :
+ (!query_encoding || isUnicodeEncoding(query_encoding)) ? 0 :
&charset_converter_object;
url_canon::RawCanonOutputT<char> output;
@@ -201,7 +208,7 @@ void GoogleURLPrivate::init(const KURL& base, const UChar* rel, int rel_len,
{
WebCoreCharsetConverter charset_converter_object(query_encoding);
WebCoreCharsetConverter* charset_converter =
- (!query_encoding || IsUnicodeEncoding(query_encoding)) ? 0 :
+ (!query_encoding || isUnicodeEncoding(query_encoding)) ? 0 :
&charset_converter_object;
url_canon::RawCanonOutputT<char> output;
@@ -774,10 +781,10 @@ String decodeURLEscapeSequences(const String& str, const TextEncoding& encoding)
bool KURL::protocolIs(const char* protocol) const
{
- AssertProtocolIsGood(protocol);
+ assertProtocolIsGood(protocol);
if (m_url.m_parsed.scheme.len <= 0)
return protocol == NULL;
- return LowerCaseEqualsASCII(
+ return lowerCaseEqualsASCII(
m_url.utf8String().data() + m_url.m_parsed.scheme.begin,
m_url.utf8String().data() + m_url.m_parsed.scheme.end(),
protocol);
@@ -911,7 +918,7 @@ bool protocolIs(const String& url, const char* protocol)
#endif
{
// Do the comparison without making a new string object.
- AssertProtocolIsGood(protocol);
+ assertProtocolIsGood(protocol);
for (int i = 0; ; ++i) {
if (!protocol[i])
return url[i] == ':';