diff options
author | sungmann.cho@navercorp.com <sungmann.cho@navercorp.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-07 15:31:19 +0000 |
---|---|---|
committer | sungmann.cho@navercorp.com <sungmann.cho@navercorp.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-07 15:31:19 +0000 |
commit | e8ca69c873f105a8c7778476e12f0a24ee3ba4d7 (patch) | |
tree | 00c728d6dde60d70e4b63aaadf3b6763b3d0e6ec | |
parent | af45603ceec5270899b4f7518a219715c58fbcd7 (diff) | |
download | chromium_src-e8ca69c873f105a8c7778476e12f0a24ee3ba4d7.zip chromium_src-e8ca69c873f105a8c7778476e12f0a24ee3ba4d7.tar.gz chromium_src-e8ca69c873f105a8c7778476e12f0a24ee3ba4d7.tar.bz2 |
Move some content url constants to /url.
This CL moves the content::kHttpScheme and content::kHttpsScheme to /url.
This is a follow up to https://codereview.chromium.org/25533005.
BUG=306258
TEST=compile
Review URL: https://codereview.chromium.org/254763005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268782 0039d316-1c4b-4281-b951-d872f2087c98
61 files changed, 168 insertions, 136 deletions
diff --git a/android_webview/renderer/aw_content_renderer_client.cc b/android_webview/renderer/aw_content_renderer_client.cc index 87a855f..400d009c9 100644 --- a/android_webview/renderer/aw_content_renderer_client.cc +++ b/android_webview/renderer/aw_content_renderer_client.cc @@ -96,8 +96,8 @@ bool AwContentRendererClient::HandleNavigation( // For HTTP schemes, only top-level navigations can be overridden. Similarly, // WebView Classic lets app override only top level about:blank navigations. // So we filter out non-top about:blank navigations here. - if (frame->parent() && (gurl.SchemeIs(content::kHttpScheme) || - gurl.SchemeIs(content::kHttpsScheme) || + if (frame->parent() && (gurl.SchemeIs(url::kHttpScheme) || + gurl.SchemeIs(url::kHttpsScheme) || gurl.SchemeIs(content::kAboutScheme))) return false; diff --git a/chrome/browser/autocomplete/autocomplete_input.cc b/chrome/browser/autocomplete/autocomplete_input.cc index 87867cc..d81e728 100644 --- a/chrome/browser/autocomplete/autocomplete_input.cc +++ b/chrome/browser/autocomplete/autocomplete_input.cc @@ -175,8 +175,8 @@ AutocompleteInput::Type AutocompleteInput::Parse( // (e.g. "ftp" or "view-source") but I'll wait to spend the effort on that // until I run into some cases that really need it. if (parts->scheme.is_nonempty() && - !LowerCaseEqualsASCII(parsed_scheme, content::kHttpScheme) && - !LowerCaseEqualsASCII(parsed_scheme, content::kHttpsScheme)) { + !LowerCaseEqualsASCII(parsed_scheme, url::kHttpScheme) && + !LowerCaseEqualsASCII(parsed_scheme, url::kHttpsScheme)) { // See if we know how to handle the URL internally. There are some schemes // that we convert to other things before they reach the renderer or else // the renderer handles internally without reaching the net::URLRequest @@ -213,7 +213,7 @@ AutocompleteInput::Type AutocompleteInput::Parse( // We don't know about this scheme. It might be that the user typed a // URL of the form "username:password@foo.com". const base::string16 http_scheme_prefix = - base::ASCIIToUTF16(std::string(content::kHttpScheme) + + base::ASCIIToUTF16(std::string(url::kHttpScheme) + content::kStandardSchemeSeparator); url::Parsed http_parts; base::string16 http_scheme; @@ -221,7 +221,7 @@ AutocompleteInput::Type AutocompleteInput::Parse( Type http_type = Parse(http_scheme_prefix + text, desired_tld, &http_parts, &http_scheme, &http_canonicalized_url); - DCHECK_EQ(std::string(content::kHttpScheme), + DCHECK_EQ(std::string(url::kHttpScheme), base::UTF16ToUTF8(http_scheme)); if ((http_type == URL) && http_parts.username.is_nonempty() && @@ -504,7 +504,7 @@ bool AutocompleteInput::HasHTTPScheme(const base::string16& input) { &scheme)) { utf8_input.erase(0, scheme.end() + 1); } - return url::FindAndCompareScheme(utf8_input, content::kHttpScheme, NULL); + return url::FindAndCompareScheme(utf8_input, url::kHttpScheme, NULL); } void AutocompleteInput::UpdateText(const base::string16& text, diff --git a/chrome/browser/autocomplete/autocomplete_match.cc b/chrome/browser/autocomplete/autocomplete_match.cc index f13669e..1aa2c36cc 100644 --- a/chrome/browser/autocomplete/autocomplete_match.cc +++ b/chrome/browser/autocomplete/autocomplete_match.cc @@ -376,9 +376,9 @@ void AutocompleteMatch::ComputeStrippedDestinationURL(Profile* profile) { } // Replace https protocol with http protocol. - if (stripped_destination_url.SchemeIs(content::kHttpsScheme)) { - replacements.SetScheme(content::kHttpScheme, - url::Component(0, strlen(content::kHttpScheme))); + if (stripped_destination_url.SchemeIs(url::kHttpsScheme)) { + replacements.SetScheme(url::kHttpScheme, + url::Component(0, strlen(url::kHttpScheme))); needs_replacement = true; } diff --git a/chrome/browser/autocomplete/autocomplete_provider.cc b/chrome/browser/autocomplete/autocomplete_provider.cc index d2ef91d..963a1db 100644 --- a/chrome/browser/autocomplete/autocomplete_provider.cc +++ b/chrome/browser/autocomplete/autocomplete_provider.cc @@ -210,11 +210,11 @@ size_t AutocompleteProvider::TrimHttpPrefix(base::string16* url) { if (!AutocompleteInput::HasHTTPScheme(*url)) return 0; size_t scheme_pos = - url->find(base::ASCIIToUTF16(content::kHttpScheme) + base::char16(':')); + url->find(base::ASCIIToUTF16(url::kHttpScheme) + base::char16(':')); DCHECK_NE(base::string16::npos, scheme_pos); // Erase scheme plus up to two slashes. - size_t prefix_end = scheme_pos + strlen(content::kHttpScheme) + 1; + size_t prefix_end = scheme_pos + strlen(url::kHttpScheme) + 1; const size_t after_slashes = std::min(url->length(), prefix_end + 2); while ((prefix_end < after_slashes) && ((*url)[prefix_end] == '/')) ++prefix_end; diff --git a/chrome/browser/autocomplete/base_search_provider.cc b/chrome/browser/autocomplete/base_search_provider.cc index 7db7eb6..26978fd 100644 --- a/chrome/browser/autocomplete/base_search_provider.cc +++ b/chrome/browser/autocomplete/base_search_provider.cc @@ -542,7 +542,7 @@ bool BaseSearchProvider::ZeroSuggestEnabled( // Make sure we are sending the suggest request through HTTPS to prevent // exposing the current page URL or personalized results without encryption. - if (!suggest_url.SchemeIs(content::kHttpsScheme)) + if (!suggest_url.SchemeIs(url::kHttpsScheme)) return false; // Don't show zero suggest on the NTP. @@ -589,8 +589,8 @@ bool BaseSearchProvider::CanSendURL( // Only allow HTTP URLs or HTTPS URLs for the same domain as the search // provider. - if ((current_page_url.scheme() != content::kHttpScheme) && - ((current_page_url.scheme() != content::kHttpsScheme) || + if ((current_page_url.scheme() != url::kHttpScheme) && + ((current_page_url.scheme() != url::kHttpsScheme) || !net::registry_controlled_domains::SameDomainOrHost( current_page_url, suggest_url, net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES))) diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc index 3d9ebdb..67ac762 100644 --- a/chrome/browser/autocomplete/history_url_provider.cc +++ b/chrome/browser/autocomplete/history_url_provider.cc @@ -862,7 +862,7 @@ bool HistoryURLProvider::CanFindIntranetURL( // input's text and parts between Parse() and here, it seems better to be // paranoid and check. if ((input.type() != AutocompleteInput::UNKNOWN) || - !LowerCaseEqualsASCII(input.scheme(), content::kHttpScheme) || + !LowerCaseEqualsASCII(input.scheme(), url::kHttpScheme) || !input.parts().host.is_nonempty()) return false; const std::string host(base::UTF16ToUTF8( diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index 442d855..3c6a77d 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -47,7 +47,6 @@ #include "ui/base/l10n/l10n_util.h" #include "url/url_util.h" - // Helpers -------------------------------------------------------------------- namespace { @@ -559,8 +558,8 @@ bool SearchProvider::IsQuerySuitableForSuggest() const { // and happens to currently be invalid -- in which case we again want to run // our checks below. Other QUERY cases are less likely to be URLs and thus we // assume we're OK. - if (!LowerCaseEqualsASCII(input_.scheme(), content::kHttpScheme) && - !LowerCaseEqualsASCII(input_.scheme(), content::kHttpsScheme) && + if (!LowerCaseEqualsASCII(input_.scheme(), url::kHttpScheme) && + !LowerCaseEqualsASCII(input_.scheme(), url::kHttpsScheme) && !LowerCaseEqualsASCII(input_.scheme(), content::kFtpScheme)) return (input_.type() == AutocompleteInput::QUERY); @@ -582,7 +581,7 @@ bool SearchProvider::IsQuerySuitableForSuggest() const { // Don't send anything for https except the hostname. Hostnames are OK // because they are visible when the TCP connection is established, but the // specific path may reveal private information. - if (LowerCaseEqualsASCII(input_.scheme(), content::kHttpsScheme) && + if (LowerCaseEqualsASCII(input_.scheme(), url::kHttpsScheme) && parts.path.is_nonempty()) return false; diff --git a/chrome/browser/autocomplete/zero_suggest_provider.cc b/chrome/browser/autocomplete/zero_suggest_provider.cc index 0a88882..51e24f6 100644 --- a/chrome/browser/autocomplete/zero_suggest_provider.cc +++ b/chrome/browser/autocomplete/zero_suggest_provider.cc @@ -385,8 +385,8 @@ bool ZeroSuggestProvider::CanShowZeroSuggestWithoutSendingURL( // with other schemes (e.g. chrome://). That may require improvements to // the formatting of the verbatim result returned by MatchForCurrentURL(). if (!current_page_url.is_valid() || - ((current_page_url.scheme() != content::kHttpScheme) && - (current_page_url.scheme() != content::kHttpsScheme))) + ((current_page_url.scheme() != url::kHttpScheme) && + (current_page_url.scheme() != url::kHttpsScheme))) return false; return true; diff --git a/chrome/browser/browsing_data/browsing_data_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_helper_unittest.cc index 00d6a9a..5e3dd80 100644 --- a/chrome/browser/browsing_data/browsing_data_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_helper_unittest.cc @@ -58,8 +58,8 @@ class BrowsingDataHelperTest : public testing::Test { }; TEST_F(BrowsingDataHelperTest, WebSafeSchemesAreWebSafe) { - EXPECT_TRUE(IsWebScheme(content::kHttpScheme)); - EXPECT_TRUE(IsWebScheme(content::kHttpsScheme)); + EXPECT_TRUE(IsWebScheme(url::kHttpScheme)); + EXPECT_TRUE(IsWebScheme(url::kHttpsScheme)); EXPECT_TRUE(IsWebScheme(content::kFtpScheme)); EXPECT_TRUE(IsWebScheme(content::kDataScheme)); EXPECT_TRUE(IsWebScheme("feed")); @@ -81,8 +81,8 @@ TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotWebSafe) { } TEST_F(BrowsingDataHelperTest, WebSafeSchemesAreNotExtensions) { - EXPECT_FALSE(IsExtensionScheme(content::kHttpScheme)); - EXPECT_FALSE(IsExtensionScheme(content::kHttpsScheme)); + EXPECT_FALSE(IsExtensionScheme(url::kHttpScheme)); + EXPECT_FALSE(IsExtensionScheme(url::kHttpsScheme)); EXPECT_FALSE(IsExtensionScheme(content::kFtpScheme)); EXPECT_FALSE(IsExtensionScheme(content::kDataScheme)); EXPECT_FALSE(IsExtensionScheme("feed")); diff --git a/chrome/browser/browsing_data/cookies_tree_model.cc b/chrome/browser/browsing_data/cookies_tree_model.cc index 37a4e63..0fb14e5 100644 --- a/chrome/browser/browsing_data/cookies_tree_model.cc +++ b/chrome/browser/browsing_data/cookies_tree_model.cc @@ -1088,7 +1088,7 @@ void CookiesTreeModel::PopulateCookieInfoWithFilter( domain = domain.substr(1); // We treat secure cookies just the same as normal ones. - source_string = std::string(content::kHttpScheme) + + source_string = std::string(url::kHttpScheme) + content::kStandardSchemeSeparator + domain + "/"; } @@ -1235,7 +1235,7 @@ void CookiesTreeModel::PopulateServerBoundCertInfoWithFilter( if (!origin.is_valid()) { // Domain Bound Cert. Make a valid URL to satisfy the // CookieTreeRootNode::GetOrCreateHostNode interface. - origin = GURL(std::string(content::kHttpsScheme) + + origin = GURL(std::string(url::kHttpsScheme) + content::kStandardSchemeSeparator + cert_info->server_identifier() + "/"); } diff --git a/chrome/browser/chromeos/attestation/platform_verification_flow.cc b/chrome/browser/chromeos/attestation/platform_verification_flow.cc index 1c31f91..0adda12 100644 --- a/chrome/browser/chromeos/attestation/platform_verification_flow.cc +++ b/chrome/browser/chromeos/attestation/platform_verification_flow.cc @@ -445,9 +445,9 @@ void PlatformVerificationFlow::RecordDomainConsent( ->WithPathWildcard(); if (!url.port().empty()) builder->WithPort(url.port()); - else if (url.SchemeIs(content::kHttpsScheme)) + else if (url.SchemeIs(url::kHttpsScheme)) builder->WithPort(kDefaultHttpsPort); - else if (url.SchemeIs(content::kHttpScheme)) + else if (url.SchemeIs(url::kHttpScheme)) builder->WithPortWildcard(); ContentSettingsPattern pattern = builder->Build(); if (pattern.IsValid()) { diff --git a/chrome/browser/content_settings/local_shared_objects_container.cc b/chrome/browser/content_settings/local_shared_objects_container.cc index 4cc1fa1..fa48f6f 100644 --- a/chrome/browser/content_settings/local_shared_objects_container.cc +++ b/chrome/browser/content_settings/local_shared_objects_container.cc @@ -99,7 +99,7 @@ size_t LocalSharedObjectsContainer::GetObjectCountForDomain( // The |domain_url| is only created in order to use the // SameDomainOrHost method below. It does not matter which scheme is // used as the scheme is ignored by the SameDomainOrHost method. - GURL domain_url(std::string(content::kHttpScheme) + + GURL domain_url(std::string(url::kHttpScheme) + content::kStandardSchemeSeparator + cookie_domain); if (SameDomainOrHost(origin, domain_url)) ++count; diff --git a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc index 29af76e..6601abd 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc @@ -43,9 +43,9 @@ COMPILE_ASSERT(arraysize(kContentSettingNames) <= // TODO(bauerb): Move this someplace where it can be reused. std::string GetDefaultPort(const std::string& scheme) { - if (scheme == content::kHttpScheme) + if (scheme == url::kHttpScheme) return "80"; - if (scheme == content::kHttpsScheme) + if (scheme == url::kHttpsScheme) return "443"; NOTREACHED(); return std::string(); diff --git a/chrome/browser/extensions/api/cookies/cookies_helpers.cc b/chrome/browser/extensions/api/cookies/cookies_helpers.cc index 910ebb6..7044bfe 100644 --- a/chrome/browser/extensions/api/cookies/cookies_helpers.cc +++ b/chrome/browser/extensions/api/cookies/cookies_helpers.cc @@ -120,7 +120,7 @@ void GetCookieListFromStore( GURL GetURLFromCanonicalCookie(const net::CanonicalCookie& cookie) { const std::string& domain_key = cookie.Domain(); const std::string scheme = - cookie.IsSecure() ? content::kHttpsScheme : content::kHttpScheme; + cookie.IsSecure() ? url::kHttpsScheme : url::kHttpScheme; const std::string host = domain_key.find('.') != 0 ? domain_key : domain_key.substr(1); return GURL(scheme + content::kStandardSchemeSeparator + host + "/"); diff --git a/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc b/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc index 8356221..9cd4349 100644 --- a/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc +++ b/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc @@ -14,14 +14,14 @@ namespace { // URL schemes for which we'll send events. const char* kValidSchemes[] = { - content::kChromeUIScheme, - content::kHttpScheme, - content::kHttpsScheme, - content::kFileScheme, - content::kFtpScheme, - content::kJavaScriptScheme, - content::kDataScheme, - content::kFileSystemScheme, + content::kChromeUIScheme, + url::kHttpScheme, + url::kHttpsScheme, + content::kFileScheme, + content::kFtpScheme, + content::kJavaScriptScheme, + content::kDataScheme, + content::kFileSystemScheme, }; } // namespace diff --git a/chrome/browser/extensions/api/web_request/web_request_permissions.cc b/chrome/browser/extensions/api/web_request/web_request_permissions.cc index 636db60..3bda598 100644 --- a/chrome/browser/extensions/api/web_request/web_request_permissions.cc +++ b/chrome/browser/extensions/api/web_request/web_request_permissions.cc @@ -72,8 +72,8 @@ bool HasWebRequestScheme(const GURL& url) { url.SchemeIs(content::kFileScheme) || url.SchemeIs(content::kFileSystemScheme) || url.SchemeIs(content::kFtpScheme) || - url.SchemeIs(content::kHttpScheme) || - url.SchemeIs(content::kHttpsScheme) || + url.SchemeIs(url::kHttpScheme) || + url.SchemeIs(url::kHttpsScheme) || url.SchemeIs(extensions::kExtensionScheme)); } diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index fca0c7a..935c2a4 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -405,8 +405,8 @@ void HistoryBackend::AddPage(const HistoryAddPageArgs& request) { !is_keyword_generated) { const GURL& origin_url(has_redirects ? request.redirects[0] : request.url); - if (origin_url.SchemeIs(content::kHttpScheme) || - origin_url.SchemeIs(content::kHttpsScheme) || + if (origin_url.SchemeIs(url::kHttpScheme) || + origin_url.SchemeIs(url::kHttpsScheme) || origin_url.SchemeIs(content::kFtpScheme)) { std::string host(origin_url.host()); size_t registry_length = diff --git a/chrome/browser/history/in_memory_url_index.cc b/chrome/browser/history/in_memory_url_index.cc index e25a092..71a58c8 100644 --- a/chrome/browser/history/in_memory_url_index.cc +++ b/chrome/browser/history/in_memory_url_index.cc @@ -42,8 +42,8 @@ void InitializeSchemeWhitelist(std::set<std::string>* whitelist) { whitelist->insert(std::string(content::kChromeUIScheme)); whitelist->insert(std::string(content::kFileScheme)); whitelist->insert(std::string(content::kFtpScheme)); - whitelist->insert(std::string(content::kHttpScheme)); - whitelist->insert(std::string(content::kHttpsScheme)); + whitelist->insert(std::string(url::kHttpScheme)); + whitelist->insert(std::string(url::kHttpsScheme)); whitelist->insert(std::string(content::kMailToScheme)); } diff --git a/chrome/browser/history/url_database.cc b/chrome/browser/history/url_database.cc index 605213b..9de3e1a 100644 --- a/chrome/browser/history/url_database.cc +++ b/chrome/browser/history/url_database.cc @@ -313,8 +313,8 @@ bool URLDatabase::AutocompleteForPrefix(const std::string& prefix, bool URLDatabase::IsTypedHost(const std::string& host) { const char* schemes[] = { - content::kHttpScheme, - content::kHttpsScheme, + url::kHttpScheme, + url::kHttpsScheme, content::kFtpScheme }; URLRows dummy; diff --git a/chrome/browser/history/visit_database.cc b/chrome/browser/history/visit_database.cc index 20e98b1..962c76a 100644 --- a/chrome/browser/history/visit_database.cc +++ b/chrome/browser/history/visit_database.cc @@ -490,8 +490,8 @@ bool VisitDatabase::GetRedirectToVisit(VisitID to_visit, bool VisitDatabase::GetVisibleVisitCountToHost(const GURL& url, int* count, base::Time* first_visit) { - if (!url.SchemeIs(content::kHttpScheme) && - !url.SchemeIs(content::kHttpsScheme)) + if (!url.SchemeIs(url::kHttpScheme) && + !url.SchemeIs(url::kHttpsScheme)) return false; // We need to search for URLs with a matching host/port. One way to query for diff --git a/chrome/browser/net/predictor_tab_helper.cc b/chrome/browser/net/predictor_tab_helper.cc index 4379281..3f2bcc4 100644 --- a/chrome/browser/net/predictor_tab_helper.cc +++ b/chrome/browser/net/predictor_tab_helper.cc @@ -49,7 +49,7 @@ void PredictorTabHelper::DidStartNavigationToPendingEntry( chrome_browser_net::Predictor* predictor = profile->GetNetworkPredictor(); if (!predictor) return; - if (url.SchemeIs(content::kHttpScheme) || url.SchemeIs(content::kHttpsScheme)) + if (url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme)) predictor->PreconnectUrlAndSubresources(url, GURL()); } diff --git a/chrome/browser/renderer_host/offline_resource_throttle.cc b/chrome/browser/renderer_host/offline_resource_throttle.cc index 598debd..f37b998 100644 --- a/chrome/browser/renderer_host/offline_resource_throttle.cc +++ b/chrome/browser/renderer_host/offline_resource_throttle.cc @@ -119,8 +119,8 @@ void OfflineResourceThrottle::OnBlockingPageComplete(bool proceed) { bool OfflineResourceThrottle::IsRemote(const GURL& url) const { return !net::IsLocalhost(url.host()) && (url.SchemeIs(content::kFtpScheme) || - url.SchemeIs(content::kHttpScheme) || - url.SchemeIs(content::kHttpsScheme)); + url.SchemeIs(url::kHttpScheme) || + url.SchemeIs(url::kHttpsScheme)); } bool OfflineResourceThrottle::ShouldShowOfflinePage(const GURL& url) const { diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc index a7d96cf..c07a773 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host.cc @@ -109,7 +109,7 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest } // For phishing we only classify HTTP pages. - if (!params_.url.SchemeIs(content::kHttpScheme)) { + if (!params_.url.SchemeIs(url::kHttpScheme)) { VLOG(1) << "Skipping phishing classification for URL: " << params_.url << " because it is not HTTP: " << params_.socket_address.host(); diff --git a/chrome/browser/safe_browsing/database_manager.cc b/chrome/browser/safe_browsing/database_manager.cc index 6af4054..7fe23c2 100644 --- a/chrome/browser/safe_browsing/database_manager.cc +++ b/chrome/browser/safe_browsing/database_manager.cc @@ -222,8 +222,8 @@ SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() { bool SafeBrowsingDatabaseManager::CanCheckUrl(const GURL& url) const { return url.SchemeIs(content::kFtpScheme) || - url.SchemeIs(content::kHttpScheme) || - url.SchemeIs(content::kHttpsScheme); + url.SchemeIs(url::kHttpScheme) || + url.SchemeIs(url::kHttpsScheme); } bool SafeBrowsingDatabaseManager::CheckDownloadUrl( diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index ffcf0a7..c5b4c44 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -265,7 +265,7 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage( bool SafeBrowsingBlockingPage::CanShowMalwareDetailsOption() { return (!web_contents_->GetBrowserContext()->IsOffTheRecord() && - web_contents_->GetURL().SchemeIs(content::kHttpScheme)); + web_contents_->GetURL().SchemeIs(url::kHttpScheme)); } SafeBrowsingBlockingPage::~SafeBrowsingBlockingPage() { diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc index 0f3b95e..dd91d09 100644 --- a/chrome/browser/safe_browsing/safe_browsing_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_test.cc @@ -91,8 +91,7 @@ bool ParsePhishingUrls(const std::string& data, << urls[i]; return false; } - phishing_url.url = std::string(content::kHttpScheme) + - "://" + record_parts[0]; + phishing_url.url = std::string(url::kHttpScheme) + "://" + record_parts[0]; phishing_url.list_name = record_parts[1]; if (record_parts[2] == "yes") { phishing_url.is_phishing = true; diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc index 46ea5d7..7967311b 100644 --- a/chrome/browser/search/search.cc +++ b/chrome/browser/search/search.cc @@ -532,7 +532,7 @@ GURL GetInstantURL(Profile* profile, int start_margin, if (!instant_url.SchemeIsSecure() && !google_util::StartsWithCommandLineGoogleBaseURL(instant_url)) { GURL::Replacements replacements; - const std::string secure_scheme(content::kHttpsScheme); + const std::string secure_scheme(url::kHttpsScheme); replacements.SetSchemeStr(secure_scheme); instant_url = instant_url.ReplaceComponents(replacements); } diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc index 501b798..874b4bb 100644 --- a/chrome/browser/search_engines/template_url.cc +++ b/chrome/browser/search_engines/template_url.cc @@ -835,7 +835,7 @@ std::string TemplateURLRef::HandleReplacements( search_terms_args_without_aqs.assisted_query_stats.clear(); GURL base_url(ReplaceSearchTermsUsingTermsData( search_terms_args_without_aqs, search_terms_data, NULL)); - if (base_url.SchemeIs(content::kHttpsScheme)) { + if (base_url.SchemeIs(url::kHttpsScheme)) { HandleReplacement( "aqs", search_terms_args.assisted_query_stats, *i, &url); } diff --git a/chrome/browser/search_engines/template_url_parser.cc b/chrome/browser/search_engines/template_url_parser.cc index 083aeec..5669a2c 100644 --- a/chrome/browser/search_engines/template_url_parser.cc +++ b/chrome/browser/search_engines/template_url_parser.cc @@ -94,8 +94,8 @@ bool IsHTTPRef(const std::string& url) { if (url.empty()) return true; GURL gurl(url); - return gurl.is_valid() && (gurl.SchemeIs(content::kHttpScheme) || - gurl.SchemeIs(content::kHttpsScheme)); + return gurl.is_valid() && (gurl.SchemeIs(url::kHttpScheme) || + gurl.SchemeIs(url::kHttpsScheme)); } } // namespace @@ -252,8 +252,8 @@ void TemplateURLParsingContext::EndElementImpl(void* ctx, const xmlChar* name) { // favicon from the URL. context->derive_image_from_url_ = true; } else if (context->image_is_valid_for_favicon_ && image_url.is_valid() && - (image_url.SchemeIs(content::kHttpScheme) || - image_url.SchemeIs(content::kHttpsScheme))) { + (image_url.SchemeIs(url::kHttpScheme) || + image_url.SchemeIs(url::kHttpsScheme))) { context->data_.favicon_url = image_url; } context->image_is_valid_for_favicon_ = false; diff --git a/chrome/browser/search_engines/template_url_service.cc b/chrome/browser/search_engines/template_url_service.cc index 10d5e95..1042ddb 100644 --- a/chrome/browser/search_engines/template_url_service.cc +++ b/chrome/browser/search_engines/template_url_service.cc @@ -518,9 +518,9 @@ base::string16 TemplateURLService::CleanUserInputKeyword( // type a web address, but rather an FTP, file:, or other scheme URL, or a // search query with some sort of initial operator (e.g. "site:"). if (result.compare(0, scheme_component.end(), - base::ASCIIToUTF16(content::kHttpScheme)) && + base::ASCIIToUTF16(url::kHttpScheme)) && result.compare(0, scheme_component.end(), - base::ASCIIToUTF16(content::kHttpsScheme))) + base::ASCIIToUTF16(url::kHttpsScheme))) return base::string16(); // Include trailing ':'. diff --git a/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc b/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc index 8b4318e..73bcf1db 100644 --- a/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc +++ b/chrome/browser/ui/app_list/search/common/webservice_search_provider.cc @@ -90,7 +90,7 @@ bool WebserviceSearchProvider::IsSensitiveInput(const base::string16& query) { // Don't send anything for https except the hostname. Hostnames are OK // because they are visible when the TCP connection is established, but the // specific path may reveal private information. - if (LowerCaseEqualsASCII(query_as_url.scheme(), content::kHttpsScheme) && + if (LowerCaseEqualsASCII(query_as_url.scheme(), url::kHttpsScheme) && !query_as_url.path().empty() && query_as_url.path() != "/") { return true; } diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index ccfe5fa..89015cb 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -204,7 +204,7 @@ class TransferHttpsRedirectsContentBrowserClient content::ResourceContext* resource_context, const GURL& current_url, const GURL& new_url) OVERRIDE { - return new_url.SchemeIs(content::kHttpsScheme); + return new_url.SchemeIs(url::kHttpsScheme); } }; @@ -1119,7 +1119,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttp) { ASSERT_TRUE(test_server()->Start()); GURL http_url(test_server()->GetURL(std::string())); - ASSERT_TRUE(http_url.SchemeIs(content::kHttpScheme)); + ASSERT_TRUE(http_url.SchemeIs(url::kHttpScheme)); ui_test_utils::NavigateToURL(browser(), http_url); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); } @@ -1133,7 +1133,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttps) { base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL https_url(test_server.GetURL("/")); - ASSERT_TRUE(https_url.SchemeIs(content::kHttpsScheme)); + ASSERT_TRUE(https_url.SchemeIs(url::kHttpsScheme)); ui_test_utils::NavigateToURL(browser(), https_url); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); } @@ -1179,7 +1179,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutInvalid) { IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { ASSERT_TRUE(test_server()->Start()); GURL http_url(test_server()->GetURL(std::string())); - ASSERT_TRUE(http_url.SchemeIs(content::kHttpScheme)); + ASSERT_TRUE(http_url.SchemeIs(url::kHttpScheme)); ASSERT_EQ(1, browser()->tab_strip_model()->count()); WebContents* initial_tab = browser()->tab_strip_model()->GetWebContentsAt(0); diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc index 284d472..1d81416 100644 --- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc +++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc @@ -481,10 +481,10 @@ void OmniboxEditModel::AdjustTextForCopy(int sel_min, // entire host, and the user hasn't edited the host or manually removed the // scheme. GURL perm_url(PermanentURL()); - if (perm_url.SchemeIs(content::kHttpScheme) && - url->SchemeIs(content::kHttpScheme) && perm_url.host() == url->host()) { + if (perm_url.SchemeIs(url::kHttpScheme) && + url->SchemeIs(url::kHttpScheme) && perm_url.host() == url->host()) { *write_url = true; - base::string16 http = base::ASCIIToUTF16(content::kHttpScheme) + + base::string16 http = base::ASCIIToUTF16(url::kHttpScheme) + base::ASCIIToUTF16(content::kStandardSchemeSeparator); if (text->compare(0, http.length(), http) != 0) *text = http + *text; diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc index 7ebda48..db0a28f 100644 --- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc +++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc @@ -55,7 +55,7 @@ base::string16 GenerateKeywordFromNavigationEntry( // If we relax the path constraint, we need to be sure to sanitize the path // elements and update AutocompletePopup to look for keywords using the path. // See http://b/issue?id=863583. - if (!url.SchemeIs(content::kHttpScheme) || (url.path().length() > 1)) + if (!url.SchemeIs(url::kHttpScheme) || (url.path().length() > 1)) return base::string16(); return TemplateURLService::GenerateKeyword(url); diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 313e261..a588a94 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -442,8 +442,8 @@ bool IsValidUrl(const GURL& url) { content::kFileScheme, content::kFileSystemScheme, content::kFtpScheme, - content::kHttpScheme, - content::kHttpsScheme, + url::kHttpScheme, + url::kHttpsScheme, extensions::kExtensionScheme, }; diff --git a/chrome/browser/web_resource/promo_resource_service_unittest.cc b/chrome/browser/web_resource/promo_resource_service_unittest.cc index 97cac31..aef4c28 100644 --- a/chrome/browser/web_resource/promo_resource_service_unittest.cc +++ b/chrome/browser/web_resource/promo_resource_service_unittest.cc @@ -529,7 +529,7 @@ TEST_F(PromoResourceServiceTest, PromoServerURLTest) { GURL promo_server_url = NotificationPromo::PromoServerURL(); EXPECT_FALSE(promo_server_url.is_empty()); EXPECT_TRUE(promo_server_url.is_valid()); - EXPECT_TRUE(promo_server_url.SchemeIs(content::kHttpsScheme)); + EXPECT_TRUE(promo_server_url.SchemeIs(url::kHttpsScheme)); // TODO(achuith): Test this better. } diff --git a/chrome/common/content_settings_helper.cc b/chrome/common/content_settings_helper.cc index dda2cd5..e553eab 100644 --- a/chrome/common/content_settings_helper.cc +++ b/chrome/common/content_settings_helper.cc @@ -15,7 +15,7 @@ std::string OriginToString(const GURL& origin) { std::string port_component(origin.IntPort() != url::PORT_UNSPECIFIED ? ":" + origin.port() : std::string()); - std::string scheme_component(!origin.SchemeIs(content::kHttpScheme) + std::string scheme_component(!origin.SchemeIs(url::kHttpScheme) ? origin.scheme() + content::kStandardSchemeSeparator : std::string()); diff --git a/chrome/common/content_settings_pattern.cc b/chrome/common/content_settings_pattern.cc index 340a211..bfaa66e 100644 --- a/chrome/common/content_settings_pattern.cc +++ b/chrome/common/content_settings_pattern.cc @@ -22,9 +22,9 @@ namespace { std::string GetDefaultPort(const std::string& scheme) { - if (scheme == content::kHttpScheme) + if (scheme == url::kHttpScheme) return "80"; - if (scheme == content::kHttpsScheme) + if (scheme == url::kHttpsScheme) return "443"; return std::string(); } @@ -243,8 +243,8 @@ bool ContentSettingsPattern::Builder::Validate(const PatternParts& parts) { // Test if the scheme is supported or a wildcard. if (!parts.is_scheme_wildcard && - parts.scheme != std::string(content::kHttpScheme) && - parts.scheme != std::string(content::kHttpsScheme)) { + parts.scheme != std::string(url::kHttpScheme) && + parts.scheme != std::string(url::kHttpsScheme)) { return false; } return true; @@ -278,8 +278,8 @@ bool ContentSettingsPattern::Builder::LegacyValidate( // Test if the scheme is supported or a wildcard. if (!parts.is_scheme_wildcard && - parts.scheme != std::string(content::kHttpScheme) && - parts.scheme != std::string(content::kHttpsScheme)) { + parts.scheme != std::string(url::kHttpScheme) && + parts.scheme != std::string(url::kHttpsScheme)) { return false; } return true; @@ -339,18 +339,18 @@ ContentSettingsPattern ContentSettingsPattern::FromURL( // also have a "http" scheme. if (local_url->HostIsIPAddress()) { builder->WithScheme(local_url->scheme())->WithHost(local_url->host()); - } else if (local_url->SchemeIs(content::kHttpScheme)) { + } else if (local_url->SchemeIs(url::kHttpScheme)) { builder->WithSchemeWildcard()->WithDomainWildcard()->WithHost( local_url->host()); - } else if (local_url->SchemeIs(content::kHttpsScheme)) { + } else if (local_url->SchemeIs(url::kHttpsScheme)) { builder->WithScheme(local_url->scheme())->WithDomainWildcard()->WithHost( local_url->host()); } else { // Unsupported scheme } if (local_url->port().empty()) { - if (local_url->SchemeIs(content::kHttpsScheme)) - builder->WithPort(GetDefaultPort(content::kHttpsScheme)); + if (local_url->SchemeIs(url::kHttpsScheme)) + builder->WithPort(GetDefaultPort(url::kHttpsScheme)); else builder->WithPortWildcard(); } else { diff --git a/chrome/common/net/url_fixer_upper.cc b/chrome/common/net/url_fixer_upper.cc index 9bdc5e5..ea6555f 100644 --- a/chrome/common/net/url_fixer_upper.cc +++ b/chrome/common/net/url_fixer_upper.cc @@ -424,7 +424,7 @@ std::string SegmentURLInternal(std::string* text, url::Parsed* parts) { // Couldn't determine the scheme, so just pick one. parts->scheme.reset(); scheme = StartsWithASCII(*text, "ftp.", false) ? - content::kFtpScheme : content::kHttpScheme; + content::kFtpScheme : url::kHttpScheme; } } diff --git a/chrome/common/search_urls.cc b/chrome/common/search_urls.cc index 9856842..b1277b6 100644 --- a/chrome/common/search_urls.cc +++ b/chrome/common/search_urls.cc @@ -14,8 +14,8 @@ bool MatchesOrigin(const GURL& my_url, const GURL& other_url) { return my_url.host() == other_url.host() && my_url.port() == other_url.port() && (my_url.scheme() == other_url.scheme() || - (my_url.SchemeIs(content::kHttpsScheme) && - other_url.SchemeIs(content::kHttpScheme))); + (my_url.SchemeIs(url::kHttpsScheme) && + other_url.SchemeIs(url::kHttpScheme))); } } // namespace diff --git a/chrome/renderer/safe_browsing/phishing_classifier.cc b/chrome/renderer/safe_browsing/phishing_classifier.cc index f48e6c1..3f2e98c 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier.cc @@ -118,7 +118,7 @@ void PhishingClassifier::BeginFeatureExtraction() { // Check whether the URL is one that we should classify. // Currently, we only classify http: URLs that are GET requests. GURL url(frame->document().url()); - if (!url.SchemeIs(content::kHttpScheme)) { + if (!url.SchemeIs(url::kHttpScheme)) { RunFailureCallback(); return; } diff --git a/chrome/utility/importer/ie_importer_win.cc b/chrome/utility/importer/ie_importer_win.cc index 540cf59..1ba2d6b 100644 --- a/chrome/utility/importer/ie_importer_win.cc +++ b/chrome/utility/importer/ie_importer_win.cc @@ -468,8 +468,8 @@ void IEImporter::ImportFavorites() { } void IEImporter::ImportHistory() { - const std::string kSchemes[] = {content::kHttpScheme, - content::kHttpsScheme, + const std::string kSchemes[] = {url::kHttpScheme, + url::kHttpsScheme, content::kFtpScheme, content::kFileScheme}; int total_schemes = arraysize(kSchemes); @@ -602,8 +602,8 @@ void IEImporter::ImportPasswordsIE6() { continue; GURL url(ac_list[i].key.c_str()); - if (!(LowerCaseEqualsASCII(url.scheme(), content::kHttpScheme) || - LowerCaseEqualsASCII(url.scheme(), content::kHttpsScheme))) { + if (!(LowerCaseEqualsASCII(url.scheme(), url::kHttpScheme) || + LowerCaseEqualsASCII(url.scheme(), url::kHttpsScheme))) { continue; } diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index c6c53a3..ca8e10e 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc @@ -280,7 +280,7 @@ void AutofillAgent::didRequestAutocomplete( GURL url(form.document().url()); content::SSLStatus ssl_status = render_view()->GetSSLStatusOfFrame(form.document().frame()); - bool is_safe = url.SchemeIs(content::kHttpsScheme) && + bool is_safe = url.SchemeIs(url::kHttpsScheme) && !net::IsCertStatusError(ssl_status.cert_status); bool allow_unsafe = CommandLine::ForCurrentProcess()->HasSwitch( ::switches::kReduceSecurityForTesting); diff --git a/content/browser/browser_url_handler_impl.cc b/content/browser/browser_url_handler_impl.cc index bbf24e3..21793a1 100644 --- a/content/browser/browser_url_handler_impl.cc +++ b/content/browser/browser_url_handler_impl.cc @@ -24,13 +24,13 @@ static bool HandleViewSource(GURL* url, BrowserContext* browser_context) { // Bug 26129: limit view-source to view the content and not any // other kind of 'active' url scheme like 'javascript' or 'data'. static const char* const default_allowed_sub_schemes[] = { - kHttpScheme, - kHttpsScheme, - kFtpScheme, - kChromeDevToolsScheme, - kChromeUIScheme, - kFileScheme, - kFileSystemScheme + url::kHttpScheme, + url::kHttpsScheme, + kFtpScheme, + kChromeDevToolsScheme, + kChromeUIScheme, + kFileScheme, + kFileSystemScheme }; // Merge all the schemes for which view-source is allowed by default, with diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc index 6a6a8b6..2dddca6 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc @@ -308,8 +308,8 @@ class ChildProcessSecurityPolicyImpl::SecurityState { ChildProcessSecurityPolicyImpl::ChildProcessSecurityPolicyImpl() { // We know about these schemes and believe them to be safe. - RegisterWebSafeScheme(kHttpScheme); - RegisterWebSafeScheme(kHttpsScheme); + RegisterWebSafeScheme(url::kHttpScheme); + RegisterWebSafeScheme(url::kHttpsScheme); RegisterWebSafeScheme(kFtpScheme); RegisterWebSafeScheme(kDataScheme); RegisterWebSafeScheme("feed"); diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc index 442b982..78bee5b 100644 --- a/content/browser/child_process_security_policy_unittest.cc +++ b/content/browser/child_process_security_policy_unittest.cc @@ -120,8 +120,8 @@ TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) { ChildProcessSecurityPolicyImpl* p = ChildProcessSecurityPolicyImpl::GetInstance(); - EXPECT_TRUE(p->IsWebSafeScheme(kHttpScheme)); - EXPECT_TRUE(p->IsWebSafeScheme(kHttpsScheme)); + EXPECT_TRUE(p->IsWebSafeScheme(url::kHttpScheme)); + EXPECT_TRUE(p->IsWebSafeScheme(url::kHttpsScheme)); EXPECT_TRUE(p->IsWebSafeScheme(kFtpScheme)); EXPECT_TRUE(p->IsWebSafeScheme(kDataScheme)); EXPECT_TRUE(p->IsWebSafeScheme("feed")); diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc index 4fa5f08..79e2c7b 100644 --- a/content/browser/frame_host/navigation_controller_impl.cc +++ b/content/browser/frame_host/navigation_controller_impl.cc @@ -654,8 +654,8 @@ void NavigationControllerImpl::LoadURLWithParams(const LoadURLParams& params) { case LOAD_TYPE_DEFAULT: break; case LOAD_TYPE_BROWSER_INITIATED_HTTP_POST: - if (!params.url.SchemeIs(kHttpScheme) && - !params.url.SchemeIs(kHttpsScheme)) { + if (!params.url.SchemeIs(url::kHttpScheme) && + !params.url.SchemeIs(url::kHttpsScheme)) { NOTREACHED() << "Http post load must use http(s) scheme."; return; } diff --git a/content/common/savable_url_schemes.cc b/content/common/savable_url_schemes.cc index e49fceb..290d78f 100644 --- a/content/common/savable_url_schemes.cc +++ b/content/common/savable_url_schemes.cc @@ -13,8 +13,8 @@ namespace content { namespace { const char* const kDefaultSavableSchemes[] = { - kHttpScheme, - kHttpsScheme, + url::kHttpScheme, + url::kHttpsScheme, kFileScheme, kFileSystemScheme, kFtpScheme, diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc index 73d527b..8a035d5 100644 --- a/content/plugin/webplugin_proxy.cc +++ b/content/plugin/webplugin_proxy.cc @@ -288,8 +288,8 @@ void WebPluginProxy::HandleURLRequest(const char* url, if (delegate_->GetQuirks() & WebPluginDelegateImpl::PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS) { GURL request_url(url); - if (!request_url.SchemeIs(kHttpScheme) && - !request_url.SchemeIs(kHttpsScheme) && + if (!request_url.SchemeIs(url::kHttpScheme) && + !request_url.SchemeIs(url::kHttpsScheme) && !request_url.SchemeIs(kFtpScheme)) { return; } diff --git a/content/public/common/url_constants.cc b/content/public/common/url_constants.cc index 389e022..278cb7b 100644 --- a/content/public/common/url_constants.cc +++ b/content/public/common/url_constants.cc @@ -18,8 +18,6 @@ const char kFileScheme[] = "file"; const char kFileSystemScheme[] = "filesystem"; const char kFtpScheme[] = "ftp"; const char kGuestScheme[] = "chrome-guest"; -const char kHttpScheme[] = "http"; -const char kHttpsScheme[] = "https"; const char kJavaScriptScheme[] = "javascript"; const char kMailToScheme[] = "mailto"; const char kMetadataScheme[] = "metadata"; diff --git a/content/public/common/url_constants.h b/content/public/common/url_constants.h index 194bb3a..f2f7078 100644 --- a/content/public/common/url_constants.h +++ b/content/public/common/url_constants.h @@ -6,6 +6,7 @@ #define CONTENT_PUBLIC_COMMON_URL_CONSTANTS_H_ #include "content/common/content_export.h" +#include "url/url_constants.h" // Contains constants for known URLs and portions thereof. @@ -23,8 +24,6 @@ CONTENT_EXPORT extern const char kFileScheme[]; CONTENT_EXPORT extern const char kFileSystemScheme[]; CONTENT_EXPORT extern const char kFtpScheme[]; CONTENT_EXPORT extern const char kGuestScheme[]; -CONTENT_EXPORT extern const char kHttpScheme[]; -CONTENT_EXPORT extern const char kHttpsScheme[]; CONTENT_EXPORT extern const char kJavaScriptScheme[]; CONTENT_EXPORT extern const char kMailToScheme[]; CONTENT_EXPORT extern const char kMetadataScheme[]; diff --git a/content/renderer/media/buffered_data_source.cc b/content/renderer/media/buffered_data_source.cc index 8b2fc3a..d046178 100644 --- a/content/renderer/media/buffered_data_source.cc +++ b/content/renderer/media/buffered_data_source.cc @@ -140,7 +140,7 @@ void BufferedDataSource::Initialize( init_cb_ = init_cb; - if (url_.SchemeIs(kHttpScheme) || url_.SchemeIs(kHttpsScheme)) { + if (url_.SchemeIs(url::kHttpScheme) || url_.SchemeIs(url::kHttpsScheme)) { // Do an unbounded range request starting at the beginning. If the server // responds with 200 instead of 206 we'll fall back into a streaming mode. loader_.reset(CreateResourceLoader(0, kPositionNotSpecified)); diff --git a/content/renderer/media/buffered_data_source_unittest.cc b/content/renderer/media/buffered_data_source_unittest.cc index 0f67898..6cf7ef4 100644 --- a/content/renderer/media/buffered_data_source_unittest.cc +++ b/content/renderer/media/buffered_data_source_unittest.cc @@ -132,7 +132,8 @@ class BufferedDataSourceTest : public testing::Test { &BufferedDataSourceTest::OnInitialize, base::Unretained(this))); message_loop_.RunUntilIdle(); - bool is_http = gurl.SchemeIs(kHttpScheme) || gurl.SchemeIs(kHttpsScheme); + bool is_http = + gurl.SchemeIs(url::kHttpScheme) || gurl.SchemeIs(url::kHttpsScheme); EXPECT_EQ(data_source_->downloading(), is_http); } diff --git a/content/renderer/media/buffered_resource_loader.cc b/content/renderer/media/buffered_resource_loader.cc index 1351298..128340d 100644 --- a/content/renderer/media/buffered_resource_loader.cc +++ b/content/renderer/media/buffered_resource_loader.cc @@ -389,7 +389,7 @@ void BufferedResourceLoader::didReceiveResponse( // received a response from HTTP/HTTPS protocol or the request was // successful (in particular range request). So we only verify the partial // response for HTTP and HTTPS protocol. - if (url_.SchemeIs(kHttpScheme) || url_.SchemeIs(kHttpsScheme)) { + if (url_.SchemeIs(url::kHttpScheme) || url_.SchemeIs(url::kHttpsScheme)) { bool partial_response = (response.httpStatusCode() == kHttpPartialContent); bool ok_response = (response.httpStatusCode() == kHttpOK); diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 2141f47..8959037 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -295,7 +295,7 @@ static bool IsNonLocalTopLevelNavigation(const GURL& url, // 2. The origin of the url and the opener is the same in which case the // opener relationship is maintained. // 3. Reloads/form submits/back forward navigations - if (!url.SchemeIs(kHttpScheme) && !url.SchemeIs(kHttpsScheme)) + if (!url.SchemeIs(url::kHttpScheme) && !url.SchemeIs(url::kHttpsScheme)) return false; if (type != blink::WebNavigationTypeReload && diff --git a/extensions/common/url_pattern.cc b/extensions/common/url_pattern.cc index fc7efbf..020be3c 100644 --- a/extensions/common/url_pattern.cc +++ b/extensions/common/url_pattern.cc @@ -20,13 +20,13 @@ namespace { // TODO(aa): What about more obscure schemes like data: and javascript: ? // Note: keep this array in sync with kValidSchemeMasks. const char* kValidSchemes[] = { - content::kHttpScheme, - content::kHttpsScheme, - content::kFileScheme, - content::kFtpScheme, - content::kChromeUIScheme, - extensions::kExtensionScheme, - content::kFileSystemScheme, + url::kHttpScheme, + url::kHttpsScheme, + content::kFileScheme, + content::kFtpScheme, + content::kChromeUIScheme, + extensions::kExtensionScheme, + content::kFileSystemScheme, }; const int kValidSchemeMasks[] = { @@ -365,7 +365,7 @@ bool URLPattern::MatchesScheme(const std::string& test) const { } bool URLPattern::MatchesHost(const std::string& host) const { - std::string test(content::kHttpScheme); + std::string test(url::kHttpScheme); test += content::kStandardSchemeSeparator; test += host; test += "/"; diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index 75b2e43..107c227 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc @@ -794,8 +794,11 @@ void Dispatcher::UpdateOriginPermissions( for (URLPatternSet::const_iterator i = origins.begin(); i != origins.end(); ++i) { const char* schemes[] = { - content::kHttpScheme, content::kHttpsScheme, content::kFileScheme, - content::kChromeUIScheme, content::kFtpScheme, + url::kHttpScheme, + url::kHttpsScheme, + content::kFileScheme, + content::kChromeUIScheme, + content::kFtpScheme, }; for (size_t j = 0; j < arraysize(schemes); ++j) { if (i->MatchesScheme(schemes[j])) { diff --git a/url/BUILD.gn b/url/BUILD.gn index faf8dd8..df7da69 100644 --- a/url/BUILD.gn +++ b/url/BUILD.gn @@ -46,6 +46,8 @@ component("url") { "url_canon_stdstring.cc", "url_canon_stdstring.h", "url_canon_stdurl.cc", + "url_constants.cc", + "url_constants.h", "url_export.h", "url_file.h", "url_parse_file.cc", diff --git a/url/url_constants.cc b/url/url_constants.cc new file mode 100644 index 0000000..7df30da --- /dev/null +++ b/url/url_constants.cc @@ -0,0 +1,12 @@ +// Copyright 2014 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. + +#include "url/url_constants.h" + +namespace url { + +const char kHttpScheme[] = "http"; +const char kHttpsScheme[] = "https"; + +} // namespace url diff --git a/url/url_constants.h b/url/url_constants.h new file mode 100644 index 0000000..9d184d9 --- /dev/null +++ b/url/url_constants.h @@ -0,0 +1,17 @@ +// Copyright 2014 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 URL_URL_CONSTANTS_H_ +#define URL_URL_CONSTANTS_H_ + +#include "url/url_export.h" + +namespace url { + +URL_EXPORT extern const char kHttpScheme[]; +URL_EXPORT extern const char kHttpsScheme[]; + +} // namespace url + +#endif // URL_URL_CONSTANTS_H_ diff --git a/url/url_srcs.gypi b/url/url_srcs.gypi index e8fa82e..61db15d 100644 --- a/url/url_srcs.gypi +++ b/url/url_srcs.gypi @@ -32,6 +32,8 @@ 'url_canon_relative.cc', 'url_canon_stdstring.cc', 'url_canon_stdurl.cc', + 'url_constants.cc', + 'url_constants.h', 'url_file.h', 'url_parse_file.cc', 'url_parse_internal.h', |