diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-11 00:17:29 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-11 00:17:29 +0000 |
commit | 2d9748b216a7432d03425152e8889aa26c90b885 (patch) | |
tree | 1161f5c7264322f3325e064784e98eb8d2628328 | |
parent | b633c1d75b3539ab940eae2a65d2f574f7d5b88c (diff) | |
download | chromium_src-2d9748b216a7432d03425152e8889aa26c90b885.zip chromium_src-2d9748b216a7432d03425152e8889aa26c90b885.tar.gz chromium_src-2d9748b216a7432d03425152e8889aa26c90b885.tar.bz2 |
Cleanup: Move kChromeUIScheme constant into content namespace.
BUG=None
TEST=None, no functional changes
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/149643010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250244 0039d316-1c4b-4281-b951-d872f2087c98
72 files changed, 125 insertions, 117 deletions
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 12a0656..31d0f31 100644 --- a/android_webview/browser/net/aw_url_request_context_getter.cc +++ b/android_webview/browser/net/aw_url_request_context_getter.cc @@ -109,8 +109,8 @@ scoped_ptr<net::URLRequestJobFactory> CreateJobFactory( (*protocol_handlers)[content::kFileSystemScheme].release()); DCHECK(set_protocol); set_protocol = aw_job_factory->SetProtocolHandler( - chrome::kChromeUIScheme, - (*protocol_handlers)[chrome::kChromeUIScheme].release()); + content::kChromeUIScheme, + (*protocol_handlers)[content::kChromeUIScheme].release()); DCHECK(set_protocol); set_protocol = aw_job_factory->SetProtocolHandler( chrome::kChromeDevToolsScheme, diff --git a/apps/shell/browser/shell_content_browser_client.cc b/apps/shell/browser/shell_content_browser_client.cc index df747b3..aab0bf2 100644 --- a/apps/shell/browser/shell_content_browser_client.cc +++ b/apps/shell/browser/shell_content_browser_client.cc @@ -76,8 +76,8 @@ bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { // content::ShellURLRequestContextGetter::GetURLRequestContext(). static const char* const kProtocolList[] = { chrome::kBlobScheme, - chrome::kChromeUIScheme, chrome::kChromeDevToolsScheme, + content::kChromeUIScheme, content::kDataScheme, content::kFileScheme, content::kFileSystemScheme, diff --git a/chrome/browser/autocomplete/builtin_provider.cc b/chrome/browser/autocomplete/builtin_provider.cc index 1aac79f..7e46851 100644 --- a/chrome/browser/autocomplete/builtin_provider.cc +++ b/chrome/browser/autocomplete/builtin_provider.cc @@ -65,7 +65,7 @@ void BuiltinProvider::Start(const AutocompleteInput& input, const base::string16 kAbout = base::ASCIIToUTF16(chrome::kAboutScheme) + base::ASCIIToUTF16(content::kStandardSchemeSeparator); - const base::string16 kChrome = base::ASCIIToUTF16(chrome::kChromeUIScheme) + + const base::string16 kChrome = base::ASCIIToUTF16(content::kChromeUIScheme) + base::ASCIIToUTF16(content::kStandardSchemeSeparator); const int kUrl = ACMatchClassification::URL; @@ -95,7 +95,7 @@ void BuiltinProvider::Start(const AutocompleteInput& input, GURL url = URLFixerUpper::FixupURL(base::UTF16ToUTF8(text), std::string()); // BuiltinProvider doesn't know how to suggest valid ?query or #fragment // extensions to chrome: URLs. - if (url.SchemeIs(chrome::kChromeUIScheme) && url.has_host() && + if (url.SchemeIs(content::kChromeUIScheme) && url.has_host() && !url.has_query() && !url.has_ref()) { // Include the path for sub-pages (e.g. "chrome://settings/browser"). base::string16 host_and_path = base::UTF8ToUTF16(url.host() + url.path()); diff --git a/chrome/browser/autocomplete/builtin_provider_unittest.cc b/chrome/browser/autocomplete/builtin_provider_unittest.cc index faec405..3f29947 100644 --- a/chrome/browser/autocomplete/builtin_provider_unittest.cc +++ b/chrome/browser/autocomplete/builtin_provider_unittest.cc @@ -75,7 +75,7 @@ void BuiltinProviderTest::RunTest(test_data<ResultType>* builtin_cases, TEST_F(BuiltinProviderTest, TypingScheme) { const base::string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme); - const base::string16 kChrome = ASCIIToUTF16(chrome::kChromeUIScheme); + const base::string16 kChrome = ASCIIToUTF16(content::kChromeUIScheme); const base::string16 kSeparator1 = ASCIIToUTF16(":"); const base::string16 kSeparator2 = ASCIIToUTF16(":/"); const base::string16 kSeparator3 = @@ -142,7 +142,7 @@ TEST_F(BuiltinProviderTest, NonChromeURLs) { TEST_F(BuiltinProviderTest, ChromeURLs) { const base::string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme); - const base::string16 kChrome = ASCIIToUTF16(chrome::kChromeUIScheme); + const base::string16 kChrome = ASCIIToUTF16(content::kChromeUIScheme); const base::string16 kSeparator1 = ASCIIToUTF16(":"); const base::string16 kSeparator2 = ASCIIToUTF16(":/"); const base::string16 kSeparator3 = diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 28d1f18..15c499f 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -24,7 +24,7 @@ bool WillHandleBrowserAboutURL(GURL* url, !url->SchemeIs(chrome::kAboutScheme)); // Only handle chrome://foo/, URLFixerUpper::FixupURL translates about:foo. - if (!url->SchemeIs(chrome::kChromeUIScheme)) + if (!url->SchemeIs(content::kChromeUIScheme)) return false; std::string host(url->host()); diff --git a/chrome/browser/browser_about_handler_unittest.cc b/chrome/browser/browser_about_handler_unittest.cc index 2154157..d21948f 100644 --- a/chrome/browser/browser_about_handler_unittest.cc +++ b/chrome/browser/browser_about_handler_unittest.cc @@ -17,7 +17,7 @@ using content::BrowserThread; typedef testing::Test BrowserAboutHandlerTest; TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) { - std::string chrome_prefix(chrome::kChromeUIScheme); + std::string chrome_prefix(content::kChromeUIScheme); chrome_prefix.append(content::kStandardSchemeSeparator); struct AboutURLTestData { GURL test_url; diff --git a/chrome/browser/browsing_data/browsing_data_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_helper_unittest.cc index b74cceb..3f490db 100644 --- a/chrome/browser/browsing_data/browsing_data_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_helper_unittest.cc @@ -72,7 +72,7 @@ TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotWebSafe) { EXPECT_FALSE(IsWebScheme(extensions::kExtensionScheme)); EXPECT_FALSE(IsWebScheme(chrome::kAboutScheme)); EXPECT_FALSE(IsWebScheme(chrome::kChromeDevToolsScheme)); - EXPECT_FALSE(IsWebScheme(chrome::kChromeUIScheme)); + EXPECT_FALSE(IsWebScheme(content::kChromeUIScheme)); EXPECT_FALSE(IsWebScheme(content::kJavaScriptScheme)); EXPECT_FALSE(IsWebScheme(content::kMailToScheme)); EXPECT_FALSE(IsWebScheme(content::kMetadataScheme)); @@ -96,7 +96,7 @@ TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotAllExtension) { EXPECT_FALSE(IsExtensionScheme(chrome::kAboutScheme)); EXPECT_FALSE(IsExtensionScheme(chrome::kChromeDevToolsScheme)); - EXPECT_FALSE(IsExtensionScheme(chrome::kChromeUIScheme)); + EXPECT_FALSE(IsExtensionScheme(content::kChromeUIScheme)); EXPECT_FALSE(IsExtensionScheme(content::kJavaScriptScheme)); EXPECT_FALSE(IsExtensionScheme(content::kMailToScheme)); EXPECT_FALSE(IsExtensionScheme(content::kMetadataScheme)); diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index cf19a3a..bbb5a8b 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -374,7 +374,7 @@ bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { // disabled for security reasons. New tab page explains the reasons, so // we redirect user to new tab page. if (chromeos::UserManager::Get()->IsLoggedInAsGuest()) { - if (url->SchemeIs(chrome::kChromeUIScheme) && + if (url->SchemeIs(content::kChromeUIScheme) && (url->DomainIs(chrome::kChromeUIBookmarksHost) || #if defined(ENABLE_ENHANCED_BOOKMARKS) url->DomainIs(chrome::kChromeUIEnhancedBookmarksHost) || @@ -392,7 +392,7 @@ bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to // "chrome://foo/". bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) { - if (!url->is_valid() || !url->SchemeIs(chrome::kChromeUIScheme)) + if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme)) return false; return RemoveUberHost(url); @@ -2536,7 +2536,7 @@ void ChromeContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( ContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( additional_allowed_schemes); additional_allowed_schemes->push_back(kChromeDevToolsScheme); - additional_allowed_schemes->push_back(kChromeUIScheme); + additional_allowed_schemes->push_back(content::kChromeUIScheme); additional_allowed_schemes->push_back(extensions::kExtensionScheme); } diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc index 7b5cd0e..5871189 100644 --- a/chrome/browser/content_settings/host_content_settings_map.cc +++ b/chrome/browser/content_settings/host_content_settings_map.cc @@ -546,7 +546,7 @@ bool HostContentSettingsMap::ShouldAllowAllContent( content_type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { return false; } - if (secondary_url.SchemeIs(chrome::kChromeUIScheme) && + if (secondary_url.SchemeIs(content::kChromeUIScheme) && content_type == CONTENT_SETTINGS_TYPE_COOKIES && primary_url.SchemeIsSecure()) { return true; @@ -565,7 +565,7 @@ bool HostContentSettingsMap::ShouldAllowAllContent( } } return primary_url.SchemeIs(chrome::kChromeDevToolsScheme) || - primary_url.SchemeIs(chrome::kChromeUIScheme); + primary_url.SchemeIs(content::kChromeUIScheme); } base::Value* HostContentSettingsMap::GetWebsiteSetting( diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc index f3ba68b..46e3b25 100644 --- a/chrome/browser/custom_home_pages_table_model.cc +++ b/chrome/browser/custom_home_pages_table_model.cc @@ -37,7 +37,7 @@ bool ShouldAddPage(const GURL& url) { if (url.SchemeIs(chrome::kChromeDevToolsScheme)) return false; - if (url.SchemeIs(chrome::kChromeUIScheme)) { + if (url.SchemeIs(content::kChromeUIScheme)) { if (url.host() == chrome::kChromeUISettingsHost) return false; 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 86aa198..8356221 100644 --- a/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc +++ b/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc @@ -14,7 +14,7 @@ namespace { // URL schemes for which we'll send events. const char* kValidSchemes[] = { - chrome::kChromeUIScheme, + content::kChromeUIScheme, content::kHttpScheme, content::kHttpsScheme, content::kFileScheme, diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc index 3bea9c3..15fbeb5 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc @@ -280,7 +280,7 @@ bool ExtensionTabUtil::IsCrashURL(const GURL& url) { // Check a fixed-up URL, to normalize the scheme and parse hosts correctly. GURL fixed_url = URLFixerUpper::FixupURL(url.possibly_invalid_spec(), std::string()); - return (fixed_url.SchemeIs(chrome::kChromeUIScheme) && + return (fixed_url.SchemeIs(content::kChromeUIScheme) && (fixed_url.host() == content::kChromeUIBrowserCrashHost || fixed_url.host() == chrome::kChromeUICrashHost)); } diff --git a/chrome/browser/extensions/extension_view_host_factory.cc b/chrome/browser/extensions/extension_view_host_factory.cc index 417495d..2b92644 100644 --- a/chrome/browser/extensions/extension_view_host_factory.cc +++ b/chrome/browser/extensions/extension_view_host_factory.cc @@ -83,7 +83,7 @@ const Extension* GetExtensionForUrl(Profile* profile, const GURL& url) { if (!service) return NULL; std::string extension_id = url.host(); - if (url.SchemeIs(chrome::kChromeUIScheme) && + if (url.SchemeIs(content::kChromeUIScheme) && url.host() == chrome::kChromeUIExtensionInfoHost) extension_id = url.path().substr(1); return service->extensions()->GetByID(extension_id); diff --git a/chrome/browser/extensions/extension_web_contents_observer.cc b/chrome/browser/extensions/extension_web_contents_observer.cc index aed0c23..608533a 100644 --- a/chrome/browser/extensions/extension_web_contents_observer.cc +++ b/chrome/browser/extensions/extension_web_contents_observer.cc @@ -56,7 +56,7 @@ void ExtensionWebContentsObserver::RenderViewCreated( (type == Manifest::TYPE_PLATFORM_APP && extension->location() == Manifest::COMPONENT)) { content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( - process->GetID(), chrome::kChromeUIScheme); + process->GetID(), content::kChromeUIScheme); } // Some extensions use file:// URLs. diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc index 384552a..982de26 100644 --- a/chrome/browser/extensions/extension_web_ui.cc +++ b/chrome/browser/extensions/extension_web_ui.cc @@ -66,13 +66,14 @@ void CleanUpDuplicates(base::ListValue* list) { // Reloads the page in |web_contents| if it uses the same profile as |profile| // and if the current URL is a chrome URL. -void UnregisterAndReplaceOverrideForWebContents( - const std::string& page, Profile* profile, WebContents* web_contents) { +void UnregisterAndReplaceOverrideForWebContents(const std::string& page, + Profile* profile, + WebContents* web_contents) { if (Profile::FromBrowserContext(web_contents->GetBrowserContext()) != profile) return; GURL url = web_contents->GetURL(); - if (!url.SchemeIs(chrome::kChromeUIScheme) || url.host() != page) + if (!url.SchemeIs(content::kChromeUIScheme) || url.host() != page) return; // Don't use Reload() since |url| isn't the same as the internal URL that @@ -169,8 +170,9 @@ void ExtensionWebUI::RegisterProfilePrefs( // static bool ExtensionWebUI::HandleChromeURLOverride( - GURL* url, content::BrowserContext* browser_context) { - if (!url->SchemeIs(chrome::kChromeUIScheme)) + GURL* url, + content::BrowserContext* browser_context) { + if (!url->SchemeIs(content::kChromeUIScheme)) return false; Profile* profile = Profile::FromBrowserContext(browser_context); @@ -261,7 +263,7 @@ bool ExtensionWebUI::HandleChromeURLOverrideReverse( if (!(*it2)->GetAsString(&override)) continue; if (StartsWithASCII(url->spec(), override, true)) { - GURL original_url(chrome::kChromeUIScheme + std::string("://") + + GURL original_url(content::kChromeUIScheme + std::string("://") + it.key() + url->spec().substr(override.length())); *url = original_url; return true; diff --git a/chrome/browser/favicon/favicon_service.cc b/chrome/browser/favicon/favicon_service.cc index 9c45370..9afc75f 100644 --- a/chrome/browser/favicon/favicon_service.cc +++ b/chrome/browser/favicon/favicon_service.cc @@ -199,7 +199,7 @@ base::CancelableTaskTracker::TaskId FaviconService::GetLargestRawFaviconForURL( FaviconResultsCallback favicon_results_callback = Bind(&FaviconService::RunFaviconRawCallbackWithBitmapResults, base::Unretained(this), callback, 0, ui::ScaleFactor()); - if (page_url.SchemeIs(chrome::kChromeUIScheme) || + if (page_url.SchemeIs(content::kChromeUIScheme) || page_url.SchemeIs(extensions::kExtensionScheme)) { std::vector<ui::ScaleFactor> scale_factor; scale_factor.push_back(ui::SCALE_FACTOR_100P); @@ -325,7 +325,7 @@ base::CancelableTaskTracker::TaskId FaviconService::GetFaviconForURLImpl( const std::vector<ui::ScaleFactor>& desired_scale_factors, const FaviconResultsCallback& callback, base::CancelableTaskTracker* tracker) { - if (params.page_url.SchemeIs(chrome::kChromeUIScheme) || + if (params.page_url.SchemeIs(content::kChromeUIScheme) || params.page_url.SchemeIs(extensions::kExtensionScheme)) { return GetFaviconForChromeURL(profile_, params.page_url, desired_scale_factors, callback, tracker); diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc index 245265d..062ad87 100644 --- a/chrome/browser/favicon/favicon_tab_helper.cc +++ b/chrome/browser/favicon/favicon_tab_helper.cc @@ -88,7 +88,7 @@ bool FaviconTabHelper::ShouldDisplayFavicon() { return true; GURL url = web_contents()->GetURL(); - if (url.SchemeIs(chrome::kChromeUIScheme) && + if (url.SchemeIs(content::kChromeUIScheme) && url.host() == chrome::kChromeUINewTabHost) { return false; } diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 054b8c8..d58742d 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -366,7 +366,7 @@ void FirstRunBubbleLauncher::Observe( return; } - if (contents && contents->GetURL().SchemeIs(chrome::kChromeUIScheme)) { + if (contents && contents->GetURL().SchemeIs(content::kChromeUIScheme)) { // Suppress the first run bubble if 'make chrome metro' flow is showing. if (contents->GetURL().host() == chrome::kChromeUIMetroFlowHost) return; diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc index 4799efa..f48ca5a 100644 --- a/chrome/browser/history/history_service.cc +++ b/chrome/browser/history/history_service.cc @@ -1010,7 +1010,7 @@ bool HistoryService::CanAddURL(const GURL& url) { if (url.SchemeIs(content::kJavaScriptScheme) || url.SchemeIs(chrome::kChromeDevToolsScheme) || url.SchemeIs(chrome::kChromeNativeScheme) || - url.SchemeIs(chrome::kChromeUIScheme) || + url.SchemeIs(content::kChromeUIScheme) || url.SchemeIs(chrome::kChromeSearchScheme) || url.SchemeIs(chrome::kDomDistillerScheme) || 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 4caaaf0..6a0299c 100644 --- a/chrome/browser/history/in_memory_url_index.cc +++ b/chrome/browser/history/in_memory_url_index.cc @@ -40,7 +40,7 @@ void InitializeSchemeWhitelist(std::set<std::string>* whitelist) { if (!whitelist->empty()) return; // Nothing to do, already initialized. whitelist->insert(std::string(chrome::kAboutScheme)); - whitelist->insert(std::string(chrome::kChromeUIScheme)); + whitelist->insert(std::string(content::kChromeUIScheme)); whitelist->insert(std::string(content::kFileScheme)); whitelist->insert(std::string(content::kFtpScheme)); whitelist->insert(std::string(content::kHttpScheme)); diff --git a/chrome/browser/printing/print_preview_dialog_controller.cc b/chrome/browser/printing/print_preview_dialog_controller.cc index 1a54dc1..4fb29b6 100644 --- a/chrome/browser/printing/print_preview_dialog_controller.cc +++ b/chrome/browser/printing/print_preview_dialog_controller.cc @@ -367,7 +367,7 @@ bool PrintPreviewDialogController::IsPrintPreviewDialog(WebContents* contents) { // static bool PrintPreviewDialogController::IsPrintPreviewURL(const GURL& url) { - return (url.SchemeIs(chrome::kChromeUIScheme) && + return (url.SchemeIs(content::kChromeUIScheme) && url.host() == chrome::kChromeUIPrintHost); } diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index f8a5dc8..d6350ec 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -612,7 +612,7 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { chrome::kDomDistillerScheme, extensions::kExtensionScheme, extensions::kExtensionResourceScheme, - chrome::kChromeUIScheme, + content::kChromeUIScheme, content::kDataScheme, #if defined(OS_CHROMEOS) chrome::kDriveScheme, diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc index bb42ef0..3aa8c72 100644 --- a/chrome/browser/search/search.cc +++ b/chrome/browser/search/search.cc @@ -681,7 +681,7 @@ bool HandleNewTabURLRewrite(GURL* url, if (!IsInstantExtendedAPIEnabled()) return false; - if (!url->SchemeIs(chrome::kChromeUIScheme) || + if (!url->SchemeIs(content::kChromeUIScheme) || url->host() != chrome::kChromeUINewTabHost) return false; diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc index a07fd98..a130c89 100644 --- a/chrome/browser/sessions/base_session_service.cc +++ b/chrome/browser/sessions/base_session_service.cc @@ -267,7 +267,7 @@ bool BaseSessionService::RestoreSetWindowAppNameCommand( bool BaseSessionService::ShouldTrackEntry(const GURL& url) { // Blacklist chrome://quit and chrome://restart to avoid quit or restart // loops. - return url.is_valid() && !(url.SchemeIs(chrome::kChromeUIScheme) && + return url.is_valid() && !(url.SchemeIs(content::kChromeUIScheme) && (url.host() == chrome::kChromeUIQuitHost || url.host() == chrome::kChromeUIRestartHost)); } diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc index 323c144..42f04dc 100644 --- a/chrome/browser/sync/glue/session_model_associator.cc +++ b/chrome/browser/sync/glue/session_model_associator.cc @@ -1138,7 +1138,7 @@ bool SessionModelAssociator::TabHasValidEntry( return false; const GURL& virtual_url = entry->GetVirtualURL(); if (virtual_url.is_valid() && - !virtual_url.SchemeIs(chrome::kChromeUIScheme) && + !virtual_url.SchemeIs(content::kChromeUIScheme) && !virtual_url.SchemeIs(chrome::kChromeNativeScheme) && !virtual_url.SchemeIsFile()) { found_valid_url = true; diff --git a/chrome/browser/sync/glue/synced_session.cc b/chrome/browser/sync/glue/synced_session.cc index 07e769b..2f35ee3 100644 --- a/chrome/browser/sync/glue/synced_session.cc +++ b/chrome/browser/sync/glue/synced_session.cc @@ -64,7 +64,7 @@ bool ShouldSyncSessionTab(const SessionTab& tab) { for (size_t i = 0; i < tab.navigations.size(); ++i) { const GURL& virtual_url = tab.navigations.at(i).virtual_url(); if (virtual_url.is_valid() && - !virtual_url.SchemeIs(chrome::kChromeUIScheme) && + !virtual_url.SchemeIs(content::kChromeUIScheme) && !virtual_url.SchemeIs(chrome::kChromeNativeScheme) && !virtual_url.SchemeIsFile()) { found_valid_url = true; diff --git a/chrome/browser/sync/sessions2/sessions_util.cc b/chrome/browser/sync/sessions2/sessions_util.cc index 075cf5c..8f48bba 100644 --- a/chrome/browser/sync/sessions2/sessions_util.cc +++ b/chrome/browser/sync/sessions2/sessions_util.cc @@ -37,7 +37,7 @@ bool ShouldSyncTab(const SyncedTabDelegate& tab) { return false; const GURL& virtual_url = entry->GetVirtualURL(); if (virtual_url.is_valid() && - !virtual_url.SchemeIs(chrome::kChromeUIScheme) && + !virtual_url.SchemeIs(content::kChromeUIScheme) && !virtual_url.SchemeIs(chrome::kChromeNativeScheme) && !virtual_url.SchemeIsFile()) { found_valid_url = true; diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index f2db25e..c1486d6 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -391,7 +391,7 @@ bool RenderViewContextMenu::IsDevToolsURL(const GURL& url) { // static bool RenderViewContextMenu::IsInternalResourcesURL(const GURL& url) { - if (!url.SchemeIs(chrome::kChromeUIScheme)) + if (!url.SchemeIs(content::kChromeUIScheme)) return false; return url.host() == chrome::kChromeUISyncResourcesHost; } @@ -1289,7 +1289,7 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB: case IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE: return params_.src_url.is_valid() && - (params_.src_url.scheme() != chrome::kChromeUIScheme); + (params_.src_url.scheme() != content::kChromeUIScheme); case IDC_CONTENT_CONTEXT_COPYIMAGE: return params_.has_image_contents; diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index 1ffbc92..f177adb 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -97,7 +97,7 @@ bool TranslateManager::IsTranslatableURL(const GURL& url) { // - an FTP page (as FTP pages tend to have long lists of filenames that may // confuse the CLD) return !url.is_empty() && - !url.SchemeIs(chrome::kChromeUIScheme) && + !url.SchemeIs(content::kChromeUIScheme) && !url.SchemeIs(chrome::kChromeDevToolsScheme) && #if defined(OS_CHROMEOS) !(url.SchemeIs(extensions::kExtensionScheme) && diff --git a/chrome/browser/translate/translate_manager_unittest.cc b/chrome/browser/translate/translate_manager_unittest.cc index 0dbb9af..bb9690c 100644 --- a/chrome/browser/translate/translate_manager_unittest.cc +++ b/chrome/browser/translate/translate_manager_unittest.cc @@ -19,7 +19,7 @@ TEST_F(TranslateManagerTest, CheckTranslatableURL) { GURL empty_url = GURL(std::string()); EXPECT_FALSE(TranslateManager::IsTranslatableURL(empty_url)); - std::string chrome = std::string(chrome::kChromeUIScheme) + "://flags"; + std::string chrome = std::string(content::kChromeUIScheme) + "://flags"; GURL chrome_url = GURL(chrome); EXPECT_FALSE(TranslateManager::IsTranslatableURL(chrome_url)); diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 46a8e64..25f1d28 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -1421,9 +1421,9 @@ bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { if (entry) { GURL url = entry->GetURL(); GURL virtual_url = entry->GetVirtualURL(); - if ((url.SchemeIs(chrome::kChromeUIScheme) && + if ((url.SchemeIs(content::kChromeUIScheme) && url.host() == chrome::kChromeUINewTabHost) || - (virtual_url.SchemeIs(chrome::kChromeUIScheme) && + (virtual_url.SchemeIs(content::kChromeUIScheme) && virtual_url.host() == chrome::kChromeUINewTabHost)) { return true; } diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index a85a5bc..619b5cd 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -93,13 +93,13 @@ bool HasInternalURL(const NavigationEntry* entry) { // Check the |virtual_url()| first. This catches regular chrome:// URLs // including URLs that were rewritten (such as chrome://bookmarks). - if (entry->GetVirtualURL().SchemeIs(chrome::kChromeUIScheme)) + if (entry->GetVirtualURL().SchemeIs(content::kChromeUIScheme)) return true; // If the |virtual_url()| isn't a chrome:// URL, check if it's actually // view-source: of a chrome:// URL. if (entry->GetVirtualURL().SchemeIs(content::kViewSourceScheme)) - return entry->GetURL().SchemeIs(chrome::kChromeUIScheme); + return entry->GetURL().SchemeIs(content::kChromeUIScheme); return false; } diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index bc447c2..855a25b 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -723,7 +723,7 @@ bool IsURLAllowedInIncognito(const GURL& url, // Most URLs are allowed in incognito; the following are exceptions. // chrome://extensions is on the list because it redirects to // chrome://settings. - if (url.scheme() == chrome::kChromeUIScheme && + if (url.scheme() == content::kChromeUIScheme && (url.host() == chrome::kChromeUISettingsHost || url.host() == chrome::kChromeUISettingsFrameHost || url.host() == chrome::kChromeUIExtensionsHost || @@ -754,7 +754,7 @@ bool IsURLAllowedInIncognito(const GURL& url, &rewritten_url, browser_context, &reverse_on_redirect); // Some URLs are mapped to uber subpages. Do not allow them in incognito. - return !(rewritten_url.scheme() == chrome::kChromeUIScheme && + return !(rewritten_url.scheme() == content::kChromeUIScheme && rewritten_url.host() == chrome::kChromeUIUberHost); } diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc index 911523c..76624a9 100644 --- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc @@ -653,7 +653,7 @@ void BrowserToolbarGtk::OnDragDataReceived(GtkWidget* widget, if (!url.is_valid()) return; - bool url_is_newtab = url.SchemeIs(chrome::kChromeUIScheme) && + bool url_is_newtab = url.SchemeIs(content::kChromeUIScheme) && url.host() == chrome::kChromeUINewTabHost; home_page_is_new_tab_page_.SetValue(url_is_newtab); if (!url_is_newtab) diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc index e2c5349..dfad932 100644 --- a/chrome/browser/ui/tabs/tab_strip_model.cc +++ b/chrome/browser/ui/tabs/tab_strip_model.cc @@ -1177,7 +1177,7 @@ std::vector<int> TabStripModel::GetIndicesForCommand(int index) const { bool TabStripModel::IsNewTabAtEndOfTabStrip(WebContents* contents) const { const GURL& url = contents->GetURL(); - return url.SchemeIs(chrome::kChromeUIScheme) && + return url.SchemeIs(content::kChromeUIScheme) && url.host() == chrome::kChromeUINewTabHost && contents == GetWebContentsAtImpl(count() - 1) && contents->GetController().GetEntryCount() == 1; diff --git a/chrome/browser/ui/toolbar/origin_chip.cc b/chrome/browser/ui/toolbar/origin_chip.cc index f070b73..e9caa30 100644 --- a/chrome/browser/ui/toolbar/origin_chip.cc +++ b/chrome/browser/ui/toolbar/origin_chip.cc @@ -28,7 +28,7 @@ namespace { // number for the title of the page. If we don't have a specialized title, // returns -1. int StringForChromeHost(const GURL& url) { - DCHECK(url.is_empty() || url.SchemeIs(chrome::kChromeUIScheme)); + DCHECK(url.is_empty() || url.SchemeIs(content::kChromeUIScheme)); if (url.is_empty()) return IDS_NEW_TAB_TITLE; @@ -99,7 +99,7 @@ base::string16 OriginChip::LabelFromURLForProfile(const GURL& provided_url, return base::UTF8ToUTF16(url.spec()); // Chrome built-in pages. - if (url.is_empty() || url.SchemeIs(chrome::kChromeUIScheme)) { + if (url.is_empty() || url.SchemeIs(content::kChromeUIScheme)) { int string_ref = StringForChromeHost(url); return (string_ref == -1) ? base::UTF8ToUTF16("Chrome") : diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc index 10dee3ef..f0de3dc 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc @@ -193,9 +193,9 @@ bool ToolbarModelImpl::ShouldDisplayURL() const { GURL url = entry->GetURL(); GURL virtual_url = entry->GetVirtualURL(); - if (url.SchemeIs(chrome::kChromeUIScheme) || - virtual_url.SchemeIs(chrome::kChromeUIScheme)) { - if (!url.SchemeIs(chrome::kChromeUIScheme)) + if (url.SchemeIs(content::kChromeUIScheme) || + virtual_url.SchemeIs(content::kChromeUIScheme)) { + if (!url.SchemeIs(content::kChromeUIScheme)) url = virtual_url; return url.host() != chrome::kChromeUINewTabHost; } diff --git a/chrome/browser/ui/views/toolbar/origin_chip_view.cc b/chrome/browser/ui/views/toolbar/origin_chip_view.cc index 9da7401..10c3691 100644 --- a/chrome/browser/ui/views/toolbar/origin_chip_view.cc +++ b/chrome/browser/ui/views/toolbar/origin_chip_view.cc @@ -227,7 +227,7 @@ void OriginChipView::Update(content::WebContents* web_contents) { showing_16x16_icon_ = false; if (url_displayed_.is_empty() || - url_displayed_.SchemeIs(chrome::kChromeUIScheme)) { + url_displayed_.SchemeIs(content::kChromeUIScheme)) { icon = IDR_PRODUCT_LOGO_16; showing_16x16_icon_ = true; } diff --git a/chrome/browser/ui/website_settings/website_settings.cc b/chrome/browser/ui/website_settings/website_settings.cc index cfff979..d147bb6 100644 --- a/chrome/browser/ui/website_settings/website_settings.cc +++ b/chrome/browser/ui/website_settings/website_settings.cc @@ -295,7 +295,7 @@ void WebsiteSettings::OnUIClosing() { void WebsiteSettings::Init(Profile* profile, const GURL& url, const content::SSLStatus& ssl) { - if (url.SchemeIs(chrome::kChromeUIScheme)) { + if (url.SchemeIs(content::kChromeUIScheme)) { site_identity_status_ = SITE_IDENTITY_STATUS_INTERNAL_PAGE; site_identity_details_ = l10n_util::GetStringUTF16(IDS_PAGE_INFO_INTERNAL_PAGE); diff --git a/chrome/browser/ui/website_settings/website_settings_utils.cc b/chrome/browser/ui/website_settings/website_settings_utils.cc index d663d37..2da2f77 100644 --- a/chrome/browser/ui/website_settings/website_settings_utils.cc +++ b/chrome/browser/ui/website_settings/website_settings_utils.cc @@ -4,12 +4,12 @@ #include "chrome/browser/ui/website_settings/website_settings_utils.h" -#include "chrome/common/url_constants.h" +#include "content/public/common/url_constants.h" #include "extensions/common/constants.h" #include "url/gurl.h" // Returns true if the passed |url| refers to an internal chrome page. bool InternalChromePage(const GURL& url) { - return url.SchemeIs(chrome::kChromeUIScheme) || + return url.SchemeIs(content::kChromeUIScheme) || url.SchemeIs(extensions::kExtensionScheme); } diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index 310d5c4..b1a19b9 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc @@ -225,7 +225,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, // This will get called a lot to check all URLs, so do a quick check of other // schemes to filter out most URLs. if (!url.SchemeIs(chrome::kChromeDevToolsScheme) && - !url.SchemeIs(chrome::kChromeUIScheme)) { + !url.SchemeIs(content::kChromeUIScheme)) { return NULL; } diff --git a/chrome/browser/ui/webui/theme_source.cc b/chrome/browser/ui/webui/theme_source.cc index 4489807..0f676c5 100644 --- a/chrome/browser/ui/webui/theme_source.cc +++ b/chrome/browser/ui/webui/theme_source.cc @@ -28,8 +28,8 @@ using content::BrowserThread; namespace { std::string GetThemePath() { - return std::string(chrome::kChromeUIScheme) + - "://" + std::string(chrome::kChromeUIThemePath) + "/"; + return std::string(content::kChromeUIScheme) + "://" + + std::string(chrome::kChromeUIThemePath) + "/"; } // use a resource map rather than hard-coded strings. diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc index 913b0cd..b768122 100644 --- a/chrome/common/extensions/chrome_extensions_client.cc +++ b/chrome/common/extensions/chrome_extensions_client.cc @@ -85,7 +85,7 @@ void ChromeExtensionsClient::FilterHostPermissions( for (URLPatternSet::const_iterator i = hosts.begin(); i != hosts.end(); ++i) { // Filters out every URL pattern that matches chrome:// scheme. - if (i->scheme() == chrome::kChromeUIScheme) { + if (i->scheme() == content::kChromeUIScheme) { // chrome://favicon is the only URL for chrome:// scheme that we // want to support. We want to deprecate the "chrome" scheme. // We should not add any additional "host" here. diff --git a/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc b/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc index 94b5fd9..2753614 100644 --- a/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc +++ b/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc @@ -151,7 +151,7 @@ bool LoadUserScriptFromDictionary(const base::DictionaryValue* content_script, // TODO(aboxhall): check for webstore if (!PermissionsData::CanExecuteScriptEverywhere(extension) && - pattern.scheme() != chrome::kChromeUIScheme) { + pattern.scheme() != content::kChromeUIScheme) { // Exclude SCHEME_CHROMEUI unless it's been explicitly requested. // If the --extensions-on-chrome-urls flag has not been passed, requesting // a chrome:// url will cause a parse failure above, so there's no need to diff --git a/chrome/common/net/url_fixer_upper.cc b/chrome/common/net/url_fixer_upper.cc index 68da552..aa9c32b 100644 --- a/chrome/common/net/url_fixer_upper.cc +++ b/chrome/common/net/url_fixer_upper.cc @@ -425,9 +425,12 @@ std::string SegmentURLInternal(std::string* text, url_parse::Parsed* parts) { } // Proceed with about and chrome schemes, but not file or nonstandard schemes. - if ((scheme != chrome::kAboutScheme) && (scheme != chrome::kChromeUIScheme) && - ((scheme == content::kFileScheme) || !url_util::IsStandard(scheme.c_str(), - url_parse::Component(0, static_cast<int>(scheme.length()))))) + if ((scheme != chrome::kAboutScheme) && + (scheme != content::kChromeUIScheme) && + ((scheme == content::kFileScheme) || + !url_util::IsStandard( + scheme.c_str(), + url_parse::Component(0, static_cast<int>(scheme.length()))))) return scheme; if (scheme == content::kFileSystemScheme) { @@ -529,13 +532,14 @@ GURL URLFixerUpper::FixupURL(const std::string& text, // Parse and rebuild about: and chrome: URLs, except about:blank. bool chrome_url = !LowerCaseEqualsASCII(trimmed, content::kAboutBlankURL) && - ((scheme == chrome::kAboutScheme) || (scheme == chrome::kChromeUIScheme)); + ((scheme == chrome::kAboutScheme) || + (scheme == content::kChromeUIScheme)); // For some schemes whose layouts we understand, we rebuild it. if (chrome_url || url_util::IsStandard(scheme.c_str(), url_parse::Component(0, static_cast<int>(scheme.length())))) { // Replace the about: scheme with the chrome: scheme. - std::string url(chrome_url ? chrome::kChromeUIScheme : scheme); + std::string url(chrome_url ? content::kChromeUIScheme : scheme); url.append(content::kStandardSchemeSeparator); // We need to check whether the |username| is valid because it is our diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 08e3218..9318da9 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -297,7 +297,7 @@ void ChromeContentRendererClient::RenderThreadStarted() { // should not be accessible by normal content, and should also be unable to // script anything but themselves (to help limit the damage that a corrupt // page could cause). - WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); + WebString chrome_ui_scheme(ASCIIToUTF16(content::kChromeUIScheme)); WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); WebString chrome_search_scheme(ASCIIToUTF16(chrome::kChromeSearchScheme)); diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc index 2a5fbf5..22a0a80 100644 --- a/chrome/renderer/content_settings_observer.cc +++ b/chrome/renderer/content_settings_observer.cc @@ -396,7 +396,7 @@ bool ContentSettingsObserver::allowWebComponents(WebFrame* frame, return true; WebSecurityOrigin origin = frame->document().securityOrigin(); - if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) + if (EqualsASCII(origin.protocol(), content::kChromeUIScheme)) return true; if (const extensions::Extension* extension = GetExtension(origin)) { @@ -633,7 +633,7 @@ bool ContentSettingsObserver::IsWhitelistedForContentSettings( if (origin.isUnique()) return false; // Uninitialized document? - if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme)) + if (EqualsASCII(origin.protocol(), content::kChromeUIScheme)) return true; // Browser UI elements should still work. if (EqualsASCII(origin.protocol(), chrome::kChromeDevToolsScheme)) diff --git a/chrome/renderer/content_settings_observer_unittest.cc b/chrome/renderer/content_settings_observer_unittest.cc index 03d0f8b..0c77d30 100644 --- a/chrome/renderer/content_settings_observer_unittest.cc +++ b/chrome/renderer/content_settings_observer_unittest.cc @@ -20,7 +20,7 @@ TEST_F(ContentSettingsObserverTest, WhitelistedSchemes) { std::string end_url = ":something"; GURL chrome_ui_url = - GURL(std::string(chrome::kChromeUIScheme).append(end_url)); + GURL(std::string(content::kChromeUIScheme).append(end_url)); EXPECT_TRUE(ContentSettingsObserver::IsWhitelistedForContentSettings( WebSecurityOrigin::create(chrome_ui_url), GURL())); diff --git a/chrome/renderer/extensions/dispatcher.cc b/chrome/renderer/extensions/dispatcher.cc index ba70d94..511a92d 100644 --- a/chrome/renderer/extensions/dispatcher.cc +++ b/chrome/renderer/extensions/dispatcher.cc @@ -1355,7 +1355,7 @@ void Dispatcher::InitOriginPermissions(const Extension* extension) { if (extension->HasAPIPermission(APIPermission::kManagement)) { WebSecurityPolicy::addOriginAccessWhitelistEntry( extension->url(), - WebString::fromUTF8(chrome::kChromeUIScheme), + WebString::fromUTF8(content::kChromeUIScheme), WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), false); } @@ -1376,7 +1376,7 @@ void Dispatcher::AddOrRemoveOriginPermissions( content::kHttpScheme, content::kHttpsScheme, content::kFileScheme, - chrome::kChromeUIScheme, + content::kChromeUIScheme, }; for (size_t j = 0; j < arraysize(schemes); ++j) { if (i->MatchesScheme(schemes[j])) { diff --git a/chrome/renderer/extensions/user_script_slave.cc b/chrome/renderer/extensions/user_script_slave.cc index e45d490..fc53891 100644 --- a/chrome/renderer/extensions/user_script_slave.cc +++ b/chrome/renderer/extensions/user_script_slave.cc @@ -107,7 +107,7 @@ void UserScriptSlave::InitializeIsolatedWorld(int isolated_world_id, content::kHttpScheme, content::kHttpsScheme, content::kFileScheme, - chrome::kChromeUIScheme, + content::kChromeUIScheme, }; for (size_t j = 0; j < arraysize(schemes); ++j) { if (i->MatchesScheme(schemes[j])) { diff --git a/chrome/utility/importer/bookmarks_file_importer.cc b/chrome/utility/importer/bookmarks_file_importer.cc index 097b09d..b552a4f 100644 --- a/chrome/utility/importer/bookmarks_file_importer.cc +++ b/chrome/utility/importer/bookmarks_file_importer.cc @@ -45,7 +45,7 @@ bool CanImportURL(const GURL& url) { // If |url| starts with chrome:// or about:, check if it's one of the URLs // that we support. - if (url.SchemeIs(chrome::kChromeUIScheme) || + if (url.SchemeIs(content::kChromeUIScheme) || url.SchemeIs(chrome::kAboutScheme)) { if (url.host() == chrome::kChromeUIUberHost || url.host() == chrome::kChromeUIAboutHost) diff --git a/content/browser/browser_url_handler_impl.cc b/content/browser/browser_url_handler_impl.cc index 10a5c88..4eaf1ec 100644 --- a/content/browser/browser_url_handler_impl.cc +++ b/content/browser/browser_url_handler_impl.cc @@ -24,9 +24,13 @@ static bool HandleViewSource(GURL* url, BrowserContext* browser_context) { // Bug 26129: limit view-source to view the content and not any // other kind of 'active' url scheme like 'javascript' or 'data'. static const char* const default_allowed_sub_schemes[] = { - kHttpScheme, kHttpsScheme, kFtpScheme, - chrome::kChromeDevToolsScheme, chrome::kChromeUIScheme, - kFileScheme, kFileSystemScheme + kHttpScheme, + kHttpsScheme, + kFtpScheme, + chrome::kChromeDevToolsScheme, + kChromeUIScheme, + kFileScheme, + kFileSystemScheme }; // Merge all the schemes for which view-source is allowed by default, with diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc index b115217..da78140 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc @@ -545,7 +545,7 @@ void ChildProcessSecurityPolicyImpl::GrantWebUIBindings(int child_id) { state->second->GrantBindings(BINDINGS_POLICY_WEB_UI); // Web UI bindings need the ability to request chrome: URLs. - state->second->GrantScheme(chrome::kChromeUIScheme); + state->second->GrantScheme(kChromeUIScheme); // Web UI pages can contain links to file:// URLs. state->second->GrantScheme(kFileScheme); diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc index c74294f..e209669 100644 --- a/content/browser/child_process_security_policy_unittest.cc +++ b/content/browser/child_process_security_policy_unittest.cc @@ -63,7 +63,7 @@ class ChildProcessSecurityPolicyTest : public testing::Test { // Claim to always handle chrome:// URLs because the CPSP's notion of // allowing WebUI bindings is hard-wired to this particular scheme. - test_browser_client_.AddScheme(chrome::kChromeUIScheme); + test_browser_client_.AddScheme(kChromeUIScheme); // Claim to always handle file:// URLs like the browser would. // net::URLRequest::IsHandledURL() no longer claims support for default @@ -132,7 +132,7 @@ TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) { p->RegisterWebSafeScheme("registered-web-safe-scheme"); EXPECT_TRUE(p->IsWebSafeScheme("registered-web-safe-scheme")); - EXPECT_FALSE(p->IsWebSafeScheme(chrome::kChromeUIScheme)); + EXPECT_FALSE(p->IsWebSafeScheme(kChromeUIScheme)); } TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) { @@ -147,7 +147,7 @@ TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) { p->RegisterPseudoScheme("registered-pseudo-scheme"); EXPECT_TRUE(p->IsPseudoScheme("registered-pseudo-scheme")); - EXPECT_FALSE(p->IsPseudoScheme(chrome::kChromeUIScheme)); + EXPECT_FALSE(p->IsPseudoScheme(kChromeUIScheme)); } TEST_F(ChildProcessSecurityPolicyTest, StandardSchemesTest) { diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc index e25a8df..77d3813 100644 --- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc +++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc @@ -1391,7 +1391,7 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, RendererDebugURLsDontSwap) { IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, IgnoreRendererDebugURLsWhenCrashed) { // Visit a WebUI page with bindings. - GURL webui_url = GURL(std::string(chrome::kChromeUIScheme) + "://" + + GURL webui_url = GURL(std::string(kChromeUIScheme) + "://" + std::string(kChromeUIGpuHost)); NavigateToURL(shell(), webui_url); EXPECT_TRUE(ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( diff --git a/content/browser/net/view_blob_internals_job_factory.cc b/content/browser/net/view_blob_internals_job_factory.cc index 85356e5..984763d 100644 --- a/content/browser/net/view_blob_internals_job_factory.cc +++ b/content/browser/net/view_blob_internals_job_factory.cc @@ -13,7 +13,7 @@ namespace content { // static. bool ViewBlobInternalsJobFactory::IsSupportedURL(const GURL& url) { - return url.SchemeIs(chrome::kChromeUIScheme) && + return url.SchemeIs(kChromeUIScheme) && url.host() == kChromeUIBlobInternalsHost; } diff --git a/content/browser/net/view_http_cache_job_factory.cc b/content/browser/net/view_http_cache_job_factory.cc index 4264389..a0cce463 100644 --- a/content/browser/net/view_http_cache_job_factory.cc +++ b/content/browser/net/view_http_cache_job_factory.cc @@ -190,7 +190,7 @@ void ViewHttpCacheJob::Core::OnIOComplete(int result) { // Static. bool ViewHttpCacheJobFactory::IsSupportedURL(const GURL& url) { - return url.SchemeIs(chrome::kChromeUIScheme) && + return url.SchemeIs(kChromeUIScheme) && url.host() == kChromeUINetworkViewCacheHost; } diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc index 872152c..18eab7b 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc @@ -529,9 +529,8 @@ WebPreferences RenderViewHostImpl::GetWebkitPrefs(const GURL& url) { #if !defined(USE_AURA) // Force accelerated compositing and 2d canvas off for chrome: and about: // pages (unless it's specifically allowed). - if ((url.SchemeIs(chrome::kChromeUIScheme) || - (url.SchemeIs(chrome::kAboutScheme) && - url.spec() != kAboutBlankURL)) && + if ((url.SchemeIs(kChromeUIScheme) || + (url.SchemeIs(chrome::kAboutScheme) && url.spec() != kAboutBlankURL)) && !command_line.HasSwitch(switches::kAllowWebUICompositing)) { prefs.accelerated_compositing_enabled = false; prefs.accelerated_2d_canvas_enabled = false; diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc index ac3c192..714b6e4 100644 --- a/content/browser/site_instance_impl_unittest.cc +++ b/content/browser/site_instance_impl_unittest.cc @@ -93,7 +93,7 @@ class SiteInstanceTest : public testing::Test { virtual void SetUp() { old_browser_client_ = SetBrowserClientForTesting(&browser_client_); url_util::AddStandardScheme(kPrivilegedScheme); - url_util::AddStandardScheme(chrome::kChromeUIScheme); + url_util::AddStandardScheme(kChromeUIScheme); SiteInstanceImpl::set_render_process_host_factory(&rph_factory_); } @@ -583,13 +583,12 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) { // Create some WebUI instances and make sure they share a process. scoped_refptr<SiteInstanceImpl> webui1_instance(CreateSiteInstance( - browser_context.get(), - GURL(chrome::kChromeUIScheme + std::string("://newtab")))); + browser_context.get(), GURL(kChromeUIScheme + std::string("://newtab")))); policy->GrantWebUIBindings(webui1_instance->GetProcess()->GetID()); - scoped_refptr<SiteInstanceImpl> webui2_instance(CreateSiteInstance( - browser_context.get(), - GURL(chrome::kChromeUIScheme + std::string("://history")))); + scoped_refptr<SiteInstanceImpl> webui2_instance( + CreateSiteInstance(browser_context.get(), + GURL(kChromeUIScheme + std::string("://history")))); scoped_ptr<RenderProcessHost> dom_host(webui1_instance->GetProcess()); EXPECT_EQ(webui1_instance->GetProcess(), webui2_instance->GetProcess()); diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index fef284f..16a11e4 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc @@ -384,7 +384,7 @@ StoragePartitionImpl* StoragePartitionImplMap::Get( protocol_handlers[kFileSystemScheme] = linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( CreateFileSystemProtocolHandler(partition->GetFileSystemContext())); - protocol_handlers[chrome::kChromeUIScheme] = + protocol_handlers[kChromeUIScheme] = linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( URLDataManagerBackend::CreateProtocolHandler( browser_context_->GetResourceContext(), diff --git a/content/browser/webui/url_data_manager_backend.cc b/content/browser/webui/url_data_manager_backend.cc index 10d518b..6653dc7 100644 --- a/content/browser/webui/url_data_manager_backend.cc +++ b/content/browser/webui/url_data_manager_backend.cc @@ -64,9 +64,9 @@ bool SchemeIsInSchemes(const std::string& scheme, bool CheckURLIsValid(const GURL& url) { std::vector<std::string> additional_schemes; DCHECK(url.SchemeIs(chrome::kChromeDevToolsScheme) || - url.SchemeIs(chrome::kChromeUIScheme) || + url.SchemeIs(kChromeUIScheme) || (GetContentClient()->browser()->GetAdditionalWebUISchemes( - &additional_schemes), + &additional_schemes), SchemeIsInSchemes(url.scheme(), additional_schemes))); if (!url.is_valid()) { @@ -394,7 +394,7 @@ class ChromeProtocolHandler network_delegate); // Next check for chrome://appcache-internals/, which uses its own job type. - if (request->url().SchemeIs(chrome::kChromeUIScheme) && + if (request->url().SchemeIs(kChromeUIScheme) && request->url().host() == kChromeUIAppCacheInternalsHost) { return appcache::ViewAppCacheInternalsJobFactory::CreateJobForRequest( request, network_delegate, appcache_service_); @@ -408,14 +408,14 @@ class ChromeProtocolHandler #if defined(USE_TCMALLOC) // Next check for chrome://tcmalloc/, which uses its own job type. - if (request->url().SchemeIs(chrome::kChromeUIScheme) && + if (request->url().SchemeIs(kChromeUIScheme) && request->url().host() == kChromeUITcmallocHost) { return new TcmallocInternalsRequestJob(request, network_delegate); } #endif // Next check for chrome://histograms/, which uses its own job type. - if (request->url().SchemeIs(chrome::kChromeUIScheme) && + if (request->url().SchemeIs(kChromeUIScheme) && request->url().host() == kChromeUIHistogramHost) { return new HistogramInternalsRequestJob(request, network_delegate); } diff --git a/content/common/savable_url_schemes.cc b/content/common/savable_url_schemes.cc index 0880dc6..f8845d6 100644 --- a/content/common/savable_url_schemes.cc +++ b/content/common/savable_url_schemes.cc @@ -19,7 +19,7 @@ const char* const kDefaultSavableSchemes[] = { kFileSystemScheme, kFtpScheme, chrome::kChromeDevToolsScheme, - chrome::kChromeUIScheme, + kChromeUIScheme, kDataScheme, NULL }; diff --git a/content/common/url_schemes.cc b/content/common/url_schemes.cc index 2b4be7d..8479ce4 100644 --- a/content/common/url_schemes.cc +++ b/content/common/url_schemes.cc @@ -34,7 +34,7 @@ void RegisterContentSchemes(bool lock_standard_schemes) { &additional_savable_schemes); url_util::AddStandardScheme(chrome::kChromeDevToolsScheme); - url_util::AddStandardScheme(chrome::kChromeUIScheme); + url_util::AddStandardScheme(kChromeUIScheme); url_util::AddStandardScheme(kGuestScheme); url_util::AddStandardScheme(kMetadataScheme); std::for_each(additional_standard_schemes.begin(), diff --git a/content/public/browser/url_data_source.cc b/content/public/browser/url_data_source.cc index d9506f5..96a2030 100644 --- a/content/public/browser/url_data_source.cc +++ b/content/public/browser/url_data_source.cc @@ -47,7 +47,7 @@ bool URLDataSource::ShouldDenyXFrameOptions() const { bool URLDataSource::ShouldServiceRequest(const net::URLRequest* request) const { if (request->url().SchemeIs(chrome::kChromeDevToolsScheme) || - request->url().SchemeIs(chrome::kChromeUIScheme)) + request->url().SchemeIs(kChromeUIScheme)) return true; return false; } diff --git a/content/public/common/url_constants.cc b/content/public/common/url_constants.cc index a1a4117..fe58b0d 100644 --- a/content/public/common/url_constants.cc +++ b/content/public/common/url_constants.cc @@ -12,11 +12,11 @@ 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"; } // namespace chrome namespace content { +const char kChromeUIScheme[] = "chrome"; const char kDataScheme[] = "data"; const char kFileScheme[] = "file"; const char kFileSystemScheme[] = "filesystem"; diff --git a/content/public/common/url_constants.h b/content/public/common/url_constants.h index 5459ce4..a4cb86b 100644 --- a/content/public/common/url_constants.h +++ b/content/public/common/url_constants.h @@ -18,11 +18,11 @@ namespace chrome { 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. } // namespace chrome namespace content { +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[]; diff --git a/content/public/common/url_utils.cc b/content/public/common/url_utils.cc index 1aa1a97..bf37455 100644 --- a/content/public/common/url_utils.cc +++ b/content/public/common/url_utils.cc @@ -26,7 +26,7 @@ bool HasWebUIScheme(const GURL& url) { #if !defined(OS_IOS) url.SchemeIs(chrome::kChromeDevToolsScheme) || #endif - url.SchemeIs(chrome::kChromeUIScheme); + url.SchemeIs(kChromeUIScheme); } bool IsSavableURL(const GURL& url) { diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 182d590..aae7438 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -445,7 +445,7 @@ NOINLINE static void MaybeTriggerAsanError(const GURL& url) { #endif // ADDRESS_SANITIZER static void MaybeHandleDebugURL(const GURL& url) { - if (!url.SchemeIs(chrome::kChromeUIScheme)) + if (!url.SchemeIs(kChromeUIScheme)) return; if (url == GURL(kChromeUICrashURL)) { CrashIntentionally(); diff --git a/content/renderer/web_ui_extension.cc b/content/renderer/web_ui_extension.cc index fe2fea7..1de92ea 100644 --- a/content/renderer/web_ui_extension.cc +++ b/content/renderer/web_ui_extension.cc @@ -92,7 +92,7 @@ bool WebUIExtensionWrapper::ShouldRespondToRequest( bool webui_enabled = (render_view->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI) && - (frame_url.SchemeIs(chrome::kChromeUIScheme) || + (frame_url.SchemeIs(kChromeUIScheme) || frame_url.SchemeIs(kDataScheme)); if (!webui_enabled) diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc index 6b51c49..1b6407e 100644 --- a/content/shell/browser/shell_content_browser_client.cc +++ b/content/shell/browser/shell_content_browser_client.cc @@ -181,7 +181,7 @@ bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { static const char* const kProtocolList[] = { chrome::kBlobScheme, kFileSystemScheme, - chrome::kChromeUIScheme, + kChromeUIScheme, chrome::kChromeDevToolsScheme, kDataScheme, kFileScheme, diff --git a/extensions/common/permissions/permissions_data.cc b/extensions/common/permissions/permissions_data.cc index 825f5ff..43a6004 100644 --- a/extensions/common/permissions/permissions_data.cc +++ b/extensions/common/permissions/permissions_data.cc @@ -65,7 +65,7 @@ bool CanSpecifyHostPermission(const Extension* extension, const URLPattern& pattern, const APIPermissionSet& permissions) { if (!pattern.match_all_urls() && - pattern.MatchesScheme(chrome::kChromeUIScheme)) { + pattern.MatchesScheme(content::kChromeUIScheme)) { URLPatternSet chrome_scheme_hosts = ExtensionsClient::Get()-> GetPermittedChromeSchemeHosts(extension, permissions); if (chrome_scheme_hosts.ContainsPattern(pattern)) @@ -190,7 +190,7 @@ bool ParseHelper(Extension* extension, valid_schemes &= ~URLPattern::SCHEME_FILE; } - if (pattern.scheme() != chrome::kChromeUIScheme && + if (pattern.scheme() != content::kChromeUIScheme && !PermissionsData::CanExecuteScriptEverywhere(extension)) { // Keep chrome:// in allowed schemes only if it's explicitly requested // or CanExecuteScriptEverywhere is true. If the @@ -476,7 +476,7 @@ bool PermissionsData::CanExecuteScriptOnPage(const Extension* extension, } if (!command_line->HasSwitch(switches::kExtensionsOnChromeURLs)) { - if (document_url.SchemeIs(chrome::kChromeUIScheme) && + if (document_url.SchemeIs(content::kChromeUIScheme) && !can_execute_everywhere) { if (error) *error = errors::kCannotAccessChromeUrl; diff --git a/extensions/common/url_pattern.cc b/extensions/common/url_pattern.cc index ab33bd8..477d3dd 100644 --- a/extensions/common/url_pattern.cc +++ b/extensions/common/url_pattern.cc @@ -24,7 +24,7 @@ const char* kValidSchemes[] = { content::kHttpsScheme, content::kFileScheme, content::kFtpScheme, - chrome::kChromeUIScheme, + content::kChromeUIScheme, extensions::kExtensionScheme, content::kFileSystemScheme, }; |