diff options
89 files changed, 235 insertions, 242 deletions
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc index 640fa37..1d0e0ae 100644 --- a/android_webview/browser/aw_content_browser_client.cc +++ b/android_webview/browser/aw_content_browser_client.cc @@ -203,7 +203,7 @@ void AwContentBrowserClient::RenderProcessWillLaunch( content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( host->GetID(), android_webview::kContentScheme); content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( - host->GetID(), content::kFileScheme); + host->GetID(), url::kFileScheme); host->AddFilter(new AwContentsMessageFilter(host->GetID())); host->AddFilter(new cdm::CdmMessageFilterAndroid()); diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc index 46bff358..218f09a 100644 --- a/android_webview/browser/net/aw_url_request_context_getter.cc +++ b/android_webview/browser/net/aw_url_request_context_getter.cc @@ -103,22 +103,22 @@ scoped_ptr<net::URLRequestJobFactory> CreateJobFactory( content::ProtocolHandlerMap* protocol_handlers) { scoped_ptr<AwURLRequestJobFactory> aw_job_factory(new AwURLRequestJobFactory); bool set_protocol = aw_job_factory->SetProtocolHandler( - content::kFileScheme, + url::kFileScheme, new net::FileProtocolHandler( content::BrowserThread::GetBlockingPool()-> GetTaskRunnerWithShutdownBehavior( base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); DCHECK(set_protocol); set_protocol = aw_job_factory->SetProtocolHandler( - content::kDataScheme, new net::DataProtocolHandler()); + url::kDataScheme, new net::DataProtocolHandler()); DCHECK(set_protocol); set_protocol = aw_job_factory->SetProtocolHandler( - content::kBlobScheme, - (*protocol_handlers)[content::kBlobScheme].release()); + url::kBlobScheme, + (*protocol_handlers)[url::kBlobScheme].release()); DCHECK(set_protocol); set_protocol = aw_job_factory->SetProtocolHandler( - content::kFileSystemScheme, - (*protocol_handlers)[content::kFileSystemScheme].release()); + url::kFileSystemScheme, + (*protocol_handlers)[url::kFileSystemScheme].release()); DCHECK(set_protocol); set_protocol = aw_job_factory->SetProtocolHandler( content::kChromeUIScheme, diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc index 05eb520..8872dd7 100644 --- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc +++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc @@ -20,11 +20,11 @@ #include "content/public/browser/resource_dispatcher_host_login_delegate.h" #include "content/public/browser/resource_request_info.h" #include "content/public/browser/resource_throttle.h" -#include "content/public/common/url_constants.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/http/http_response_headers.h" #include "net/url_request/url_request.h" +#include "url/url_constants.h" using android_webview::AwContentsIoThreadClient; using content::BrowserThread; @@ -170,7 +170,7 @@ bool IoThreadClientThrottle::ShouldBlockRequest() { } if (io_client->ShouldBlockNetworkLoads()) { - if (request_->url().SchemeIs(content::kFtpScheme)) { + if (request_->url().SchemeIs(url::kFtpScheme)) { return true; } SetCacheControlFlag(request_, net::LOAD_ONLY_FROM_CACHE); diff --git a/android_webview/native/android_protocol_handler.cc b/android_webview/native/android_protocol_handler.cc index 858d0fe..a396fb9 100644 --- a/android_webview/native/android_protocol_handler.cc +++ b/android_webview/native/android_protocol_handler.cc @@ -228,10 +228,10 @@ net::URLRequestJob* AndroidProtocolHandlerBase::MaybeCreateJob( // AssetFileProtocolHandler --------------------------------------------------- AssetFileProtocolHandler::AssetFileProtocolHandler() - : asset_prefix_(std::string(content::kFileScheme) + + : asset_prefix_(std::string(url::kFileScheme) + std::string(content::kStandardSchemeSeparator) + android_webview::kAndroidAssetPath), - resource_prefix_(std::string(content::kFileScheme) + + resource_prefix_(std::string(url::kFileScheme) + std::string(content::kStandardSchemeSeparator) + android_webview::kAndroidResourcePath) { } diff --git a/android_webview/native/cookie_manager.cc b/android_webview/native/cookie_manager.cc index 6362d60..f47cf57 100644 --- a/android_webview/native/cookie_manager.cc +++ b/android_webview/native/cookie_manager.cc @@ -28,11 +28,11 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/cookie_crypto_delegate.h" #include "content/public/browser/cookie_store_factory.h" -#include "content/public/common/url_constants.h" #include "jni/AwCookieManager_jni.h" #include "net/cookies/cookie_monster.h" #include "net/cookies/cookie_options.h" #include "net/url_request/url_request_context.h" +#include "url/url_constants.h" using base::FilePath; using base::WaitableEvent; @@ -508,7 +508,7 @@ bool CookieManager::AllowFileSchemeCookies() { } bool CookieManager::AllowFileSchemeCookiesLocked() { - return cookie_monster_->IsCookieableScheme(content::kFileScheme); + return cookie_monster_->IsCookieableScheme(url::kFileScheme); } void CookieManager::SetAcceptFileSchemeCookies(bool accept) { diff --git a/android_webview/renderer/aw_render_view_ext.cc b/android_webview/renderer/aw_render_view_ext.cc index 033fce6..40991ab 100644 --- a/android_webview/renderer/aw_render_view_ext.cc +++ b/android_webview/renderer/aw_render_view_ext.cc @@ -12,7 +12,6 @@ #include "base/strings/string_piece.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" -#include "content/public/common/url_constants.h" #include "content/public/renderer/android_content_detection_prefixes.h" #include "content/public/renderer/document_state.h" #include "content/public/renderer/render_view.h" @@ -31,6 +30,7 @@ #include "third_party/WebKit/public/web/WebSecurityOrigin.h" #include "third_party/WebKit/public/web/WebView.h" #include "url/url_canon.h" +#include "url/url_constants.h" #include "url/url_util.h" namespace android_webview { @@ -117,7 +117,7 @@ void PopulateHitTestData(const GURL& absolute_link_url, data->img_src = absolute_image_url; const bool is_javascript_scheme = - absolute_link_url.SchemeIs(content::kJavaScriptScheme); + absolute_link_url.SchemeIs(url::kJavaScriptScheme); const bool has_link_url = !absolute_link_url.is_empty(); const bool has_image_url = !absolute_image_url.is_empty(); diff --git a/apps/shell/browser/shell_content_browser_client.cc b/apps/shell/browser/shell_content_browser_client.cc index c61a8c89..b0e9f7a 100644 --- a/apps/shell/browser/shell_content_browser_client.cc +++ b/apps/shell/browser/shell_content_browser_client.cc @@ -100,12 +100,12 @@ bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { // Keep in sync with ProtocolHandlers added in CreateRequestContext() and in // content::ShellURLRequestContextGetter::GetURLRequestContext(). static const char* const kProtocolList[] = { - content::kBlobScheme, + url::kBlobScheme, content::kChromeDevToolsScheme, content::kChromeUIScheme, - content::kDataScheme, - content::kFileScheme, - content::kFileSystemScheme, + url::kDataScheme, + url::kFileScheme, + url::kFileSystemScheme, extensions::kExtensionScheme, extensions::kExtensionResourceScheme, }; diff --git a/chrome/browser/autocomplete/autocomplete_input.cc b/chrome/browser/autocomplete/autocomplete_input.cc index d81e728..af34933 100644 --- a/chrome/browser/autocomplete/autocomplete_input.cc +++ b/chrome/browser/autocomplete/autocomplete_input.cc @@ -161,7 +161,7 @@ AutocompleteInput::Type AutocompleteInput::Parse( if (!canonicalized_url->is_valid()) return QUERY; - if (LowerCaseEqualsASCII(parsed_scheme, content::kFileScheme)) { + if (LowerCaseEqualsASCII(parsed_scheme, url::kFileScheme)) { // A user might or might not type a scheme when entering a file URL. In // either case, |parsed_scheme| will tell us that this is a file URL, but // |parts->scheme| might be empty, e.g. if the user typed "C:\foo". @@ -184,8 +184,8 @@ AutocompleteInput::Type AutocompleteInput::Parse( // still claim to handle them. if (ProfileIOData::IsHandledProtocol(base::UTF16ToASCII(parsed_scheme)) || LowerCaseEqualsASCII(parsed_scheme, content::kViewSourceScheme) || - LowerCaseEqualsASCII(parsed_scheme, content::kJavaScriptScheme) || - LowerCaseEqualsASCII(parsed_scheme, content::kDataScheme)) + LowerCaseEqualsASCII(parsed_scheme, url::kJavaScriptScheme) || + LowerCaseEqualsASCII(parsed_scheme, url::kDataScheme)) return URL; // Not an internal protocol. Check and see if the user has explicitly @@ -456,7 +456,7 @@ void AutocompleteInput::ParseForEmphasizeComponents(const base::string16& text, host->reset(); } } - } else if (LowerCaseEqualsASCII(scheme_str, content::kFileSystemScheme) && + } else if (LowerCaseEqualsASCII(scheme_str, url::kFileSystemScheme) && parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) { *host = parts.inner_parsed()->host; } diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index 6260cf6..22b8bb3 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -39,7 +39,6 @@ #include "chrome/browser/ui/search/instant_controller.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" -#include "chrome/common/url_constants.h" #include "content/public/browser/user_metrics.h" #include "grit/generated_resources.h" #include "net/base/escape.h" @@ -49,6 +48,7 @@ #include "net/url_request/url_fetcher.h" #include "net/url_request/url_request_status.h" #include "ui/base/l10n/l10n_util.h" +#include "url/url_constants.h" #include "url/url_util.h" // Helpers -------------------------------------------------------------------- @@ -564,7 +564,7 @@ bool SearchProvider::IsQuerySuitableForSuggest() const { // assume we're OK. if (!LowerCaseEqualsASCII(input_.scheme(), url::kHttpScheme) && !LowerCaseEqualsASCII(input_.scheme(), url::kHttpsScheme) && - !LowerCaseEqualsASCII(input_.scheme(), content::kFtpScheme)) + !LowerCaseEqualsASCII(input_.scheme(), url::kFtpScheme)) return (input_.type() == AutocompleteInput::QUERY); // Don't send URLs with usernames, queries or refs. Some of these are diff --git a/chrome/browser/browsing_data/browsing_data_helper.cc b/chrome/browser/browsing_data/browsing_data_helper.cc index 580952b..a110d6c 100644 --- a/chrome/browser/browsing_data/browsing_data_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_helper.cc @@ -17,7 +17,7 @@ bool BrowsingDataHelper::IsWebScheme(const std::string& scheme) { // Special-case `file://` scheme iff cookies and site data are enabled via // the `--allow-file-cookies` CLI flag. - if (scheme == content::kFileScheme) { + if (scheme == url::kFileScheme) { return CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableFileCookies); diff --git a/chrome/browser/browsing_data/browsing_data_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_helper_unittest.cc index 5e3dd80..f39c4a9 100644 --- a/chrome/browser/browsing_data/browsing_data_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_helper_unittest.cc @@ -7,10 +7,10 @@ #include "base/strings/stringprintf.h" #include "chrome/browser/extensions/mock_extension_special_storage_policy.h" #include "chrome/common/url_constants.h" -#include "content/public/common/url_constants.h" #include "extensions/common/constants.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" +#include "url/url_constants.h" namespace { @@ -60,11 +60,11 @@ class BrowsingDataHelperTest : public testing::Test { TEST_F(BrowsingDataHelperTest, WebSafeSchemesAreWebSafe) { EXPECT_TRUE(IsWebScheme(url::kHttpScheme)); EXPECT_TRUE(IsWebScheme(url::kHttpsScheme)); - EXPECT_TRUE(IsWebScheme(content::kFtpScheme)); - EXPECT_TRUE(IsWebScheme(content::kDataScheme)); + EXPECT_TRUE(IsWebScheme(url::kFtpScheme)); + EXPECT_TRUE(IsWebScheme(url::kDataScheme)); EXPECT_TRUE(IsWebScheme("feed")); - EXPECT_TRUE(IsWebScheme(content::kBlobScheme)); - EXPECT_TRUE(IsWebScheme(content::kFileSystemScheme)); + EXPECT_TRUE(IsWebScheme(url::kBlobScheme)); + EXPECT_TRUE(IsWebScheme(url::kFileSystemScheme)); EXPECT_FALSE(IsWebScheme("invalid-scheme-i-just-made-up")); } @@ -73,8 +73,8 @@ TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotWebSafe) { EXPECT_FALSE(IsWebScheme(content::kAboutScheme)); EXPECT_FALSE(IsWebScheme(content::kChromeDevToolsScheme)); EXPECT_FALSE(IsWebScheme(content::kChromeUIScheme)); - EXPECT_FALSE(IsWebScheme(content::kJavaScriptScheme)); - EXPECT_FALSE(IsWebScheme(content::kMailToScheme)); + EXPECT_FALSE(IsWebScheme(url::kJavaScriptScheme)); + EXPECT_FALSE(IsWebScheme(url::kMailToScheme)); EXPECT_FALSE(IsWebScheme(content::kMetadataScheme)); EXPECT_FALSE(IsWebScheme(content::kSwappedOutScheme)); EXPECT_FALSE(IsWebScheme(content::kViewSourceScheme)); @@ -83,11 +83,11 @@ TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotWebSafe) { TEST_F(BrowsingDataHelperTest, WebSafeSchemesAreNotExtensions) { EXPECT_FALSE(IsExtensionScheme(url::kHttpScheme)); EXPECT_FALSE(IsExtensionScheme(url::kHttpsScheme)); - EXPECT_FALSE(IsExtensionScheme(content::kFtpScheme)); - EXPECT_FALSE(IsExtensionScheme(content::kDataScheme)); + EXPECT_FALSE(IsExtensionScheme(url::kFtpScheme)); + EXPECT_FALSE(IsExtensionScheme(url::kDataScheme)); EXPECT_FALSE(IsExtensionScheme("feed")); - EXPECT_FALSE(IsExtensionScheme(content::kBlobScheme)); - EXPECT_FALSE(IsExtensionScheme(content::kFileSystemScheme)); + EXPECT_FALSE(IsExtensionScheme(url::kBlobScheme)); + EXPECT_FALSE(IsExtensionScheme(url::kFileSystemScheme)); EXPECT_FALSE(IsExtensionScheme("invalid-scheme-i-just-made-up")); } @@ -97,8 +97,8 @@ TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotAllExtension) { EXPECT_FALSE(IsExtensionScheme(content::kAboutScheme)); EXPECT_FALSE(IsExtensionScheme(content::kChromeDevToolsScheme)); EXPECT_FALSE(IsExtensionScheme(content::kChromeUIScheme)); - EXPECT_FALSE(IsExtensionScheme(content::kJavaScriptScheme)); - EXPECT_FALSE(IsExtensionScheme(content::kMailToScheme)); + EXPECT_FALSE(IsExtensionScheme(url::kJavaScriptScheme)); + EXPECT_FALSE(IsExtensionScheme(url::kMailToScheme)); EXPECT_FALSE(IsExtensionScheme(content::kMetadataScheme)); EXPECT_FALSE(IsExtensionScheme(content::kSwappedOutScheme)); EXPECT_FALSE(IsExtensionScheme(content::kViewSourceScheme)); diff --git a/chrome/browser/browsing_data/cookies_tree_model.cc b/chrome/browser/browsing_data/cookies_tree_model.cc index 0fb14e5..b6bb571 100644 --- a/chrome/browser/browsing_data/cookies_tree_model.cc +++ b/chrome/browser/browsing_data/cookies_tree_model.cc @@ -72,7 +72,7 @@ std::string CanonicalizeHost(const GURL& url) { // "google.com". if (url.SchemeIsFile()) { - return std::string(content::kFileScheme) + + return std::string(url::kFileScheme) + content::kStandardSchemeSeparator; } @@ -559,7 +559,7 @@ CookieTreeNode::DetailedInfo CookieTreeRootNode::GetDetailedInfo() const { // static base::string16 CookieTreeHostNode::TitleForUrl(const GURL& url) { const std::string file_origin_node_name( - std::string(content::kFileScheme) + content::kStandardSchemeSeparator); + std::string(url::kFileScheme) + content::kStandardSchemeSeparator); return base::UTF8ToUTF16(url.SchemeIsFile() ? file_origin_node_name : url.host()); } @@ -583,7 +583,7 @@ CookieTreeHostNode::~CookieTreeHostNode() {} const std::string CookieTreeHostNode::GetHost() const { const std::string file_origin_node_name( - std::string(content::kFileScheme) + content::kStandardSchemeSeparator); + std::string(url::kFileScheme) + content::kStandardSchemeSeparator); return url_.SchemeIsFile() ? file_origin_node_name : url_.host(); } diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc index 8821fca..6c6292d 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc @@ -1173,7 +1173,7 @@ bool TabsUpdateFunction::UpdateURL(const std::string &url_string, // JavaScript URLs can do the same kinds of things as cross-origin XHR, so // we need to check host permissions before allowing them. - if (url.SchemeIs(content::kJavaScriptScheme)) { + if (url.SchemeIs(url::kJavaScriptScheme)) { content::RenderProcessHost* process = web_contents_->GetRenderProcessHost(); if (!PermissionsData::CanExecuteScriptOnPage( GetExtension(), @@ -1210,7 +1210,7 @@ bool TabsUpdateFunction::UpdateURL(const std::string &url_string, // The URL of a tab contents never actually changes to a JavaScript URL, so // this check only makes sense in other cases. - if (!url.SchemeIs(content::kJavaScriptScheme)) + if (!url.SchemeIs(url::kJavaScriptScheme)) DCHECK_EQ(url.spec(), web_contents_->GetURL().spec()); return true; 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 9cd4349..c322615 100644 --- a/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc +++ b/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc @@ -17,11 +17,11 @@ const char* kValidSchemes[] = { content::kChromeUIScheme, url::kHttpScheme, url::kHttpsScheme, - content::kFileScheme, - content::kFtpScheme, - content::kJavaScriptScheme, - content::kDataScheme, - content::kFileSystemScheme, + url::kFileScheme, + url::kFtpScheme, + url::kJavaScriptScheme, + url::kDataScheme, + url::kFileSystemScheme, }; } // namespace diff --git a/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc b/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc index 1c62081..5e24399 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_helpers.cc @@ -17,7 +17,6 @@ #include "chrome/browser/extensions/extension_warning_set.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/renderer_host/web_cache_manager.h" -#include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "extensions/browser/extension_system.h" @@ -27,6 +26,7 @@ #include "net/cookies/parsed_cookie.h" #include "net/http/http_util.h" #include "net/url_request/url_request.h" +#include "url/url_constants.h" // TODO(battre): move all static functions into an anonymous namespace at the // top of this file. @@ -427,7 +427,7 @@ static bool MergeRedirectUrlOfResponsesHelper( if ((*delta)->new_url.is_empty()) continue; if (consider_only_cancel_scheme_urls && - !(*delta)->new_url.SchemeIs(content::kDataScheme) && + !(*delta)->new_url.SchemeIs(url::kDataScheme) && (*delta)->new_url.spec() != "about:blank") { continue; } 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 3bda598..2625c20 100644 --- a/chrome/browser/extensions/api/web_request/web_request_permissions.cc +++ b/chrome/browser/extensions/api/web_request/web_request_permissions.cc @@ -69,9 +69,9 @@ bool IsSensitiveURL(const GURL& url) { // covered by CanExtensionAccessURL. bool HasWebRequestScheme(const GURL& url) { return (url.SchemeIs(content::kAboutScheme) || - url.SchemeIs(content::kFileScheme) || - url.SchemeIs(content::kFileSystemScheme) || - url.SchemeIs(content::kFtpScheme) || + url.SchemeIs(url::kFileScheme) || + url.SchemeIs(url::kFileSystemScheme) || + url.SchemeIs(url::kFtpScheme) || url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme) || url.SchemeIs(extensions::kExtensionScheme)); diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc index ae77819..981e166 100644 --- a/chrome/browser/guest_view/web_view/web_view_guest.cc +++ b/chrome/browser/guest_view/web_view/web_view_guest.cc @@ -1071,7 +1071,7 @@ void WebViewGuest::NavigateGuest(const std::string& src) { (!content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( url.scheme()) && !url.SchemeIs(content::kAboutScheme)) || - url.SchemeIs(content::kJavaScriptScheme); + url.SchemeIs(url::kJavaScriptScheme); if (scheme_is_blocked || !url.is_valid()) { std::string error_type; base::RemoveChars(net::ErrorToString(net::ERR_ABORTED), "net::", diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 41cc227..37322e3 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -407,7 +407,7 @@ void HistoryBackend::AddPage(const HistoryAddPageArgs& request) { request.redirects[0] : request.url); if (origin_url.SchemeIs(url::kHttpScheme) || origin_url.SchemeIs(url::kHttpsScheme) || - origin_url.SchemeIs(content::kFtpScheme)) { + origin_url.SchemeIs(url::kFtpScheme)) { std::string host(origin_url.host()); size_t registry_length = net::registry_controlled_domains::GetRegistryLength( diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc index 2f3a300..3a4c0a5 100644 --- a/chrome/browser/history/history_service.cc +++ b/chrome/browser/history/history_service.cc @@ -979,7 +979,7 @@ bool HistoryService::CanAddURL(const GURL& url) { // TODO: We should allow kChromeUIScheme URLs if they have been explicitly // typed. Right now, however, these are marked as typed even when triggered // by a shortcut or menu action. - if (url.SchemeIs(content::kJavaScriptScheme) || + if (url.SchemeIs(url::kJavaScriptScheme) || url.SchemeIs(content::kChromeDevToolsScheme) || url.SchemeIs(content::kChromeUIScheme) || url.SchemeIs(content::kViewSourceScheme) || diff --git a/chrome/browser/history/in_memory_url_index.cc b/chrome/browser/history/in_memory_url_index.cc index cb09763..029e56a 100644 --- a/chrome/browser/history/in_memory_url_index.cc +++ b/chrome/browser/history/in_memory_url_index.cc @@ -40,11 +40,11 @@ void InitializeSchemeWhitelist(std::set<std::string>* whitelist) { return; // Nothing to do, already initialized. whitelist->insert(std::string(content::kAboutScheme)); whitelist->insert(std::string(content::kChromeUIScheme)); - whitelist->insert(std::string(content::kFileScheme)); - whitelist->insert(std::string(content::kFtpScheme)); + whitelist->insert(std::string(url::kFileScheme)); + whitelist->insert(std::string(url::kFtpScheme)); whitelist->insert(std::string(url::kHttpScheme)); whitelist->insert(std::string(url::kHttpsScheme)); - whitelist->insert(std::string(content::kMailToScheme)); + whitelist->insert(std::string(url::kMailToScheme)); } // Restore/SaveCacheObserver --------------------------------------------------- diff --git a/chrome/browser/history/url_database.cc b/chrome/browser/history/url_database.cc index 9de3e1a..e114afe 100644 --- a/chrome/browser/history/url_database.cc +++ b/chrome/browser/history/url_database.cc @@ -315,7 +315,7 @@ bool URLDatabase::IsTypedHost(const std::string& host) { const char* schemes[] = { url::kHttpScheme, url::kHttpsScheme, - content::kFtpScheme + url::kFtpScheme }; URLRows dummy; for (size_t i = 0; i < arraysize(schemes); ++i) { diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 540a26f..6893de8 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -41,7 +41,6 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/pref_names.h" -#include "chrome/common/url_constants.h" #include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h" #include "components/data_reduction_proxy/browser/http_auth_handler_data_reduction_proxy.h" #include "components/policy/core/common/policy_service.h" @@ -80,6 +79,7 @@ #include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_throttler_manager.h" #include "net/websockets/websocket_job.h" +#include "url/url_constants.h" #if defined(ENABLE_CONFIGURATION_POLICY) #include "policy/policy_constants.h" @@ -655,10 +655,10 @@ void IOThread::InitAsync() { TRACE_EVENT_END0("startup", "IOThread::InitAsync:HttpNetworkSession"); scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( new net::URLRequestJobFactoryImpl()); - job_factory->SetProtocolHandler(content::kDataScheme, + job_factory->SetProtocolHandler(url::kDataScheme, new net::DataProtocolHandler()); job_factory->SetProtocolHandler( - content::kFileScheme, + url::kFileScheme, new net::FileProtocolHandler( content::BrowserThread::GetBlockingPool()-> GetTaskRunnerWithShutdownBehavior( @@ -667,7 +667,7 @@ void IOThread::InitAsync() { globals_->proxy_script_fetcher_ftp_transaction_factory.reset( new net::FtpNetworkLayer(globals_->host_resolver.get())); job_factory->SetProtocolHandler( - content::kFtpScheme, + url::kFtpScheme, new net::FtpProtocolHandler( globals_->proxy_script_fetcher_ftp_transaction_factory.get())); #endif diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 520e762..918f919 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -613,22 +613,22 @@ ProfileIOData* ProfileIOData::FromResourceContext( bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { DCHECK_EQ(scheme, StringToLowerASCII(scheme)); static const char* const kProtocolList[] = { - content::kFileScheme, + url::kFileScheme, content::kChromeDevToolsScheme, chrome::kDomDistillerScheme, extensions::kExtensionScheme, extensions::kExtensionResourceScheme, content::kChromeUIScheme, - content::kDataScheme, + url::kDataScheme, #if defined(OS_CHROMEOS) chrome::kDriveScheme, #endif // defined(OS_CHROMEOS) content::kAboutScheme, #if !defined(DISABLE_FTP_SUPPORT) - content::kFtpScheme, + url::kFtpScheme, #endif // !defined(DISABLE_FTP_SUPPORT) - content::kBlobScheme, - content::kFileSystemScheme, + url::kBlobScheme, + url::kFileSystemScheme, chrome::kChromeSearchScheme, }; for (size_t i = 0; i < arraysize(kProtocolList); ++i) { @@ -1031,7 +1031,7 @@ scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( // NOTE(willchan): Keep these protocol handlers in sync with // ProfileIOData::IsHandledProtocol(). bool set_protocol = job_factory->SetProtocolHandler( - content::kFileScheme, + url::kFileScheme, new net::FileProtocolHandler( content::BrowserThread::GetBlockingPool()-> GetTaskRunnerWithShutdownBehavior( @@ -1051,7 +1051,7 @@ scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( CreateExtensionResourceProtocolHandler()); DCHECK(set_protocol); set_protocol = job_factory->SetProtocolHandler( - content::kDataScheme, new net::DataProtocolHandler()); + url::kDataScheme, new net::DataProtocolHandler()); DCHECK(set_protocol); #if defined(OS_CHROMEOS) if (!IsOffTheRecord() && profile_params_) { @@ -1067,7 +1067,7 @@ scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( #if !defined(DISABLE_FTP_SUPPORT) DCHECK(ftp_transaction_factory); job_factory->SetProtocolHandler( - content::kFtpScheme, + url::kFtpScheme, new net::FtpProtocolHandler(ftp_transaction_factory)); #endif // !defined(DISABLE_FTP_SUPPORT) diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index 661db61..be70702 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc @@ -803,7 +803,7 @@ void RenderViewContextMenu::AppendLinkItems() { menu_model_.AddItemWithStringId( IDC_CONTENT_CONTEXT_COPYLINKLOCATION, - params_.link_url.SchemeIs(content::kMailToScheme) ? + params_.link_url.SchemeIs(url::kMailToScheme) ? IDS_CONTENT_CONTEXT_COPYEMAILADDRESS : IDS_CONTENT_CONTEXT_COPYLINKLOCATION); } diff --git a/chrome/browser/renderer_host/offline_resource_throttle.cc b/chrome/browser/renderer_host/offline_resource_throttle.cc index f37b998..272785c 100644 --- a/chrome/browser/renderer_host/offline_resource_throttle.cc +++ b/chrome/browser/renderer_host/offline_resource_throttle.cc @@ -13,7 +13,6 @@ #include "base/strings/string_util.h" #include "chrome/browser/chromeos/offline/offline_load_page.h" #include "chrome/browser/net/chrome_url_request_context.h" -#include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/resource_controller.h" @@ -24,6 +23,7 @@ #include "net/base/network_change_notifier.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" +#include "url/url_constants.h" #include "webkit/browser/appcache/appcache_service.h" using content::BrowserThread; @@ -118,7 +118,7 @@ void OfflineResourceThrottle::OnBlockingPageComplete(bool proceed) { } bool OfflineResourceThrottle::IsRemote(const GURL& url) const { - return !net::IsLocalhost(url.host()) && (url.SchemeIs(content::kFtpScheme) || + return !net::IsLocalhost(url.host()) && (url.SchemeIs(url::kFtpScheme) || url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme)); } diff --git a/chrome/browser/safe_browsing/database_manager.cc b/chrome/browser/safe_browsing/database_manager.cc index ca5ecba..fa0a46e 100644 --- a/chrome/browser/safe_browsing/database_manager.cc +++ b/chrome/browser/safe_browsing/database_manager.cc @@ -30,10 +30,10 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/url_constants.h" #include "components/startup_metric_utils/startup_metric_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +#include "url/url_constants.h" using content::BrowserThread; @@ -221,7 +221,7 @@ SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() { } bool SafeBrowsingDatabaseManager::CanCheckUrl(const GURL& url) const { - return url.SchemeIs(content::kFtpScheme) || + return url.SchemeIs(url::kFtpScheme) || url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme); } diff --git a/chrome/browser/search_engines/template_url_parser.cc b/chrome/browser/search_engines/template_url_parser.cc index 5669a2c..6fe0b86 100644 --- a/chrome/browser/search_engines/template_url_parser.cc +++ b/chrome/browser/search_engines/template_url_parser.cc @@ -16,11 +16,11 @@ #include "chrome/browser/search_engines/search_terms_data.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url_service.h" -#include "chrome/common/url_constants.h" #include "libxml/parser.h" #include "libxml/xmlwriter.h" #include "ui/gfx/favicon_size.h" #include "url/gurl.h" +#include "url/url_constants.h" namespace { @@ -246,7 +246,7 @@ void TemplateURLParsingContext::EndElementImpl(void* ctx, const xmlChar* name) { break; case TemplateURLParsingContext::IMAGE: { GURL image_url(base::UTF16ToUTF8(context->string_)); - if (image_url.SchemeIs(content::kDataScheme)) { + if (image_url.SchemeIs(url::kDataScheme)) { // TODO (jcampan): bug 1169256: when dealing with data URL, we need to // decode the data URL in the renderer. For now, we'll just point to the // favicon from the URL. diff --git a/chrome/browser/translate/translate_service.cc b/chrome/browser/translate/translate_service.cc index a1899a8..5507846 100644 --- a/chrome/browser/translate/translate_service.cc +++ b/chrome/browser/translate/translate_service.cc @@ -131,5 +131,5 @@ bool TranslateService::IsTranslatableURL(const GURL& url) { !(url.SchemeIs(extensions::kExtensionScheme) && url.DomainIs(file_manager::kFileManagerAppId)) && #endif - !url.SchemeIs(content::kFtpScheme); + !url.SchemeIs(url::kFtpScheme); } diff --git a/chrome/browser/translate/translate_service_unittest.cc b/chrome/browser/translate/translate_service_unittest.cc index 9628fce..fa9574c 100644 --- a/chrome/browser/translate/translate_service_unittest.cc +++ b/chrome/browser/translate/translate_service_unittest.cc @@ -33,7 +33,7 @@ TEST(TranslateServiceTest, CheckTranslatableURL) { EXPECT_FALSE(TranslateService::IsTranslatableURL(filemanager_url)); #endif - std::string ftp = std::string(content::kFtpScheme) + "://google.com/pub"; + std::string ftp = std::string(url::kFtpScheme) + "://google.com/pub"; GURL ftp_url = GURL(ftp); EXPECT_FALSE(TranslateService::IsTranslatableURL(ftp_url)); 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 73bcf1db..a7bcf57 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 @@ -12,8 +12,8 @@ #include "chrome/browser/search/search.h" #include "chrome/browser/ui/app_list/search/common/webservice_cache.h" #include "chrome/browser/ui/app_list/search/common/webservice_cache_factory.h" -#include "chrome/common/url_constants.h" #include "url/gurl.h" +#include "url/url_constants.h" namespace app_list { @@ -71,7 +71,7 @@ bool WebserviceSearchProvider::IsSensitiveInput(const base::string16& query) { // file, we shouldn't send it. Sending such things is a waste of time and a // disclosure of potentially private, local data. If the scheme is OK, we // still need to check other cases below. - if (LowerCaseEqualsASCII(query_as_url.scheme(), content::kFileScheme)) + if (LowerCaseEqualsASCII(query_as_url.scheme(), url::kFileScheme)) return true; // Don't send URLs with usernames, queries or refs. Some of these are diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index d0dff8f..094aec1 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -1109,7 +1109,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFile) { FILE_PATH_LITERAL("empty.html"); GURL file_url(ui_test_utils::GetTestUrl(base::FilePath( base::FilePath::kCurrentDirectory), base::FilePath(kEmptyFile))); - ASSERT_TRUE(file_url.SchemeIs(content::kFileScheme)); + ASSERT_TRUE(file_url.SchemeIs(url::kFileScheme)); ui_test_utils::NavigateToURL(browser(), file_url); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); } @@ -1148,7 +1148,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { base::FilePath(kDocRoot)); ASSERT_TRUE(test_server.Start()); GURL ftp_url(test_server.GetURL(std::string())); - ASSERT_TRUE(ftp_url.SchemeIs(content::kFtpScheme)); + ASSERT_TRUE(ftp_url.SchemeIs(url::kFtpScheme)); ui_test_utils::NavigateToURL(browser(), ftp_url); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); } @@ -1254,7 +1254,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_FaviconChange) { FILE_PATH_LITERAL("onload_change_favicon.html"); GURL file_url(ui_test_utils::GetTestUrl(base::FilePath( base::FilePath::kCurrentDirectory), base::FilePath(kFile))); - ASSERT_TRUE(file_url.SchemeIs(content::kFileScheme)); + ASSERT_TRUE(file_url.SchemeIs(url::kFileScheme)); ui_test_utils::NavigateToURL(browser(), file_url); NavigationEntry* entry = browser()->tab_strip_model()-> diff --git a/chrome/browser/ui/cocoa/drag_util.mm b/chrome/browser/ui/cocoa/drag_util.mm index 7dff793..d1dfd37 100644 --- a/chrome/browser/ui/cocoa/drag_util.mm +++ b/chrome/browser/ui/cocoa/drag_util.mm @@ -7,7 +7,6 @@ #include "base/files/file_path.h" #include "chrome/browser/profiles/profile.h" #include "content/public/browser/plugin_service.h" -#include "content/public/common/url_constants.h" #include "content/public/common/webplugininfo.h" #include "ipc/ipc_message.h" #include "net/base/filename_util.h" @@ -15,6 +14,7 @@ #import "third_party/mozilla/NSPasteboard+Utils.h" #import "ui/base/dragdrop/cocoa_dnd_util.h" #include "url/gurl.h" +#include "url/url_constants.h" using content::PluginService; @@ -58,7 +58,7 @@ GURL GetFileURLFromDropData(id<NSDraggingInfo> info) { [info draggingPasteboard], YES); - if (url.SchemeIs(content::kFileScheme)) + if (url.SchemeIs(url::kFileScheme)) return url; } return GURL(); diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm index 27ee8ca..432bbc8 100644 --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm @@ -818,7 +818,7 @@ class NotificationBridge GURL url(URLFixerUpper::FixupURL( base::SysNSStringToUTF8([urls objectAtIndex:0]), std::string())); - if (url.SchemeIs(content::kJavaScriptScheme)) { + if (url.SchemeIs(url::kJavaScriptScheme)) { browser_->window()->GetLocationBar()->GetOmniboxView()->SetUserText( OmniboxView::StripJavascriptSchemas(base::UTF8ToUTF16(url.spec()))); } diff --git a/chrome/browser/ui/omnibox/omnibox_view.cc b/chrome/browser/ui/omnibox/omnibox_view.cc index 22b9732..46ec47a 100644 --- a/chrome/browser/ui/omnibox/omnibox_view.cc +++ b/chrome/browser/ui/omnibox/omnibox_view.cc @@ -24,7 +24,7 @@ // static base::string16 OmniboxView::StripJavascriptSchemas(const base::string16& text) { const base::string16 kJsPrefix( - base::ASCIIToUTF16(content::kJavaScriptScheme) + base::ASCIIToUTF16(":")); + base::ASCIIToUTF16(url::kJavaScriptScheme) + base::ASCIIToUTF16(":")); base::string16 out(text); while (StartsWith(out, kJsPrefix, false)) { base::TrimWhitespace(out.substr(kJsPrefix.length()), base::TRIM_LEADING, diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index 122e0a4..0971f0e 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc @@ -438,7 +438,7 @@ std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine( ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance(); if (policy->IsWebSafeScheme(url.scheme()) || - url.SchemeIs(content::kFileScheme) || + url.SchemeIs(url::kFileScheme) || #if defined(OS_CHROMEOS) // In ChromeOS, allow a settings page to be specified on the // command line. See ExistingUserController::OnLoginSuccess. diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index d912d94..0dcc7db 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -503,7 +503,7 @@ bool StartupBrowserCreatorImpl::OpenApplicationWindow( ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance(); if (policy->IsWebSafeScheme(url.scheme()) || - url.SchemeIs(content::kFileScheme)) { + url.SchemeIs(url::kFileScheme)) { const extensions::Extension* extension = extensions::ExtensionRegistry::Get(profile) ->enabled_extensions().GetAppByURL(url); diff --git a/chrome/browser/ui/toolbar/origin_chip_info.cc b/chrome/browser/ui/toolbar/origin_chip_info.cc index 66034df..bc5e601 100644 --- a/chrome/browser/ui/toolbar/origin_chip_info.cc +++ b/chrome/browser/ui/toolbar/origin_chip_info.cc @@ -197,7 +197,7 @@ base::string16 OriginChip::LabelFromURLForProfile(const GURL& provided_url, base::UTF8ToUTF16(extension->name()) : base::UTF8ToUTF16(url.host()); } - if (url.SchemeIsHTTPOrHTTPS() || url.SchemeIs(content::kFtpScheme)) { + if (url.SchemeIsHTTPOrHTTPS() || url.SchemeIs(url::kFtpScheme)) { // See ToolbarModelImpl::GetText(). Does not pay attention to any user // edits, and uses GetURL/net::FormatUrl -- We don't really care about // length or the autocomplete parser. @@ -230,14 +230,14 @@ base::string16 OriginChip::LabelFromURLForProfile(const GURL& provided_url, // to see. In these cases, the site chip will display the first // part of the full URL. if (url.SchemeIs(chrome::kChromeNativeScheme) || - url.SchemeIs(content::kBlobScheme) || + url.SchemeIs(url::kBlobScheme) || url.SchemeIs(content::kChromeDevToolsScheme) || - url.SchemeIs(content::kDataScheme) || - url.SchemeIs(content::kFileScheme) || - url.SchemeIs(content::kFileSystemScheme) || + url.SchemeIs(url::kDataScheme) || + url.SchemeIs(url::kFileScheme) || + url.SchemeIs(url::kFileSystemScheme) || url.SchemeIs(content::kGuestScheme) || - url.SchemeIs(content::kJavaScriptScheme) || - url.SchemeIs(content::kMailToScheme) || + url.SchemeIs(url::kJavaScriptScheme) || + url.SchemeIs(url::kMailToScheme) || url.SchemeIs(content::kMetadataScheme) || url.SchemeIs(content::kSwappedOutScheme)) { std::string truncated_url; diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 1d88667..7f99645 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -20,7 +20,6 @@ #include "chrome/common/chrome_version_info.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" #include "chrome/common/pref_names.h" -#include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" @@ -32,6 +31,7 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/image/image_family.h" #include "ui/gfx/image/image_skia.h" +#include "url/url_constants.h" #if defined(OS_WIN) #include "ui/gfx/icon_util.h" @@ -403,9 +403,9 @@ void UpdateAllShortcuts(const base::string16& old_app_title, bool IsValidUrl(const GURL& url) { static const char* const kValidUrlSchemes[] = { - content::kFileScheme, - content::kFileSystemScheme, - content::kFtpScheme, + url::kFileScheme, + url::kFileSystemScheme, + url::kFtpScheme, url::kHttpScheme, url::kHttpsScheme, extensions::kExtensionScheme, diff --git a/chrome/common/content_settings_pattern.cc b/chrome/common/content_settings_pattern.cc index bfaa66e..f0b12a0 100644 --- a/chrome/common/content_settings_pattern.cc +++ b/chrome/common/content_settings_pattern.cc @@ -179,11 +179,11 @@ bool ContentSettingsPattern::Builder::Canonicalize(PatternParts* parts) { const std::string scheme(StringToLowerASCII(parts->scheme)); parts->scheme = scheme; - if (parts->scheme == std::string(content::kFileScheme) && + if (parts->scheme == std::string(url::kFileScheme) && !parts->is_path_wildcard) { - GURL url(std::string(content::kFileScheme) + - std::string(content::kStandardSchemeSeparator) + parts->path); - parts->path = url.path(); + GURL url(std::string(url::kFileScheme) + + std::string(content::kStandardSchemeSeparator) + parts->path); + parts->path = url.path(); } // Canonicalize the host part. @@ -213,7 +213,7 @@ bool ContentSettingsPattern::Builder::Validate(const PatternParts& parts) { } // file:// URL patterns have an empty host and port. - if (parts.scheme == std::string(content::kFileScheme)) { + if (parts.scheme == std::string(url::kFileScheme)) { if (parts.has_domain_wildcard || !parts.host.empty() || !parts.port.empty()) return false; if (parts.is_path_wildcard) @@ -254,7 +254,7 @@ bool ContentSettingsPattern::Builder::Validate(const PatternParts& parts) { bool ContentSettingsPattern::Builder::LegacyValidate( const PatternParts& parts) { // If the pattern is for a "file-pattern" test if it is valid. - if (parts.scheme == std::string(content::kFileScheme) && + if (parts.scheme == std::string(url::kFileScheme) && !parts.is_scheme_wildcard && parts.host.empty() && parts.port.empty()) @@ -457,7 +457,7 @@ bool ContentSettingsPattern::Matches( // TODO(markusheintz): Content settings should be defined for all files on // a machine. Unless there is a good use case for supporting paths for file // patterns, stop supporting path for file patterns. - if (!parts_.is_scheme_wildcard && scheme == content::kFileScheme) + if (!parts_.is_scheme_wildcard && scheme == url::kFileScheme) return parts_.is_path_wildcard || parts_.path == std::string(local_url->path()); diff --git a/chrome/common/content_settings_pattern_parser.cc b/chrome/common/content_settings_pattern_parser.cc index c8c22ed..2ec7ddf 100644 --- a/chrome/common/content_settings_pattern_parser.cc +++ b/chrome/common/content_settings_pattern_parser.cc @@ -173,7 +173,7 @@ void PatternParser::Parse(const std::string& pattern_spec, } } else { if (scheme != std::string(extensions::kExtensionScheme) && - scheme != std::string(content::kFileScheme)) + scheme != std::string(url::kFileScheme)) builder->WithPortWildcard(); } @@ -202,7 +202,7 @@ std::string PatternParser::ToString( if (!parts.is_scheme_wildcard) str += parts.scheme + content::kStandardSchemeSeparator; - if (parts.scheme == content::kFileScheme) { + if (parts.scheme == url::kFileScheme) { if (parts.is_path_wildcard) return str + kUrlPathSeparator + kPathWildcard; else diff --git a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc index 284d3b8..af1a5a2 100644 --- a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc +++ b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler.cc @@ -10,11 +10,11 @@ #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/common/extensions/extension_constants.h" -#include "content/public/common/url_constants.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/url_pattern.h" +#include "url/url_constants.h" namespace keys = extensions::manifest_keys; namespace errors = extensions::manifest_errors; @@ -197,7 +197,7 @@ FileBrowserHandler* LoadFileBrowserHandler( } StringToLowerASCII(&filter); if (!StartsWithASCII(filter, - std::string(content::kFileSystemScheme) + ':', + std::string(url::kFileSystemScheme) + ':', true)) { *error = extensions::ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidURLPatternError, filter); diff --git a/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc b/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc index 59944a8..5ca9f9a 100644 --- a/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc +++ b/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc @@ -172,7 +172,7 @@ bool LoadUserScriptFromDictionary(const base::DictionaryValue* content_script, pattern.valid_schemes() & ~URLPattern::SCHEME_CHROMEUI); } - if (pattern.MatchesScheme(content::kFileScheme) && + if (pattern.MatchesScheme(url::kFileScheme) && !PermissionsData::CanExecuteScriptEverywhere(extension)) { extension->set_wants_file_access(true); if (!(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS)) { diff --git a/chrome/common/net/url_fixer_upper.cc b/chrome/common/net/url_fixer_upper.cc index ea6555f..80b48c3 100644 --- a/chrome/common/net/url_fixer_upper.cc +++ b/chrome/common/net/url_fixer_upper.cc @@ -424,21 +424,21 @@ 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 : url::kHttpScheme; + url::kFtpScheme : url::kHttpScheme; } } // Proceed with about and chrome schemes, but not file or nonstandard schemes. if ((scheme != content::kAboutScheme) && (scheme != content::kChromeUIScheme) && - ((scheme == content::kFileScheme) || + ((scheme == url::kFileScheme) || !url::IsStandard(scheme.c_str(), url::Component(0, static_cast<int>(scheme.length()))))) { return scheme; } - if (scheme == content::kFileSystemScheme) { + if (scheme == url::kFileSystemScheme) { // Have the GURL parser do the heavy lifting for us. url::ParseFileSystemURL(text->data(), static_cast<int>(text->length()), parts); @@ -524,11 +524,11 @@ GURL URLFixerUpper::FixupURL(const std::string& text, } // We handle the file scheme separately. - if (scheme == content::kFileScheme) + if (scheme == url::kFileScheme) return GURL(parts.scheme.is_valid() ? text : FixupPath(text)); // We handle the filesystem scheme separately. - if (scheme == content::kFileSystemScheme) { + if (scheme == url::kFileSystemScheme) { if (parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) return GURL(text); return GURL(); diff --git a/chrome/common/net/url_util.cc b/chrome/common/net/url_util.cc index 0228379..2bc7a11 100644 --- a/chrome/common/net/url_util.cc +++ b/chrome/common/net/url_util.cc @@ -5,11 +5,11 @@ #include "chrome/common/net/url_util.h" #include "base/strings/utf_string_conversions.h" -#include "content/public/common/url_constants.h" #include "net/base/escape.h" #include "net/base/net_util.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" #include "url/gurl.h" +#include "url/url_constants.h" namespace chrome_common_net { @@ -21,7 +21,7 @@ void WriteURLToClipboard(const GURL& url, // Unescaping path and query is not a good idea because other applications // may not encode non-ASCII characters in UTF-8. See crbug.com/2820. - base::string16 text = url.SchemeIs(content::kMailToScheme) ? + base::string16 text = url.SchemeIs(url::kMailToScheme) ? base::ASCIIToUTF16(url.path()) : net::FormatUrl(url, languages, net::kFormatUrlOmitNothing, net::UnescapeRule::NONE, NULL, NULL, NULL); diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc index 62f2662..e38e9fb 100644 --- a/chrome/renderer/content_settings_observer.cc +++ b/chrome/renderer/content_settings_observer.cc @@ -247,7 +247,7 @@ void ContentSettingsObserver::DidCommitProvisionalLoad(bool is_new_navigation) { // If we start failing this DCHECK, please makes sure we don't regress // this bug: http://code.google.com/p/chromium/issues/detail?id=79304 DCHECK(frame->document().securityOrigin().toString() == "null" || - !url.SchemeIs(content::kDataScheme)); + !url.SchemeIs(url::kDataScheme)); } bool ContentSettingsObserver::allowDatabase(const WebString& name, @@ -697,8 +697,8 @@ bool ContentSettingsObserver::IsWhitelistedForContentSettings( // If the scheme is file:, an empty file name indicates a directory listing, // which requires JavaScript to function properly. - if (EqualsASCII(origin.protocol(), content::kFileScheme)) { - return document_url.SchemeIs(content::kFileScheme) && + if (EqualsASCII(origin.protocol(), url::kFileScheme)) { + return document_url.SchemeIs(url::kFileScheme) && document_url.ExtractFileName().empty(); } diff --git a/chrome/renderer/extensions/chrome_extension_helper.cc b/chrome/renderer/extensions/chrome_extension_helper.cc index 05ffc18..df7c4b2 100644 --- a/chrome/renderer/extensions/chrome_extension_helper.cc +++ b/chrome/renderer/extensions/chrome_extension_helper.cc @@ -7,11 +7,11 @@ #include "base/strings/string16.h" #include "chrome/common/extensions/chrome_extension_messages.h" #include "chrome/renderer/web_apps.h" -#include "content/public/common/url_constants.h" #include "content/public/renderer/render_view.h" #include "ipc/ipc_message_macros.h" #include "third_party/WebKit/public/web/WebView.h" #include "url/gurl.h" +#include "url/url_constants.h" namespace extensions { @@ -47,7 +47,7 @@ void ChromeExtensionHelper::OnGetApplicationInfo(int page_id) { // to decode arbitrary data URLs in the browser process. See // http://b/issue?id=1162972 for (size_t i = 0; i < app_info.icons.size(); ++i) { - if (app_info.icons[i].url.SchemeIs(content::kDataScheme)) { + if (app_info.icons[i].url.SchemeIs(url::kDataScheme)) { app_info.icons.erase(app_info.icons.begin() + i); --i; } diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc index f6d78a0..d96eb2cc 100644 --- a/chrome/renderer/searchbox/searchbox_extension.cc +++ b/chrome/renderer/searchbox/searchbox_extension.cc @@ -15,7 +15,6 @@ #include "chrome/common/ntp_logging_events.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/searchbox/searchbox.h" -#include "content/public/common/url_constants.h" #include "content/public/renderer/render_view.h" #include "extensions/common/extension.h" #include "grit/renderer_resources.h" @@ -28,6 +27,7 @@ #include "ui/base/window_open_disposition.h" #include "ui/events/keycodes/keyboard_codes.h" #include "url/gurl.h" +#include "url/url_constants.h" #include "v8/include/v8.h" namespace { @@ -1038,7 +1038,7 @@ void SearchBoxExtensionWrapper::NavigateContentWindow( // Navigate the main frame. if (destination_url.is_valid() && - !destination_url.SchemeIs(content::kJavaScriptScheme)) { + !destination_url.SchemeIs(url::kJavaScriptScheme)) { WindowOpenDisposition disposition = CURRENT_TAB; if (args[1]->IsNumber()) { disposition = (WindowOpenDisposition) args[1]->Uint32Value(); diff --git a/chrome/renderer/translate/translate_helper.cc b/chrome/renderer/translate/translate_helper.cc index f4af9dd..b3c758d 100644 --- a/chrome/renderer/translate/translate_helper.cc +++ b/chrome/renderer/translate/translate_helper.cc @@ -126,7 +126,7 @@ void TranslateHelper::PrepareForUrl(const GURL& url) { return; if (url.SchemeIs(content::kChromeDevToolsScheme)) return; - if (url.SchemeIs(content::kFtpScheme)) + if (url.SchemeIs(url::kFtpScheme)) return; #if defined(OS_CHROMEOS) if (url.SchemeIs(extensions::kExtensionScheme) && diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/importer/bookmark_html_reader.cc index dd44f5a..239a46e 100644 --- a/chrome/utility/importer/bookmark_html_reader.cc +++ b/chrome/utility/importer/bookmark_html_reader.cc @@ -14,10 +14,10 @@ #include "chrome/common/importer/imported_bookmark_entry.h" #include "chrome/common/importer/imported_favicon_usage.h" #include "chrome/utility/importer/favicon_reencode.h" -#include "content/public/common/url_constants.h" #include "net/base/data_url.h" #include "net/base/escape.h" #include "url/gurl.h" +#include "url/url_constants.h" namespace { @@ -57,7 +57,7 @@ void DataURLToFaviconUsage( const GURL& favicon_data, std::vector<ImportedFaviconUsage>* favicons) { if (!link_url.is_valid() || !favicon_data.is_valid() || - !favicon_data.SchemeIs(content::kDataScheme)) + !favicon_data.SchemeIs(url::kDataScheme)) return; // Parse the data URL. diff --git a/chrome/utility/importer/ie_importer_win.cc b/chrome/utility/importer/ie_importer_win.cc index 1ba2d6b..1376ac9 100644 --- a/chrome/utility/importer/ie_importer_win.cc +++ b/chrome/utility/importer/ie_importer_win.cc @@ -36,12 +36,12 @@ #include "chrome/common/importer/importer_data_types.h" #include "chrome/common/importer/importer_url_row.h" #include "chrome/common/importer/pstore_declarations.h" -#include "chrome/common/url_constants.h" #include "chrome/utility/importer/favicon_reencode.h" #include "components/autofill/core/common/password_form.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "url/gurl.h" +#include "url/url_constants.h" namespace { @@ -470,8 +470,8 @@ void IEImporter::ImportFavorites() { void IEImporter::ImportHistory() { const std::string kSchemes[] = {url::kHttpScheme, url::kHttpsScheme, - content::kFtpScheme, - content::kFileScheme}; + url::kFtpScheme, + url::kFileScheme}; int total_schemes = arraysize(kSchemes); base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2; diff --git a/content/browser/android/load_url_params.cc b/content/browser/android/load_url_params.cc index 2c49e97..d276622 100644 --- a/content/browser/android/load_url_params.cc +++ b/content/browser/android/load_url_params.cc @@ -39,7 +39,7 @@ bool RegisterLoadUrlParams(JNIEnv* env) { jboolean IsDataScheme(JNIEnv* env, jclass clazz, jstring jurl) { GURL url(base::android::ConvertJavaStringToUTF8(env, jurl)); - return url.SchemeIs(kDataScheme); + return url.SchemeIs(url::kDataScheme); } } // namespace content diff --git a/content/browser/browser_url_handler_impl.cc b/content/browser/browser_url_handler_impl.cc index 21793a1..e67b517 100644 --- a/content/browser/browser_url_handler_impl.cc +++ b/content/browser/browser_url_handler_impl.cc @@ -26,11 +26,11 @@ static bool HandleViewSource(GURL* url, BrowserContext* browser_context) { static const char* const default_allowed_sub_schemes[] = { url::kHttpScheme, url::kHttpsScheme, - kFtpScheme, + url::kFtpScheme, kChromeDevToolsScheme, kChromeUIScheme, - kFileScheme, - kFileSystemScheme + url::kFileScheme, + url::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 2dddca6..57cb7fa 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc @@ -176,7 +176,7 @@ class ChildProcessSecurityPolicyImpl::SecurityState { // file:// URLs are more granular. The child may have been given // permission to a specific file but not the file:// scheme in general. - if (url.SchemeIs(kFileScheme)) { + if (url.SchemeIs(url::kFileScheme)) { base::FilePath path; if (net::FileURLToFilePath(url, &path)) return ContainsKey(request_file_set_, path); @@ -310,15 +310,15 @@ ChildProcessSecurityPolicyImpl::ChildProcessSecurityPolicyImpl() { // We know about these schemes and believe them to be safe. RegisterWebSafeScheme(url::kHttpScheme); RegisterWebSafeScheme(url::kHttpsScheme); - RegisterWebSafeScheme(kFtpScheme); - RegisterWebSafeScheme(kDataScheme); + RegisterWebSafeScheme(url::kFtpScheme); + RegisterWebSafeScheme(url::kDataScheme); RegisterWebSafeScheme("feed"); - RegisterWebSafeScheme(kBlobScheme); - RegisterWebSafeScheme(kFileSystemScheme); + RegisterWebSafeScheme(url::kBlobScheme); + RegisterWebSafeScheme(url::kFileSystemScheme); // We know about the following pseudo schemes and treat them specially. RegisterPseudoScheme(kAboutScheme); - RegisterPseudoScheme(kJavaScriptScheme); + RegisterPseudoScheme(url::kJavaScriptScheme); RegisterPseudoScheme(kViewSourceScheme); } @@ -434,7 +434,7 @@ void ChildProcessSecurityPolicyImpl::GrantRequestURL( void ChildProcessSecurityPolicyImpl::GrantRequestSpecificFileURL( int child_id, const GURL& url) { - if (!url.SchemeIs(kFileScheme)) + if (!url.SchemeIs(url::kFileScheme)) return; { @@ -558,7 +558,7 @@ void ChildProcessSecurityPolicyImpl::GrantWebUIBindings(int child_id) { state->second->GrantScheme(kChromeUIScheme); // Web UI pages can contain links to file:// URLs. - state->second->GrantScheme(kFileScheme); + state->second->GrantScheme(url::kFileScheme); } void ChildProcessSecurityPolicyImpl::GrantReadRawCookies(int child_id) { diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc index 78bee5b..d5115ebe 100644 --- a/content/browser/child_process_security_policy_unittest.cc +++ b/content/browser/child_process_security_policy_unittest.cc @@ -69,7 +69,7 @@ class ChildProcessSecurityPolicyTest : public testing::Test { // net::URLRequest::IsHandledURL() no longer claims support for default // protocols as this is the responsibility of the browser (which is // responsible for adding the appropriate ProtocolHandler). - test_browser_client_.AddScheme(kFileScheme); + test_browser_client_.AddScheme(url::kFileScheme); } virtual void TearDown() { @@ -122,11 +122,11 @@ TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) { 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(url::kFtpScheme)); + EXPECT_TRUE(p->IsWebSafeScheme(url::kDataScheme)); EXPECT_TRUE(p->IsWebSafeScheme("feed")); - EXPECT_TRUE(p->IsWebSafeScheme(kBlobScheme)); - EXPECT_TRUE(p->IsWebSafeScheme(kFileSystemScheme)); + EXPECT_TRUE(p->IsWebSafeScheme(url::kBlobScheme)); + EXPECT_TRUE(p->IsWebSafeScheme(url::kFileSystemScheme)); EXPECT_FALSE(p->IsWebSafeScheme("registered-web-safe-scheme")); p->RegisterWebSafeScheme("registered-web-safe-scheme"); @@ -140,7 +140,7 @@ TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) { ChildProcessSecurityPolicyImpl::GetInstance(); EXPECT_TRUE(p->IsPseudoScheme(kAboutScheme)); - EXPECT_TRUE(p->IsPseudoScheme(kJavaScriptScheme)); + EXPECT_TRUE(p->IsPseudoScheme(url::kJavaScriptScheme)); EXPECT_TRUE(p->IsPseudoScheme(kViewSourceScheme)); EXPECT_FALSE(p->IsPseudoScheme("registered-pseudo-scheme")); diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index b60c354..f98db11 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -38,12 +38,12 @@ #include "content/public/browser/notification_types.h" #include "content/public/browser/resource_context.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/url_constants.h" #include "net/base/filename_util.h" #include "net/base/io_buffer.h" #include "net/base/mime_util.h" #include "net/url_request/url_request_context.h" #include "third_party/WebKit/public/web/WebPageSerializerClient.h" +#include "url/url_constants.h" using base::Time; using blink::WebPageSerializerClient; @@ -1222,7 +1222,7 @@ base::FilePath SavePackage::GetSuggestedNameForSaveAs( // similarly). if (title_ == net::FormatUrl(page_url_, accept_langs)) { std::string url_path; - if (!page_url_.SchemeIs(kDataScheme)) { + if (!page_url_.SchemeIs(url::kDataScheme)) { std::vector<std::string> url_parts; base::SplitString(page_url_.path(), '/', &url_parts); if (!url_parts.empty()) { diff --git a/content/browser/fileapi/browser_file_system_helper.cc b/content/browser/fileapi/browser_file_system_helper.cc index f7c9183..d89d6ca 100644 --- a/content/browser/fileapi/browser_file_system_helper.cc +++ b/content/browser/fileapi/browser_file_system_helper.cc @@ -17,7 +17,7 @@ #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" -#include "content/public/common/url_constants.h" +#include "url/url_constants.h" #include "webkit/browser/fileapi/external_mount_points.h" #include "webkit/browser/fileapi/file_permission_policy.h" #include "webkit/browser/fileapi/file_system_backend.h" @@ -41,7 +41,7 @@ FileSystemOptions CreateBrowserFileSystemOptions(bool is_incognito) { &additional_allowed_schemes); if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kAllowFileAccessFromFiles)) { - additional_allowed_schemes.push_back(kFileScheme); + additional_allowed_schemes.push_back(url::kFileScheme); } return FileSystemOptions(profile_mode, additional_allowed_schemes, NULL); } diff --git a/content/browser/frame_host/debug_urls.cc b/content/browser/frame_host/debug_urls.cc index f61ca28..0542f9e 100644 --- a/content/browser/frame_host/debug_urls.cc +++ b/content/browser/frame_host/debug_urls.cc @@ -100,7 +100,7 @@ bool IsRendererDebugURL(const GURL& url) { if (!url.is_valid()) return false; - if (url.SchemeIs(kJavaScriptScheme)) + if (url.SchemeIs(url::kJavaScriptScheme)) return true; return url == GURL(kChromeUICrashURL) || diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc index 3b159d1..d8a4579 100644 --- a/content/browser/frame_host/navigation_controller_impl.cc +++ b/content/browser/frame_host/navigation_controller_impl.cc @@ -37,11 +37,11 @@ #include "content/public/browser/user_metrics.h" #include "content/public/common/content_client.h" #include "content/public/common/content_constants.h" -#include "content/public/common/url_constants.h" #include "net/base/escape.h" #include "net/base/mime_util.h" #include "net/base/net_util.h" #include "skia/ext/platform_canvas.h" +#include "url/url_constants.h" namespace content { namespace { @@ -664,7 +664,7 @@ void NavigationControllerImpl::LoadURLWithParams(const LoadURLParams& params) { } break; case LOAD_TYPE_DATA: - if (!params.url.SchemeIs(kDataScheme)) { + if (!params.url.SchemeIs(url::kDataScheme)) { NOTREACHED() << "Data load must use data scheme."; return; } diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc index 64d2421..493f940 100644 --- a/content/browser/frame_host/navigator_impl.cc +++ b/content/browser/frame_host/navigator_impl.cc @@ -368,7 +368,7 @@ bool NavigatorImpl::NavigateToEntry( // do not generate content. What we really need is a message from the // renderer telling us that a new page was not created. The same message // could be used for mailto: URLs and the like. - if (entry.GetURL().SchemeIs(kJavaScriptScheme)) + if (entry.GetURL().SchemeIs(url::kJavaScriptScheme)) return false; } diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index a62b7f8..552962d 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -745,8 +745,8 @@ void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { if (!GetProcess()->IsGuest()) { ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( GetProcess()->GetID(), params.url); - if (params.url.SchemeIs(kDataScheme) && - params.base_url_for_data_url.SchemeIs(kFileScheme)) { + if (params.url.SchemeIs(url::kDataScheme) && + params.base_url_for_data_url.SchemeIs(url::kFileScheme)) { // If 'data:' is used, and we have a 'file:' base url, grant access to // local files. ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( @@ -783,7 +783,7 @@ void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { // // Blink doesn't send throb notifications for JavaScript URLs, so we // don't want to either. - if (!params.url.SchemeIs(kJavaScriptScheme)) + if (!params.url.SchemeIs(url::kJavaScriptScheme)) delegate_->DidStartLoading(this, true); } diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc index 08bf577..46a12e4 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc @@ -70,7 +70,6 @@ #include "content/public/browser/user_metrics.h" #include "content/public/common/content_switches.h" #include "content/public/common/process_type.h" -#include "content/public/common/url_constants.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_message_start.h" #include "net/base/auth.h" @@ -88,6 +87,7 @@ #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_job_factory.h" +#include "url/url_constants.h" #include "webkit/common/blob/blob_data.h" #include "webkit/browser/blob/blob_data_handle.h" #include "webkit/browser/blob/blob_storage_context.h" @@ -533,7 +533,7 @@ DownloadInterruptReason ResourceDispatcherHostImpl::BeginDownload( CreateRequestInfo(child_id, route_id, true, context); extra_info->AssociateWithRequest(request.get()); // Request takes ownership. - if (request->url().SchemeIs(kBlobScheme)) { + if (request->url().SchemeIs(url::kBlobScheme)) { ChromeBlobStorageContext* blob_context = GetChromeBlobStorageContextForResourceContext(context); webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle( @@ -1091,7 +1091,7 @@ void ResourceDispatcherHostImpl::BeginRequest( // Request takes ownership. extra_info->AssociateWithRequest(new_request.get()); - if (new_request->url().SchemeIs(kBlobScheme)) { + if (new_request->url().SchemeIs(url::kBlobScheme)) { // Hang on to a reference to ensure the blob is not released prior // to the job being started. webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle( diff --git a/content/browser/loader/stream_resource_handler.cc b/content/browser/loader/stream_resource_handler.cc index 5641659..9bb8c12 100644 --- a/content/browser/loader/stream_resource_handler.cc +++ b/content/browser/loader/stream_resource_handler.cc @@ -9,9 +9,9 @@ #include "content/browser/streams/stream.h" #include "content/browser/streams/stream_registry.h" #include "content/public/browser/resource_controller.h" -#include "content/public/common/url_constants.h" #include "net/base/io_buffer.h" #include "net/url_request/url_request_status.h" +#include "url/url_constants.h" namespace content { @@ -22,7 +22,7 @@ StreamResourceHandler::StreamResourceHandler(net::URLRequest* request, read_buffer_(NULL) { // TODO(tyoshino): Find a way to share this with the blob URL creation in // WebKit. - GURL url(std::string(kBlobScheme) + ":" + origin.spec() + + GURL url(std::string(url::kBlobScheme) + ":" + origin.spec() + base::GenerateGUID()); stream_ = new Stream(registry, this, url); } diff --git a/content/browser/media/android/media_resource_getter_impl.cc b/content/browser/media/android/media_resource_getter_impl.cc index 70f6d9b..bcf293d 100644 --- a/content/browser/media/android/media_resource_getter_impl.cc +++ b/content/browser/media/android/media_resource_getter_impl.cc @@ -237,14 +237,14 @@ void MediaResourceGetterImpl::GetCookiesCallback( void MediaResourceGetterImpl::GetPlatformPathFromURL( const GURL& url, const GetPlatformPathCB& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK(url.SchemeIsFileSystem() || url.SchemeIs(kBlobScheme)); + DCHECK(url.SchemeIsFileSystem() || url.SchemeIs(url::kBlobScheme)); GetPlatformPathCB cb = base::Bind(&MediaResourceGetterImpl::GetPlatformPathCallback, weak_factory_.GetWeakPtr(), callback); - if (url.SchemeIs(kBlobScheme)) { + if (url.SchemeIs(url::kBlobScheme)) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index ccd90c4..85052d5 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc @@ -72,7 +72,6 @@ #include "content/public/common/context_menu_params.h" #include "content/public/common/drop_data.h" #include "content/public/common/result_codes.h" -#include "content/public/common/url_constants.h" #include "content/public/common/url_utils.h" #include "net/base/filename_util.h" #include "net/base/net_util.h" @@ -87,6 +86,7 @@ #include "ui/gfx/native_widget_types.h" #include "ui/native_theme/native_theme_switches.h" #include "ui/shell_dialogs/selected_file_info.h" +#include "url/url_constants.h" #include "webkit/browser/fileapi/isolated_context.h" #if defined(OS_MACOSX) @@ -1252,7 +1252,7 @@ void RenderViewHostImpl::OnStartDragging( ChildProcessSecurityPolicyImpl::GetInstance(); // Allow drag of Javascript URLs to enable bookmarklet drag to bookmark bar. - if (!filtered_data.url.SchemeIs(kJavaScriptScheme)) + if (!filtered_data.url.SchemeIs(url::kJavaScriptScheme)) process->FilterURL(true, &filtered_data.url); process->FilterURL(false, &filtered_data.html_base_url); // Filter out any paths that the renderer didn't have access to. This prevents diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc index 600ef7e..15fa110 100644 --- a/content/browser/renderer_host/render_view_host_unittest.cc +++ b/content/browser/renderer_host/render_view_host_unittest.cc @@ -29,7 +29,7 @@ class RenderViewHostTestBrowserClient : public TestContentBrowserClient { virtual ~RenderViewHostTestBrowserClient() {} virtual bool IsHandledURL(const GURL& url) OVERRIDE { - return url.scheme() == kFileScheme; + return url.scheme() == url::kFileScheme; } private: diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index 7fe7934..d4104b8 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc @@ -377,12 +377,12 @@ StoragePartitionImpl* StoragePartitionImplMap::Get( ChromeBlobStorageContext::GetFor(browser_context_); StreamContext* stream_context = StreamContext::GetFor(browser_context_); ProtocolHandlerMap protocol_handlers; - protocol_handlers[kBlobScheme] = + protocol_handlers[url::kBlobScheme] = linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( new BlobProtocolHandler(blob_storage_context, stream_context, partition->GetFileSystemContext())); - protocol_handlers[kFileSystemScheme] = + protocol_handlers[url::kFileSystemScheme] = linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( CreateFileSystemProtocolHandler(partition_domain, partition->GetFileSystemContext())); diff --git a/content/browser/web_contents/web_drag_source_mac.mm b/content/browser/web_contents/web_drag_source_mac.mm index 9741b44c..b0f2160 100644 --- a/content/browser/web_contents/web_drag_source_mac.mm +++ b/content/browser/web_contents/web_drag_source_mac.mm @@ -24,7 +24,6 @@ #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_client.h" #include "content/public/common/drop_data.h" -#include "content/public/common/url_constants.h" #include "grit/ui_resources.h" #include "net/base/escape.h" #include "net/base/filename_util.h" @@ -32,6 +31,7 @@ #include "ui/base/clipboard/custom_data_helper.h" #include "ui/base/dragdrop/cocoa_dnd_util.h" #include "ui/gfx/image/image.h" +#include "url/url_constants.h" using base::SysNSStringToUTF8; using base::SysUTF8ToNSString; @@ -169,7 +169,7 @@ void PromiseWriterHelper(const DropData& drop_data, NSURL* url = [NSURL URLWithString:SysUTF8ToNSString(dropData_->url.spec())]; // If NSURL creation failed, check for a badly-escaped JavaScript URL. // Strip out any existing escapes and then re-escape uniformly. - if (!url && dropData_->url.SchemeIs(content::kJavaScriptScheme)) { + if (!url && dropData_->url.SchemeIs(url::kJavaScriptScheme)) { net::UnescapeRule::Type unescapeRules = net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS | diff --git a/content/common/savable_url_schemes.cc b/content/common/savable_url_schemes.cc index 290d78f..c149aae 100644 --- a/content/common/savable_url_schemes.cc +++ b/content/common/savable_url_schemes.cc @@ -15,12 +15,12 @@ namespace { const char* const kDefaultSavableSchemes[] = { url::kHttpScheme, url::kHttpsScheme, - kFileScheme, - kFileSystemScheme, - kFtpScheme, + url::kFileScheme, + url::kFileSystemScheme, + url::kFtpScheme, kChromeDevToolsScheme, kChromeUIScheme, - kDataScheme, + url::kDataScheme, NULL }; diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc index 8a035d5..c6a627d 100644 --- a/content/plugin/webplugin_proxy.cc +++ b/content/plugin/webplugin_proxy.cc @@ -19,12 +19,12 @@ #include "content/plugin/plugin_channel.h" #include "content/plugin/plugin_thread.h" #include "content/public/common/content_client.h" -#include "content/public/common/url_constants.h" #include "skia/ext/platform_canvas.h" #include "skia/ext/platform_device.h" #include "third_party/WebKit/public/web/WebBindings.h" #include "ui/gfx/blit.h" #include "ui/gfx/canvas.h" +#include "url/url_constants.h" #if defined(OS_MACOSX) #include "base/mac/mac_util.h" @@ -290,7 +290,7 @@ void WebPluginProxy::HandleURLRequest(const char* url, GURL request_url(url); if (!request_url.SchemeIs(url::kHttpScheme) && !request_url.SchemeIs(url::kHttpsScheme) && - !request_url.SchemeIs(kFtpScheme)) { + !request_url.SchemeIs(url::kFtpScheme)) { return; } } diff --git a/content/public/common/url_constants.cc b/content/public/common/url_constants.cc index c51cc81..f364da8 100644 --- a/content/public/common/url_constants.cc +++ b/content/public/common/url_constants.cc @@ -7,19 +7,12 @@ namespace content { const char kAboutScheme[] = "about"; -const char kBlobScheme[] = "blob"; // Before adding new chrome schemes please check with security@chromium.org. // There are security implications associated with introducing new schemes. const char kChromeDevToolsScheme[] = "chrome-devtools"; const char kChromeUIScheme[] = "chrome"; -const char kDataScheme[] = "data"; -const char kFileScheme[] = "file"; -const char kFileSystemScheme[] = "filesystem"; -const char kFtpScheme[] = "ftp"; const char kGuestScheme[] = "chrome-guest"; -const char kJavaScriptScheme[] = "javascript"; -const char kMailToScheme[] = "mailto"; const char kMetadataScheme[] = "metadata"; const char kSwappedOutScheme[] = "swappedout"; const char kViewSourceScheme[] = "view-source"; diff --git a/content/public/common/url_constants.h b/content/public/common/url_constants.h index 900ee91..a9e01a6 100644 --- a/content/public/common/url_constants.h +++ b/content/public/common/url_constants.h @@ -16,16 +16,9 @@ namespace content { // TODO(jam): some of these don't below in the content layer, but are accessed // from there. CONTENT_EXPORT extern const char kAboutScheme[]; -CONTENT_EXPORT extern const char kBlobScheme[]; CONTENT_EXPORT extern const char kChromeDevToolsScheme[]; CONTENT_EXPORT extern const char kChromeUIScheme[]; // Used for WebUIs. -CONTENT_EXPORT extern const char kDataScheme[]; -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 kJavaScriptScheme[]; -CONTENT_EXPORT extern const char kMailToScheme[]; CONTENT_EXPORT extern const char kMetadataScheme[]; CONTENT_EXPORT extern const char kSwappedOutScheme[]; CONTENT_EXPORT extern const char kViewSourceScheme[]; diff --git a/content/renderer/image_loading_helper.cc b/content/renderer/image_loading_helper.cc index b036f0b..1eb98dc 100644 --- a/content/renderer/image_loading_helper.cc +++ b/content/renderer/image_loading_helper.cc @@ -8,7 +8,6 @@ #include "base/message_loop/message_loop.h" #include "content/child/image_decoder.h" #include "content/common/image_messages.h" -#include "content/public/common/url_constants.h" #include "content/public/renderer/render_frame.h" #include "content/renderer/fetchers/multi_resolution_image_resource_fetcher.h" #include "net/base/data_url.h" @@ -20,6 +19,7 @@ #include "ui/gfx/favicon_size.h" #include "ui/gfx/size.h" #include "ui/gfx/skbitmap_operations.h" +#include "url/url_constants.h" using blink::WebFrame; using blink::WebVector; @@ -110,7 +110,7 @@ void ImageLoadingHelper::OnDownloadImage(int id, uint32_t max_image_size) { std::vector<SkBitmap> result_images; std::vector<gfx::Size> result_original_image_sizes; - if (image_url.SchemeIs(kDataScheme)) { + if (image_url.SchemeIs(url::kDataScheme)) { SkBitmap data_image = ImageFromDataUrl(image_url); if (!data_image.empty()) { result_images.push_back(ResizeImage(data_image, max_image_size)); diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 3f9464b..a1bf793 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -3227,14 +3227,14 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( (frame->isViewSourceModeEnabled() && type != blink::WebNavigationTypeReload); - if (!should_fork && url.SchemeIs(kFileScheme)) { + if (!should_fork && url.SchemeIs(url::kFileScheme)) { // Fork non-file to file opens. Check the opener URL if this is the // initial navigation in a newly opened window. GURL source_url(old_url); if (is_initial_navigation && source_url.is_empty() && frame->opener()) source_url = frame->opener()->top()->document().url(); DCHECK(!source_url.is_empty()); - should_fork = !source_url.SchemeIs(kFileScheme); + should_fork = !source_url.SchemeIs(url::kFileScheme); } if (!should_fork) { diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 84c2186..3162798 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -2062,7 +2062,7 @@ void RenderViewImpl::PopulateDocumentStateFromPending( InternalDocumentStateData* internal_data = InternalDocumentStateData::FromDocumentState(document_state); - if (!params.url.SchemeIs(kJavaScriptScheme) && + if (!params.url.SchemeIs(url::kJavaScriptScheme) && params.navigation_type == FrameMsg_Navigate_Type::RESTORE) { // We're doing a load of a page that was restored from the last session. By // default this prefers the cache over loading (LOAD_PREFERRING_CACHE) which @@ -2099,7 +2099,7 @@ NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { // A navigation resulting from loading a javascript URL should not be treated // as a browser initiated event. Instead, we want it to look as if the page // initiated any load resulting from JS execution. - if (!params.url.SchemeIs(kJavaScriptScheme)) { + if (!params.url.SchemeIs(url::kJavaScriptScheme)) { navigation_state = NavigationState::CreateBrowserInitiated( params.page_id, params.pending_history_list_offset, diff --git a/content/renderer/web_ui_extension.cc b/content/renderer/web_ui_extension.cc index dcc4ed5..11565f2 100644 --- a/content/renderer/web_ui_extension.cc +++ b/content/renderer/web_ui_extension.cc @@ -42,7 +42,7 @@ bool ShouldRespondToRequest( bool webui_enabled = (render_view->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI) && (frame_url.SchemeIs(kChromeUIScheme) || - frame_url.SchemeIs(kDataScheme)); + frame_url.SchemeIs(url::kDataScheme)); if (!webui_enabled) return false; diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc index 21423d2..6da4ece 100644 --- a/content/shell/browser/shell_content_browser_client.cc +++ b/content/shell/browser/shell_content_browser_client.cc @@ -192,12 +192,12 @@ bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { // Keep in sync with ProtocolHandlers added by // ShellURLRequestContextGetter::GetURLRequestContext(). static const char* const kProtocolList[] = { - kBlobScheme, - kFileSystemScheme, + url::kBlobScheme, + url::kFileSystemScheme, kChromeUIScheme, kChromeDevToolsScheme, - kDataScheme, - kFileScheme, + url::kDataScheme, + url::kFileScheme, }; for (size_t i = 0; i < arraysize(kProtocolList); ++i) { if (url.scheme() == kProtocolList[i]) diff --git a/content/shell/browser/shell_url_request_context_getter.cc b/content/shell/browser/shell_url_request_context_getter.cc index 40bca8c..084b017 100644 --- a/content/shell/browser/shell_url_request_context_getter.cc +++ b/content/shell/browser/shell_url_request_context_getter.cc @@ -14,7 +14,6 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/cookie_store_factory.h" #include "content/public/common/content_switches.h" -#include "content/public/common/url_constants.h" #include "content/shell/browser/shell_network_delegate.h" #include "content/shell/common/shell_switches.h" #include "net/base/cache_type.h" @@ -38,6 +37,7 @@ #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_storage.h" #include "net/url_request/url_request_job_factory_impl.h" +#include "url/url_constants.h" namespace content { @@ -207,10 +207,10 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { // ShellContentBrowserClient::IsHandledURL(). InstallProtocolHandlers(job_factory.get(), &protocol_handlers_); bool set_protocol = job_factory->SetProtocolHandler( - kDataScheme, new net::DataProtocolHandler); + url::kDataScheme, new net::DataProtocolHandler); DCHECK(set_protocol); set_protocol = job_factory->SetProtocolHandler( - kFileScheme, + url::kFileScheme, new net::FileProtocolHandler( content::BrowserThread::GetBlockingPool()-> GetTaskRunnerWithShutdownBehavior( diff --git a/extensions/browser/extension_web_contents_observer.cc b/extensions/browser/extension_web_contents_observer.cc index fd02a90..a66a6f2 100644 --- a/extensions/browser/extension_web_contents_observer.cc +++ b/extensions/browser/extension_web_contents_observer.cc @@ -55,7 +55,7 @@ void ExtensionWebContentsObserver::RenderViewCreated( ExtensionPrefs* prefs = ExtensionPrefs::Get(browser_context_); if (prefs->AllowFileAccess(extension->id())) { content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( - process->GetID(), content::kFileScheme); + process->GetID(), url::kFileScheme); } } diff --git a/extensions/common/permissions/permission_message_util.cc b/extensions/common/permissions/permission_message_util.cc index 25006ed..0b2e1a9 100644 --- a/extensions/common/permissions/permission_message_util.cc +++ b/extensions/common/permissions/permission_message_util.cc @@ -6,13 +6,13 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" -#include "content/public/common/url_constants.h" #include "extensions/common/permissions/permission_message.h" #include "extensions/common/permissions/permission_set.h" #include "extensions/common/url_pattern_set.h" #include "grit/extensions_strings.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "ui/base/l10n/l10n_util.h" +#include "url/url_constants.h" using extensions::PermissionMessage; using extensions::PermissionSet; @@ -102,7 +102,7 @@ std::set<std::string> GetDistinctHosts(const URLPatternSet& host_patterns, for (URLPatternSet::const_iterator i = host_patterns.begin(); i != host_patterns.end(); ++i) { - if (exclude_file_scheme && i->scheme() == content::kFileScheme) + if (exclude_file_scheme && i->scheme() == url::kFileScheme) continue; std::string host = i->host(); diff --git a/extensions/common/permissions/permissions_data.cc b/extensions/common/permissions/permissions_data.cc index 268fb82..2b57d4f 100644 --- a/extensions/common/permissions/permissions_data.cc +++ b/extensions/common/permissions/permissions_data.cc @@ -180,7 +180,7 @@ bool ParseHelper(Extension* extension, // to match all paths. pattern.SetPath("/*"); int valid_schemes = pattern.valid_schemes(); - if (pattern.MatchesScheme(content::kFileScheme) && + if (pattern.MatchesScheme(url::kFileScheme) && !PermissionsData::CanExecuteScriptEverywhere(extension)) { extension->set_wants_file_access(true); if (!(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS)) diff --git a/extensions/common/url_pattern.cc b/extensions/common/url_pattern.cc index 020be3c..885eab9 100644 --- a/extensions/common/url_pattern.cc +++ b/extensions/common/url_pattern.cc @@ -22,11 +22,11 @@ namespace { const char* kValidSchemes[] = { url::kHttpScheme, url::kHttpsScheme, - content::kFileScheme, - content::kFtpScheme, + url::kFileScheme, + url::kFtpScheme, content::kChromeUIScheme, extensions::kExtensionScheme, - content::kFileSystemScheme, + url::kFileSystemScheme, }; const int kValidSchemeMasks[] = { @@ -192,7 +192,7 @@ URLPattern::ParseResult URLPattern::Parse(const std::string& pattern) { if (!standard_scheme) { path_start_pos = host_start_pos; - } else if (scheme_ == content::kFileScheme) { + } else if (scheme_ == url::kFileScheme) { size_t host_end_pos = pattern.find(kPathSeparator, host_start_pos); if (host_end_pos == std::string::npos) { // Allow hostname omission. @@ -426,7 +426,7 @@ const std::string& URLPattern::GetAsString() const { std::string spec = scheme_ + (standard_scheme ? content::kStandardSchemeSeparator : ":"); - if (scheme_ != content::kFileScheme && standard_scheme) { + if (scheme_ != url::kFileScheme && standard_scheme) { if (match_subdomains_) { spec += "*"; if (!host_.empty()) @@ -493,7 +493,7 @@ bool URLPattern::MatchesAllSchemes( bool URLPattern::MatchesSecurityOriginHelper(const GURL& test) const { // Ignore hostname if scheme is file://. - if (scheme_ != content::kFileScheme && !MatchesHost(test)) + if (scheme_ != url::kFileScheme && !MatchesHost(test)) return false; if (!MatchesPortPattern(base::IntToString(test.EffectiveIntPort()))) diff --git a/extensions/common/url_pattern_set.cc b/extensions/common/url_pattern_set.cc index a04d634..9e9926d 100644 --- a/extensions/common/url_pattern_set.cc +++ b/extensions/common/url_pattern_set.cc @@ -10,10 +10,10 @@ #include "base/memory/linked_ptr.h" #include "base/stl_util.h" #include "base/values.h" -#include "content/public/common/url_constants.h" #include "extensions/common/error_utils.h" #include "extensions/common/url_pattern.h" #include "url/gurl.h" +#include "url/url_constants.h" namespace extensions { @@ -198,7 +198,7 @@ bool URLPatternSet::Populate(const std::vector<std::string>& patterns, } return false; } - if (!allow_file_access && pattern.MatchesScheme(content::kFileScheme)) { + if (!allow_file_access && pattern.MatchesScheme(url::kFileScheme)) { pattern.SetValidSchemes( pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); } diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index bba2087..df35567 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc @@ -795,9 +795,9 @@ void Dispatcher::UpdateOriginPermissions( const char* schemes[] = { url::kHttpScheme, url::kHttpsScheme, - content::kFileScheme, + url::kFileScheme, content::kChromeUIScheme, - content::kFtpScheme, + url::kFtpScheme, }; for (size_t j = 0; j < arraysize(schemes); ++j) { if (i->MatchesScheme(schemes[j])) { diff --git a/url/url_canon_filesystemurl.cc b/url/url_canon_filesystemurl.cc index f330e22..18e9055 100644 --- a/url/url_canon_filesystemurl.cc +++ b/url/url_canon_filesystemurl.cc @@ -43,7 +43,7 @@ bool DoCanonicalizeFileSystemURL(const CHAR* spec, return false; bool success = true; - if (CompareSchemeComponent(spec, inner_parsed->scheme, kFileScheme)) { + if (CompareSchemeComponent(spec, inner_parsed->scheme, url::kFileScheme)) { new_inner_parsed.scheme.begin = output->length(); output->Append("file://", 7); new_inner_parsed.scheme.len = 4; diff --git a/url/url_constants.cc b/url/url_constants.cc index 7df30da..2949d44 100644 --- a/url/url_constants.cc +++ b/url/url_constants.cc @@ -6,7 +6,14 @@ namespace url { +const char kBlobScheme[] = "blob"; +const char kDataScheme[] = "data"; +const char kFileScheme[] = "file"; +const char kFileSystemScheme[] = "filesystem"; +const char kFtpScheme[] = "ftp"; const char kHttpScheme[] = "http"; const char kHttpsScheme[] = "https"; +const char kJavaScriptScheme[] = "javascript"; +const char kMailToScheme[] = "mailto"; } // namespace url diff --git a/url/url_constants.h b/url/url_constants.h index 9d184d9..18b4bfc 100644 --- a/url/url_constants.h +++ b/url/url_constants.h @@ -9,8 +9,15 @@ namespace url { +URL_EXPORT extern const char kBlobScheme[]; +URL_EXPORT extern const char kDataScheme[]; +URL_EXPORT extern const char kFileScheme[]; +URL_EXPORT extern const char kFileSystemScheme[]; +URL_EXPORT extern const char kFtpScheme[]; URL_EXPORT extern const char kHttpScheme[]; URL_EXPORT extern const char kHttpsScheme[]; +URL_EXPORT extern const char kJavaScriptScheme[]; +URL_EXPORT extern const char kMailToScheme[]; } // namespace url diff --git a/url/url_util.cc b/url/url_util.cc index ff1fdf9..7cb2de2 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -14,10 +14,6 @@ namespace url { -const char kFileScheme[] = "file"; -const char kFileSystemScheme[] = "filesystem"; -const char kMailtoScheme[] = "mailto"; - namespace { // ASCII-specific tolower. The standard library's tolower is locale sensitive, @@ -161,12 +157,12 @@ bool DoCanonicalize(const CHAR* in_spec, // This is the parsed version of the input URL, we have to canonicalize it // before storing it in our object. bool success; - if (DoCompareSchemeComponent(spec, scheme, kFileScheme)) { + if (DoCompareSchemeComponent(spec, scheme, url::kFileScheme)) { // File URLs are special. ParseFileURL(spec, spec_len, &parsed_input); success = CanonicalizeFileURL(spec, spec_len, parsed_input, charset_converter, output, output_parsed); - } else if (DoCompareSchemeComponent(spec, scheme, kFileSystemScheme)) { + } else if (DoCompareSchemeComponent(spec, scheme, url::kFileSystemScheme)) { // Filesystem URLs are special. ParseFileSystemURL(spec, spec_len, &parsed_input); success = CanonicalizeFileSystemURL(spec, spec_len, parsed_input, @@ -179,7 +175,7 @@ bool DoCanonicalize(const CHAR* in_spec, success = CanonicalizeStandardURL(spec, spec_len, parsed_input, charset_converter, output, output_parsed); - } else if (DoCompareSchemeComponent(spec, scheme, kMailtoScheme)) { + } else if (DoCompareSchemeComponent(spec, scheme, url::kMailToScheme)) { // Mailto are treated like a standard url with only a scheme, path, query ParseMailtoURL(spec, spec_len, &parsed_input); success = CanonicalizeMailtoURL(spec, spec_len, parsed_input, output, @@ -335,11 +331,11 @@ bool DoReplaceComponents(const char* spec, // If we get here, then we know the scheme doesn't need to be replaced, so can // just key off the scheme in the spec to know how to do the replacements. - if (DoCompareSchemeComponent(spec, parsed.scheme, kFileScheme)) { + if (DoCompareSchemeComponent(spec, parsed.scheme, url::kFileScheme)) { return ReplaceFileURL(spec, parsed, replacements, charset_converter, output, out_parsed); } - if (DoCompareSchemeComponent(spec, parsed.scheme, kFileSystemScheme)) { + if (DoCompareSchemeComponent(spec, parsed.scheme, url::kFileSystemScheme)) { return ReplaceFileSystemURL(spec, parsed, replacements, charset_converter, output, out_parsed); } @@ -347,7 +343,7 @@ bool DoReplaceComponents(const char* spec, return ReplaceStandardURL(spec, parsed, replacements, charset_converter, output, out_parsed); } - if (DoCompareSchemeComponent(spec, parsed.scheme, kMailtoScheme)) { + if (DoCompareSchemeComponent(spec, parsed.scheme, url::kMailToScheme)) { return ReplaceMailtoURL(spec, parsed, replacements, output, out_parsed); } diff --git a/url/url_util.h b/url/url_util.h index 4229525..458d1e8 100644 --- a/url/url_util.h +++ b/url/url_util.h @@ -9,6 +9,7 @@ #include "base/strings/string16.h" #include "url/url_canon.h" +#include "url/url_constants.h" #include "url/url_export.h" #include "url/url_parse.h" diff --git a/url/url_util_internal.h b/url/url_util_internal.h index c6274cc..c72598f 100644 --- a/url/url_util_internal.h +++ b/url/url_util_internal.h @@ -12,10 +12,6 @@ namespace url { -extern const char kFileScheme[]; -extern const char kFileSystemScheme[]; -extern const char kMailtoScheme[]; - // Given a string and a range inside the string, compares it to the given // lower-case |compare_to| buffer. bool CompareSchemeComponent(const char* spec, |