diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-13 20:27:42 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-13 20:27:42 +0000 |
commit | 885c0e94fd5e3d81bb258191d720b7b22ca683df (patch) | |
tree | 27022b02d52dda9e1cb8b86cde08c86220615f56 | |
parent | bf4d4efcd977d9f4438725d77e6bc9e02aac4b1c (diff) | |
download | chromium_src-885c0e94fd5e3d81bb258191d720b7b22ca683df.zip chromium_src-885c0e94fd5e3d81bb258191d720b7b22ca683df.tar.gz chromium_src-885c0e94fd5e3d81bb258191d720b7b22ca683df.tar.bz2 |
Establish /extensions directory and move URLPattern there.
This doesn't create an extensions gyp target, or a module with a public API.
It does set of DEPS rules and seems like it will make it easier for people to
write correctly layered code today, while we are in transition.
BUG=159265
TBR=ben@chromium.org
Review URL: https://codereview.chromium.org/11410015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167454 0039d316-1c4b-4281-b951-d872f2087c98
105 files changed, 276 insertions, 175 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 1d31852..20d1923 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -7,6 +7,7 @@ include_rules = [ "+content/components", "+content/public/browser", "+device", + "+extensions/common", "+google/cacheinvalidation", # Sync invalidation API protobuf files. "+google_apis", "+google_update", diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 0227a40..f27b150 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -127,11 +127,9 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/permissions/permission_set.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/extensions/url_pattern_set.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" -#include "chrome/common/url_constants.h" #include "content/public/browser/browser_child_process_host_iterator.h" #include "content/public/browser/child_process_data.h" #include "content/public/browser/favicon_status.h" @@ -149,6 +147,7 @@ #include "content/public/common/common_param_traits.h" #include "content/public/common/geoposition.h" #include "content/public/common/ssl_status.h" +#include "extensions/common/url_pattern.h" #include "net/cookies/cookie_store.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "ui/base/events/event_constants.h" diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 238fa5a..fb4ec41 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -78,6 +78,7 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/resource_dispatcher_host.h" #include "content/public/common/pepper_plugin_info.h" +#include "extensions/common/constants.h" #include "net/socket/client_socket_pool_manager.h" #include "net/url_request/url_request_context_getter.h" #include "ui/base/l10n/l10n_util.h" @@ -161,7 +162,7 @@ BrowserProcessImpl::BrowserProcessImpl( net_log_.reset(new ChromeNetLog); ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( - chrome::kExtensionScheme); + extensions::kExtensionScheme); ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( chrome::kExtensionResourceScheme); diff --git a/chrome/browser/browsing_data/browsing_data_helper.cc b/chrome/browser/browsing_data/browsing_data_helper.cc index 18cdaa1..da51712a 100644 --- a/chrome/browser/browsing_data/browsing_data_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_helper.cc @@ -10,6 +10,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" #include "content/public/browser/child_process_security_policy.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" @@ -44,7 +45,7 @@ bool BrowsingDataHelper::HasWebScheme(const GURL& origin) { // Static bool BrowsingDataHelper::IsExtensionScheme(const std::string& scheme) { - return scheme == chrome::kExtensionScheme; + return scheme == extensions::kExtensionScheme; } // Static diff --git a/chrome/browser/browsing_data/browsing_data_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_helper_unittest.cc index d3eab5d..cd1a98e 100644 --- a/chrome/browser/browsing_data/browsing_data_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_helper_unittest.cc @@ -8,6 +8,7 @@ #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 "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" @@ -73,7 +74,7 @@ TEST_F(BrowsingDataHelperTest, WebSafeSchemesAreWebSafe) { } TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotWebSafe) { - EXPECT_FALSE(IsWebScheme(chrome::kExtensionScheme)); + EXPECT_FALSE(IsWebScheme(extensions::kExtensionScheme)); EXPECT_FALSE(IsWebScheme(chrome::kAboutScheme)); EXPECT_FALSE(IsWebScheme(chrome::kChromeDevToolsScheme)); EXPECT_FALSE(IsWebScheme(chrome::kChromeInternalScheme)); @@ -97,7 +98,7 @@ TEST_F(BrowsingDataHelperTest, WebSafeSchemesAreNotExtensions) { } TEST_F(BrowsingDataHelperTest, ChromeSchemesAreNotAllExtension) { - EXPECT_TRUE(IsExtensionScheme(chrome::kExtensionScheme)); + EXPECT_TRUE(IsExtensionScheme(extensions::kExtensionScheme)); EXPECT_FALSE(IsExtensionScheme(chrome::kAboutScheme)); EXPECT_FALSE(IsExtensionScheme(chrome::kChromeDevToolsScheme)); diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index e123ba5..d49daf8 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -101,6 +101,7 @@ #include "content/public/browser/web_contents_view.h" #include "content/public/common/child_process_host.h" #include "content/public/common/content_descriptors.h" +#include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "grit/ui_resources.h" #include "net/base/escape.h" @@ -306,7 +307,7 @@ RenderProcessHostPrivilege GetPrivilegeRequiredByUrl( if (!url.is_valid()) return PRIV_NORMAL; - if (url.SchemeIs(chrome::kExtensionScheme)) { + if (url.SchemeIs(extensions::kExtensionScheme)) { const Extension* extension = service->extensions()->GetByID(url.host()); if (extension && extension->is_storage_isolated()) @@ -641,7 +642,7 @@ bool ChromeContentBrowserClient::ShouldUseProcessPerSite( // Non-extension URLs should generally use process-per-site-instance. // Because we expect to use the effective URL, URLs for hosted apps (apart // from bookmark apps) should have an extension scheme by now. - if (!effective_url.SchemeIs(chrome::kExtensionScheme)) + if (!effective_url.SchemeIs(extensions::kExtensionScheme)) return false; Profile* profile = Profile::FromBrowserContext(browser_context); @@ -828,7 +829,7 @@ bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( // Always choose a new process when navigating to extension URLs. The // process grouping logic will combine all of a given extension's pages // into the same process. - if (new_url.SchemeIs(chrome::kExtensionScheme)) + if (new_url.SchemeIs(extensions::kExtensionScheme)) return true; return false; @@ -836,8 +837,8 @@ bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( // Also, we must switch if one is an extension and the other is not the exact // same extension. - if (current_url.SchemeIs(chrome::kExtensionScheme) || - new_url.SchemeIs(chrome::kExtensionScheme)) { + if (current_url.SchemeIs(extensions::kExtensionScheme) || + new_url.SchemeIs(extensions::kExtensionScheme)) { if (current_url.GetOrigin() != new_url.GetOrigin()) return true; } @@ -1188,7 +1189,7 @@ net::URLRequestContext* ChromeContentBrowserClient::OverrideRequestContextForURL( const GURL& url, content::ResourceContext* context) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (url.SchemeIs(chrome::kExtensionScheme)) { + if (url.SchemeIs(extensions::kExtensionScheme)) { ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); return io_data->extensions_request_context(); } @@ -1637,7 +1638,7 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs( // the correct scheme. Without this check, chrome-guest:// schemes used by // webview tags as well as hosts that happen to match the id of an // installed extension would get the wrong preferences. - if (url.SchemeIs(chrome::kExtensionScheme)) { + if (url.SchemeIs(extensions::kExtensionScheme)) { extension_webkit_preferences::SetPreferences( extension, view_type, web_prefs); } @@ -1765,8 +1766,10 @@ bool ChromeContentBrowserClient::AllowPepperSocketAPI( return false; std::string host = url.host(); - if (url.SchemeIs(kExtensionScheme) && allowed_socket_origins_.count(host)) + if (url.SchemeIs(extensions::kExtensionScheme) && + allowed_socket_origins_.count(host)) { return true; + } Profile* profile = Profile::FromBrowserContext(browser_context); const Extension* extension = NULL; diff --git a/chrome/browser/chromeos/enrollment_dialog_view.cc b/chrome/browser/chromeos/enrollment_dialog_view.cc index da43095..321a7d7 100644 --- a/chrome/browser/chromeos/enrollment_dialog_view.cc +++ b/chrome/browser/chromeos/enrollment_dialog_view.cc @@ -12,8 +12,8 @@ #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/host_desktop.h" -#include "chrome/common/url_constants.h" #include "content/public/common/page_transition_types.h" +#include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -230,7 +230,7 @@ void DialogEnrollmentDelegate::Enroll(const std::vector<std::string>& uri_list, for (std::vector<std::string>::const_iterator iter = uri_list.begin(); iter != uri_list.end(); ++iter) { GURL uri(*iter); - if (uri.IsStandard() || uri.scheme() == chrome::kExtensionScheme) { + if (uri.IsStandard() || uri.scheme() == extensions::kExtensionScheme) { // If this is a "standard" scheme, like http, ftp, etc., then open that in // the enrollment dialog. EnrollmentDialogView::ShowDialog(owning_window_, diff --git a/chrome/browser/chromeos/web_socket_proxy.cc b/chrome/browser/chromeos/web_socket_proxy.cc index 425f25f..f1ef630 100644 --- a/chrome/browser/chromeos/web_socket_proxy.cc +++ b/chrome/browser/chromeos/web_socket_proxy.cc @@ -41,12 +41,12 @@ #include "chrome/browser/chromeos/web_socket_proxy_helper.h" #include "chrome/browser/internal_auth.h" #include "chrome/common/chrome_notification_types.h" -#include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/common/url_constants.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "googleurl/src/url_parse.h" #include "net/base/address_list.h" @@ -155,7 +155,7 @@ std::string FetchAsciiSnippet(uint8* begin, uint8* end, AsciiFilter filter) { std::string FetchExtensionIdFromOrigin(const std::string &origin) { GURL url(origin); - if (url.SchemeIs(chrome::kExtensionScheme)) + if (url.SchemeIs(extensions::kExtensionScheme)) return url.host(); else return std::string(); diff --git a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc index 5457254..d6d7f78 100644 --- a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc +++ b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc @@ -12,10 +12,10 @@ #include "chrome/common/content_settings_pattern.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_set.h" -#include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" +#include "extensions/common/constants.h" using extensions::UnloadedExtensionInfo; @@ -104,7 +104,7 @@ void InternalExtensionProvider::SetContentSettingForExtension( ContentSetting setting) { scoped_ptr<ContentSettingsPattern::BuilderInterface> pattern_builder( ContentSettingsPattern::CreateBuilder(false)); - pattern_builder->WithScheme(chrome::kExtensionScheme); + pattern_builder->WithScheme(extensions::kExtensionScheme); pattern_builder->WithHost(extension->id()); pattern_builder->WithPathWildcard(); diff --git a/chrome/browser/content_settings/cookie_settings.cc b/chrome/browser/content_settings/cookie_settings.cc index aed029e..32804ce 100644 --- a/chrome/browser/content_settings/cookie_settings.cc +++ b/chrome/browser/content_settings/cookie_settings.cc @@ -15,11 +15,11 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings_pattern.h" #include "chrome/common/pref_names.h" -#include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/user_metrics.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" #include "net/base/static_cookie_policy.h" @@ -192,7 +192,7 @@ ContentSetting CookieSettings::GetCookieSetting( if (info.primary_pattern.MatchesAllHosts() && info.secondary_pattern.MatchesAllHosts() && ShouldBlockThirdPartyCookies() && - !first_party_url.SchemeIs(chrome::kExtensionScheme)) { + !first_party_url.SchemeIs(extensions::kExtensionScheme)) { bool not_strict = CommandLine::ForCurrentProcess()->HasSwitch( switches::kOnlyBlockSettingThirdPartyCookies); net::StaticCookiePolicy policy(not_strict ? diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc index 1f61916..c501659 100644 --- a/chrome/browser/content_settings/host_content_settings_map.cc +++ b/chrome/browser/content_settings/host_content_settings_map.cc @@ -11,11 +11,11 @@ #include "base/stl_util.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/content_settings/content_settings_custom_extension_provider.h" #include "chrome/browser/content_settings/content_settings_default_provider.h" #include "chrome/browser/content_settings/content_settings_details.h" -#include "chrome/browser/content_settings/content_settings_custom_extension_provider.h" -#include "chrome/browser/content_settings/content_settings_observable_provider.h" #include "chrome/browser/content_settings/content_settings_internal_extension_provider.h" +#include "chrome/browser/content_settings/content_settings_observable_provider.h" #include "chrome/browser/content_settings/content_settings_policy_provider.h" #include "chrome/browser/content_settings/content_settings_pref_provider.h" #include "chrome/browser/content_settings/content_settings_provider.h" @@ -34,6 +34,7 @@ #include "content/public/browser/notification_source.h" #include "content/public/browser/user_metrics.h" #include "content/public/common/content_switches.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" #include "net/base/static_cookie_policy.h" @@ -507,10 +508,10 @@ bool HostContentSettingsMap::ShouldAllowAllContent( primary_url.SchemeIsSecure()) { return true; } - if (primary_url.SchemeIs(chrome::kExtensionScheme)) { + if (primary_url.SchemeIs(extensions::kExtensionScheme)) { return content_type != CONTENT_SETTINGS_TYPE_PLUGINS && (content_type != CONTENT_SETTINGS_TYPE_COOKIES || - secondary_url.SchemeIs(chrome::kExtensionScheme)); + secondary_url.SchemeIs(extensions::kExtensionScheme)); } return primary_url.SchemeIs(chrome::kChromeDevToolsScheme) || primary_url.SchemeIs(chrome::kChromeInternalScheme) || diff --git a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc index e27354b..8ee0fbf 100644 --- a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc +++ b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc @@ -7,8 +7,8 @@ #include "base/basictypes.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" -#include "chrome/common/extensions/url_pattern.h" #include "content/public/common/url_constants.h" +#include "extensions/common/url_pattern.h" namespace { diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc index cad2abf..58ec543 100644 --- a/chrome/browser/extensions/api/management/management_api.cc +++ b/chrome/browser/extensions/api/management/management_api.cc @@ -35,11 +35,11 @@ #include "chrome/common/extensions/extension_error_utils.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/permissions/permission_set.h" -#include "chrome/common/extensions/url_pattern.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/utility_process_host.h" #include "content/public/browser/utility_process_host_client.h" +#include "extensions/common/url_pattern.h" #if !defined(OS_ANDROID) #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" diff --git a/chrome/browser/extensions/api/tabs/tabs.cc b/chrome/browser/extensions/api/tabs/tabs.cc index 6cf6d02..49873b4 100644 --- a/chrome/browser/extensions/api/tabs/tabs.cc +++ b/chrome/browser/extensions/api/tabs/tabs.cc @@ -25,9 +25,9 @@ #include "chrome/browser/extensions/extension_function_util.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/tab_helper.h" #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/extensions/script_executor.h" +#include "chrome/browser/extensions/tab_helper.h" #include "chrome/browser/extensions/window_controller.h" #include "chrome/browser/extensions/window_controller_list.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" @@ -67,6 +67,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" #include "content/public/common/url_constants.h" +#include "extensions/common/constants.h" #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -1056,7 +1057,7 @@ bool CreateTabFunction::RunImpl() { // We can't load extension URLs into incognito windows unless the extension // uses split mode. Special case to fall back to a tabbed window. - if (url.SchemeIs(chrome::kExtensionScheme) && + if (url.SchemeIs(extensions::kExtensionScheme) && !GetExtension()->incognito_split_mode() && browser->profile()->IsOffTheRecord()) { Profile* profile = browser->profile()->GetOriginalProfile(); 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 4548eb5..fbd9ac1 100644 --- a/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc +++ b/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "chrome/common/url_constants.h" +#include "extensions/common/constants.h" namespace extensions { @@ -83,7 +84,7 @@ bool FrameNavigationState::IsValidUrl(const GURL& url) const { // Allow about:blank. if (url.spec() == chrome::kAboutBlankURL) return true; - if (allow_extension_scheme_ && url.scheme() == chrome::kExtensionScheme) + if (allow_extension_scheme_ && url.scheme() == extensions::kExtensionScheme) return true; return false; } diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index ac11405..54893d5 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -39,12 +39,12 @@ #include "chrome/common/extensions/extension_error_utils.h" #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/extensions/features/feature.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/url_constants.h" #include "content/public/browser/browser_message_filter.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/resource_request_info.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "net/base/auth.h" 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 bd295c3..9baaef4 100644 --- a/chrome/browser/extensions/api/web_request/web_request_permissions.cc +++ b/chrome/browser/extensions/api/web_request/web_request_permissions.cc @@ -11,6 +11,7 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/url_constants.h" #include "content/public/browser/resource_request_info.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "net/url_request/url_request.h" @@ -67,7 +68,7 @@ bool HasWebRequestScheme(const GURL& url) { url.SchemeIs(chrome::kFtpScheme) || url.SchemeIs(chrome::kHttpScheme) || url.SchemeIs(chrome::kHttpsScheme) || - url.SchemeIs(chrome::kExtensionScheme)); + url.SchemeIs(extensions::kExtensionScheme)); } } // namespace diff --git a/chrome/browser/extensions/convert_web_app_unittest.cc b/chrome/browser/extensions/convert_web_app_unittest.cc index 22e1f43..f726acc 100644 --- a/chrome/browser/extensions/convert_web_app_unittest.cc +++ b/chrome/browser/extensions/convert_web_app_unittest.cc @@ -20,8 +20,8 @@ #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/permissions/permission_set.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/web_apps.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/codec/png_codec.h" diff --git a/chrome/browser/extensions/data_deleter.cc b/chrome/browser/extensions/data_deleter.cc index 46a6fa2..14bd26e 100644 --- a/chrome/browser/extensions/data_deleter.cc +++ b/chrome/browser/extensions/data_deleter.cc @@ -16,6 +16,7 @@ #include "content/public/browser/dom_storage_context.h" #include "content/public/browser/indexed_db_context.h" #include "content/public/browser/storage_partition.h" +#include "extensions/common/constants.h" #include "net/base/completion_callback.h" #include "net/base/net_errors.h" #include "net/cookies/cookie_monster.h" @@ -92,7 +93,7 @@ void DataDeleter::StartDeleting(Profile* profile, webkit_database::DatabaseUtil::GetOriginIdentifier(storage_origin); scoped_refptr<net::URLRequestContextGetter> request_context; - if (storage_origin.SchemeIs(chrome::kExtensionScheme)) { + if (storage_origin.SchemeIs(extensions::kExtensionScheme)) { // TODO(ajwong): Cookies are not properly isolated for // chrome-extension:// scheme. (http://crbug.com/158386). // @@ -137,5 +138,4 @@ void DataDeleter::StartDeleting(Profile* profile, profile->GetExtensionService()->settings_frontend()-> DeleteStorageSoon(extension_id); } - } // namespace extensions diff --git a/chrome/browser/extensions/extension_info_map.cc b/chrome/browser/extensions/extension_info_map.cc index c9b072d..d3b3d42 100644 --- a/chrome/browser/extensions/extension_info_map.cc +++ b/chrome/browser/extensions/extension_info_map.cc @@ -8,6 +8,7 @@ #include "chrome/common/extensions/extension_set.h" #include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" +#include "extensions/common/constants.h" using content::BrowserThread; using extensions::Extension; @@ -125,7 +126,7 @@ void ExtensionInfoMap::UnregisterAllExtensionsInProcess(int process_id) { bool ExtensionInfoMap::SecurityOriginHasAPIPermission( const GURL& origin, int process_id, extensions::APIPermission::ID permission) const { - if (origin.SchemeIs(chrome::kExtensionScheme)) { + if (origin.SchemeIs(extensions::kExtensionScheme)) { const std::string& id = origin.host(); const Extension* extension = extensions_.GetByID(id); CHECK(extension != NULL); diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc index a9dfa32..dff6daa 100644 --- a/chrome/browser/extensions/extension_install_prompt.cc +++ b/chrome/browser/extensions/extension_install_prompt.cc @@ -30,9 +30,9 @@ #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/feature_switch.h" #include "chrome/common/extensions/permissions/permission_set.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/pref_names.h" #include "content/public/browser/web_contents.h" +#include "extensions/common/url_pattern.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" diff --git a/chrome/browser/extensions/extension_install_prompt.h b/chrome/browser/extensions/extension_install_prompt.h index 4cf1cb2..2d3914a 100644 --- a/chrome/browser/extensions/extension_install_prompt.h +++ b/chrome/browser/extensions/extension_install_prompt.h @@ -14,7 +14,7 @@ #include "base/string16.h" #include "chrome/browser/extensions/crx_installer_error.h" #include "chrome/browser/extensions/image_loading_tracker.h" -#include "chrome/common/extensions/url_pattern.h" +#include "extensions/common/url_pattern.h" #include "google_apis/gaia/oauth2_mint_token_flow.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/image/image.h" diff --git a/chrome/browser/extensions/extension_override_apitest.cc b/chrome/browser/extensions/extension_override_apitest.cc index bae1041..20de106 100644 --- a/chrome/browser/extensions/extension_override_apitest.cc +++ b/chrome/browser/extensions/extension_override_apitest.cc @@ -14,6 +14,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" +#include "extensions/common/constants.h" using content::WebContents; @@ -55,7 +56,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, OverrideNewtab) { WebContents* tab = chrome::GetActiveWebContents(browser()); ASSERT_TRUE(tab->GetController().GetActiveEntry()); EXPECT_TRUE(tab->GetController().GetActiveEntry()->GetURL(). - SchemeIs(chrome::kExtensionScheme)); + SchemeIs(extensions::kExtensionScheme)); ASSERT_TRUE(catcher.GetNextResult()); } @@ -80,7 +81,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, MAYBE_OverrideNewtabIncognito) { WebContents* tab = chrome::GetActiveWebContents(otr_browser); ASSERT_TRUE(tab->GetController().GetActiveEntry()); EXPECT_FALSE(tab->GetController().GetActiveEntry()->GetURL(). - SchemeIs(chrome::kExtensionScheme)); + SchemeIs(extensions::kExtensionScheme)); } // Times out consistently on Win, http://crbug.com/45173. diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 6bb95c8..b083b00 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -23,10 +23,10 @@ #include "chrome/common/extensions/manifest.h" #include "chrome/common/extensions/permissions/permission_set.h" #include "chrome/common/extensions/permissions/permissions_info.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/public/browser/notification_service.h" +#include "extensions/common/url_pattern.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc index c9ed325..f33300d 100644 --- a/chrome/browser/extensions/extension_protocols.cc +++ b/chrome/browser/extensions/extension_protocols.cc @@ -26,6 +26,7 @@ #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/url_constants.h" #include "content/public/browser/resource_request_info.h" +#include "extensions/common/constants.h" #include "googleurl/src/url_util.h" #include "grit/component_extension_resources_map.h" #include "net/base/mime_util.h" @@ -284,7 +285,7 @@ bool AllowExtensionResourceLoad(net::URLRequest* request, // Returns true if the given URL references an icon in the given extension. bool URLIsForExtensionIcon(const GURL& url, const Extension* extension) { - DCHECK(url.SchemeIs(chrome::kExtensionScheme)); + DCHECK(url.SchemeIs(extensions::kExtensionScheme)); if (!extension) return false; diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc index c0e7837..6195192 100644 --- a/chrome/browser/extensions/extension_protocols_unittest.cc +++ b/chrome/browser/extensions/extension_protocols_unittest.cc @@ -12,6 +12,7 @@ #include "content/public/browser/resource_request_info.h" #include "content/public/test/mock_resource_context.h" #include "content/public/test/test_browser_thread.h" +#include "extensions/common/constants.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_status.h" @@ -55,7 +56,7 @@ class ExtensionProtocolTest : public testing::Test { old_factory_ = request_context->job_factory(); // Register an incognito extension protocol handler. job_factory_.SetProtocolHandler( - chrome::kExtensionScheme, + extensions::kExtensionScheme, CreateExtensionProtocolHandler(true, extension_info_map_)); request_context->set_job_factory(&job_factory_); } diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 796b65f..8b53f4a 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -65,7 +65,6 @@ #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/permissions/permission_set.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" @@ -79,6 +78,7 @@ #include "content/public/common/content_constants.h" #include "content/public/common/gpu_info.h" #include "content/public/test/test_browser_thread.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" #include "grit/browser_resources.h" #include "net/cookies/canonical_cookie.h" diff --git a/chrome/browser/extensions/extension_special_storage_policy.cc b/chrome/browser/extensions/extension_special_storage_policy.cc index f5fb427..8f035ea 100644 --- a/chrome/browser/extensions/extension_special_storage_policy.cc +++ b/chrome/browser/extensions/extension_special_storage_policy.cc @@ -15,6 +15,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" +#include "extensions/common/constants.h" #include "webkit/glue/web_intent_service_data.h" using content::BrowserThread; @@ -44,7 +45,7 @@ ExtensionSpecialStoragePolicy::ExtensionSpecialStoragePolicy( ExtensionSpecialStoragePolicy::~ExtensionSpecialStoragePolicy() {} bool ExtensionSpecialStoragePolicy::IsStorageProtected(const GURL& origin) { - if (origin.SchemeIs(chrome::kExtensionScheme)) + if (origin.SchemeIs(extensions::kExtensionScheme)) return true; base::AutoLock locker(lock_); return protected_apps_.Contains(origin); diff --git a/chrome/browser/extensions/extension_url_rewrite_browsertest.cc b/chrome/browser/extensions/extension_url_rewrite_browsertest.cc index cfbabd8..166c4071 100644 --- a/chrome/browser/extensions/extension_url_rewrite_browsertest.cc +++ b/chrome/browser/extensions/extension_url_rewrite_browsertest.cc @@ -18,6 +18,7 @@ #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" using content::NavigationEntry; @@ -54,7 +55,7 @@ class ExtensionURLRewriteBrowserTest : public ExtensionBrowserTest { EXPECT_EQ(url, GetLocationBarTextAsURL()); EXPECT_EQ(url, GetNavigationEntry()->GetVirtualURL()); EXPECT_TRUE( - GetNavigationEntry()->GetURL().SchemeIs(chrome::kExtensionScheme)); + GetNavigationEntry()->GetURL().SchemeIs(extensions::kExtensionScheme)); } // Navigates to |url| and tests that the location bar is empty while the @@ -80,7 +81,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, NewTabPageURLOverride) { LoadExtension(GetTestExtensionPath("newtab")); TestURLNotShown(GURL(chrome::kChromeUINewTabURL)); // Check that the internal URL uses the chrome-extension:// scheme. - EXPECT_TRUE(GetNavigationEntry()->GetURL().SchemeIs(chrome::kExtensionScheme)); + EXPECT_TRUE(GetNavigationEntry()->GetURL().SchemeIs( + extensions::kExtensionScheme)); } IN_PROC_BROWSER_TEST_F(ExtensionURLRewriteBrowserTest, BookmarksURL) { diff --git a/chrome/browser/extensions/subscribe_page_action_browsertest.cc b/chrome/browser/extensions/subscribe_page_action_browsertest.cc index b0f2022..396a322 100644 --- a/chrome/browser/extensions/subscribe_page_action_browsertest.cc +++ b/chrome/browser/extensions/subscribe_page_action_browsertest.cc @@ -10,6 +10,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" +#include "extensions/common/constants.h" using content::WebContents; using extensions::Extension; @@ -64,7 +65,7 @@ GURL GetFeedUrl(net::TestServer* server, const std::string& feed_page, if (direct_url) { // We navigate directly to the subscribe page for feeds where the feed // sniffing won't work, in other words, as is the case for malformed feeds. - return GURL(std::string(chrome::kExtensionScheme) + + return GURL(std::string(extensions::kExtensionScheme) + content::kStandardSchemeSeparator + extension_id + std::string(kSubscribePage) + std::string("?") + feed_url.spec() + std::string("&synchronous")); diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc index dc0ada9..1cb33d8 100644 --- a/chrome/browser/extensions/user_script_listener.cc +++ b/chrome/browser/extensions/user_script_listener.cc @@ -9,11 +9,11 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/url_pattern.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/resource_controller.h" #include "content/public/browser/resource_throttle.h" +#include "extensions/common/url_pattern.h" #include "net/url_request/url_request.h" using content::BrowserThread; diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc index 5bc7efd..bb3e38b 100644 --- a/chrome/browser/extensions/webstore_standalone_installer.cc +++ b/chrome/browser/extensions/webstore_standalone_installer.cc @@ -17,12 +17,12 @@ #include "chrome/common/chrome_utility_messages.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/url_constants.h" #include "content/public/browser/utility_process_host.h" #include "content/public/browser/utility_process_host_client.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" +#include "extensions/common/url_pattern.h" #include "net/base/escape.h" #include "net/base/load_flags.h" #include "net/url_request/url_fetcher.h" diff --git a/chrome/browser/favicon/favicon_service.cc b/chrome/browser/favicon/favicon_service.cc index 6107688..789d491 100644 --- a/chrome/browser/favicon/favicon_service.cc +++ b/chrome/browser/favicon/favicon_service.cc @@ -11,6 +11,7 @@ #include "chrome/browser/history/select_favicon_frames.h" #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" #include "chrome/common/url_constants.h" +#include "extensions/common/constants.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/favicon_size.h" @@ -255,7 +256,7 @@ FaviconService::Handle FaviconService::GetFaviconForURLImpl( AddRequest(request, params.consumer); FaviconService::Handle handle = request->handle(); if (params.page_url.SchemeIs(chrome::kChromeUIScheme) || - params.page_url.SchemeIs(chrome::kExtensionScheme)) { + params.page_url.SchemeIs(extensions::kExtensionScheme)) { ChromeWebUIControllerFactory::GetInstance()->GetFaviconForURL( params.profile, request, params.page_url, desired_scale_factors); } else { diff --git a/chrome/browser/intents/default_web_intent_service.h b/chrome/browser/intents/default_web_intent_service.h index c328533..191d5c2 100644 --- a/chrome/browser/intents/default_web_intent_service.h +++ b/chrome/browser/intents/default_web_intent_service.h @@ -8,7 +8,7 @@ #include <string> #include "base/string16.h" -#include "chrome/common/extensions/url_pattern.h" +#include "extensions/common/url_pattern.h" // Holds data related to a default settings for web intents service // selection. Holds data in a row in the web_intents_defaults table. diff --git a/chrome/browser/intents/default_web_intent_service_unittest.cc b/chrome/browser/intents/default_web_intent_service_unittest.cc index 8afed07..9478e96 100644 --- a/chrome/browser/intents/default_web_intent_service_unittest.cc +++ b/chrome/browser/intents/default_web_intent_service_unittest.cc @@ -6,7 +6,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/intents/default_web_intent_service.h" -#include "chrome/common/extensions/url_pattern.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/intents/native_services_unittest.cc b/chrome/browser/intents/native_services_unittest.cc index db1d081..133868d 100644 --- a/chrome/browser/intents/native_services_unittest.cc +++ b/chrome/browser/intents/native_services_unittest.cc @@ -10,7 +10,7 @@ #include "chrome/browser/intents/native_services.h" #include "chrome/browser/intents/web_intents_util.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/url_pattern.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/web_intent_service_data.h" diff --git a/chrome/browser/nacl_host/nacl_browser.cc b/chrome/browser/nacl_host/nacl_browser.cc index 43f7901..a91c385 100644 --- a/chrome/browser/nacl_host/nacl_browser.cc +++ b/chrome/browser/nacl_host/nacl_browser.cc @@ -15,8 +15,8 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/url_pattern.h" #include "content/public/browser/browser_thread.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" namespace { diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index 154ac46..c854c1a 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -28,7 +28,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/nacl_cmd_line.h" #include "chrome/common/nacl_messages.h" @@ -38,6 +37,8 @@ #include "content/public/browser/browser_ppapi_host.h" #include "content/public/browser/child_process_data.h" #include "content/public/common/child_process_host.h" +#include "extensions/common/constants.h" +#include "extensions/common/url_pattern.h" #include "ipc/ipc_channel.h" #include "ipc/ipc_switches.h" #include "native_client/src/shared/imc/nacl_imc.h" @@ -52,8 +53,8 @@ #elif defined(OS_WIN) #include <windows.h> -#include "base/threading/thread.h" #include "base/process_util.h" +#include "base/threading/thread.h" #include "base/win/scoped_handle.h" #include "chrome/browser/nacl_host/nacl_broker_service_win.h" #include "chrome/common/nacl_debug_exception_handler_win.h" @@ -469,7 +470,8 @@ void NaClProcessHost::OnNaClGdbAttached() { FilePath NaClProcessHost::GetManifestPath() { const extensions::Extension* extension = extension_info_map_->extensions() .GetExtensionOrAppByURL(ExtensionURLInfo(manifest_url_)); - if (extension != NULL && manifest_url_.SchemeIs(chrome::kExtensionScheme)) { + if (extension != NULL && + manifest_url_.SchemeIs(extensions::kExtensionScheme)) { std::string path = manifest_url_.path(); TrimString(path, "/", &path); // Remove first slash return extension->path().AppendASCII(path); diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc index a79c012..2e5ab1d 100644 --- a/chrome/browser/net/chrome_network_delegate.cc +++ b/chrome/browser/net/chrome_network_delegate.cc @@ -33,6 +33,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/resource_request_info.h" +#include "extensions/common/constants.h" #include "net/base/host_port_pair.h" #include "net/base/net_errors.h" #include "net/base/net_log.h" @@ -633,7 +634,7 @@ bool ChromeNetworkDelegate::OnCanThrottleRequest( } return request.first_party_for_cookies().scheme() == - chrome::kExtensionScheme; + extensions::kExtensionScheme; } int ChromeNetworkDelegate::OnBeforeSocketStreamConnect( diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index 54e6299..2568fb5 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -34,6 +34,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/show_desktop_notification_params.h" +#include "extensions/common/constants.h" #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -465,7 +466,7 @@ bool DesktopNotificationService::ShowDesktopNotification( string16 DesktopNotificationService::DisplayNameForOrigin( const GURL& origin) { // If the source is an extension, lookup the display name. - if (origin.SchemeIs(chrome::kExtensionScheme)) { + if (origin.SchemeIs(extensions::kExtensionScheme)) { ExtensionService* extension_service = profile_->GetExtensionService(); if (extension_service) { const extensions::Extension* extension = diff --git a/chrome/browser/notifications/notification_options_menu_model.cc b/chrome/browser/notifications/notification_options_menu_model.cc index 0cbaea6..691d112 100644 --- a/chrome/browser/notifications/notification_options_menu_model.cc +++ b/chrome/browser/notifications/notification_options_menu_model.cc @@ -26,6 +26,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" #include "content/public/browser/web_contents_delegate.h" +#include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -122,7 +123,7 @@ NotificationOptionsMenuModel::NotificationOptionsMenuModel(Balloon* balloon) const Notification& notification = balloon->notification(); const GURL& origin = notification.origin_url(); - if (origin.SchemeIs(chrome::kExtensionScheme)) { + if (origin.SchemeIs(extensions::kExtensionScheme)) { ExtensionService* extension_service = balloon_->profile()->GetExtensionService(); const extensions::Extension* extension = @@ -174,7 +175,7 @@ string16 NotificationOptionsMenuModel::GetLabelForCommandId(int command_id) DesktopNotificationService* service = DesktopNotificationServiceFactory::GetForProfile(balloon_->profile()); - if (origin.SchemeIs(chrome::kExtensionScheme)) { + if (origin.SchemeIs(extensions::kExtensionScheme)) { ExtensionService* extension_service = balloon_->profile()->GetExtensionService(); const extensions::Extension* extension = diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc index 3be7f61..fccc6a1 100644 --- a/chrome/browser/profiles/off_the_record_profile_io_data.cc +++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc @@ -26,6 +26,7 @@ #include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/resource_context.h" +#include "extensions/common/constants.h" #include "net/base/default_server_bound_cert_store.h" #include "net/base/server_bound_cert_service.h" #include "net/ftp/ftp_network_layer.h" @@ -207,7 +208,7 @@ void OffTheRecordProfileIOData::LazyInitializeInternal( new net::CookieMonster(NULL, NULL); // Enable cookies for devtools and extension URLs. const char* schemes[] = {chrome::kChromeDevToolsScheme, - chrome::kExtensionScheme}; + extensions::kExtensionScheme}; extensions_cookie_store->SetCookieableSchemes(schemes, 2); extensions_context->set_cookie_store(extensions_cookie_store); diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc index 35377cb..a7c82e9 100644 --- a/chrome/browser/profiles/profile_impl_io_data.cc +++ b/chrome/browser/profiles/profile_impl_io_data.cc @@ -33,6 +33,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/resource_context.h" #include "content/public/browser/storage_partition.h" +#include "extensions/common/constants.h" #include "net/base/server_bound_cert_service.h" #include "net/ftp/ftp_network_layer.h" #include "net/http/http_cache.h" @@ -380,7 +381,7 @@ void ProfileImplIOData::LazyInitializeInternal( lazy_params_->restore_old_session_cookies, NULL), NULL); // Enable cookies for devtools and extension URLs. const char* schemes[] = {chrome::kChromeDevToolsScheme, - chrome::kExtensionScheme}; + extensions::kExtensionScheme}; extensions_cookie_store->SetCookieableSchemes(schemes, 2); main_context->set_cookie_store(cookie_store); diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 112a0b6..50c6f0b 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -17,7 +17,6 @@ #include "base/string_util.h" #include "base/stringprintf.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/net/about_protocol_handler.h" #include "chrome/browser/content_settings/cookie_settings.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h" @@ -29,6 +28,7 @@ #include "chrome/browser/extensions/extension_resource_protocols.h" #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/io_thread.h" +#include "chrome/browser/net/about_protocol_handler.h" #include "chrome/browser/net/chrome_cookie_notification_details.h" #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" #include "chrome/browser/net/chrome_http_user_agent_settings.h" @@ -56,6 +56,7 @@ #include "content/public/browser/host_zoom_map.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/resource_context.h" +#include "extensions/common/constants.h" #include "net/base/server_bound_cert_service.h" #include "net/cookies/canonical_cookie.h" #include "net/cookies/cookie_monster.h" @@ -337,7 +338,7 @@ ProfileIOData* ProfileIOData::FromResourceContext( bool ProfileIOData::IsHandledProtocol(const std::string& scheme) { DCHECK_EQ(scheme, StringToLowerASCII(scheme)); static const char* const kProtocolList[] = { - chrome::kExtensionScheme, + extensions::kExtensionScheme, chrome::kChromeUIScheme, chrome::kChromeDevToolsScheme, #if defined(OS_CHROMEOS) @@ -638,7 +639,7 @@ void ProfileIOData::SetUpJobFactoryDefaults( } set_protocol = job_factory->SetProtocolHandler( - chrome::kExtensionScheme, + extensions::kExtensionScheme, CreateExtensionProtocolHandler(is_incognito(), GetExtensionInfoMap())); DCHECK(set_protocol); set_protocol = job_factory->SetProtocolHandler( diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc index c0feefc..5abb868 100644 --- a/chrome/browser/renderer_host/chrome_render_message_filter.cc +++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc @@ -37,9 +37,10 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/resource_dispatcher_host.h" #include "content/public/common/process_type.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" #include "webkit/plugins/npapi/plugin_list.h" #if defined(USE_TCMALLOC) @@ -589,7 +590,7 @@ void ChromeRenderMessageFilter::OnCanTriggerClipboardWrite( const GURL& origin, bool* allowed) { // Since all extensions could historically write to the clipboard, preserve it // for compatibility. - *allowed = (origin.SchemeIs(chrome::kExtensionScheme) || + *allowed = (origin.SchemeIs(extensions::kExtensionScheme) || extension_info_map_->SecurityOriginHasAPIPermission( origin, render_process_id_, APIPermission::kClipboardWrite)); } diff --git a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc index df215304..2064921 100644 --- a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc +++ b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc @@ -19,6 +19,7 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/site_instance.h" +#include "extensions/common/constants.h" using content::ChildProcessSecurityPolicy; using content::RenderViewHost; @@ -136,7 +137,7 @@ const Extension* ChromeRenderViewHostObserver::GetExtension() { SiteInstance* site_instance = render_view_host()->GetSiteInstance(); const GURL& site = site_instance->GetSiteURL(); - if (!site.SchemeIs(chrome::kExtensionScheme)) + if (!site.SchemeIs(extensions::kExtensionScheme)) return NULL; ExtensionService* service = profile_->GetExtensionService(); diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc index f7a69c6..f53a731 100644 --- a/chrome/browser/search_engines/template_url.cc +++ b/chrome/browser/search_engines/template_url.cc @@ -18,6 +18,7 @@ #include "chrome/browser/search_engines/search_terms_data.h" #include "chrome/browser/search_engines/template_url_service.h" #include "chrome/common/url_constants.h" +#include "extensions/common/constants.h" #include "google_apis/google_api_keys.h" #include "net/base/escape.h" #include "ui/base/l10n/l10n_util.h" @@ -765,7 +766,7 @@ std::string TemplateURL::GetExtensionId() const { } bool TemplateURL::IsExtensionKeyword() const { - return GURL(data_.url()).SchemeIs(chrome::kExtensionScheme); + return GURL(data_.url()).SchemeIs(extensions::kExtensionScheme); } size_t TemplateURL::URLCount() const { diff --git a/chrome/browser/search_engines/template_url_service.cc b/chrome/browser/search_engines/template_url_service.cc index e4c250e..cc7c1ae 100644 --- a/chrome/browser/search_engines/template_url_service.cc +++ b/chrome/browser/search_engines/template_url_service.cc @@ -45,6 +45,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/public/browser/notification_service.h" +#include "extensions/common/constants.h" #include "net/base/net_util.h" #include "sync/api/sync_change.h" #include "sync/api/sync_error_factory.h" @@ -552,7 +553,7 @@ void TemplateURLService::RegisterExtensionKeyword( data.SetKeyword(UTF8ToUTF16(extension->omnibox_keyword())); // This URL is not actually used for navigation. It holds the extension's // ID, as well as forcing the TemplateURL to be treated as a search keyword. - data.SetURL(std::string(chrome::kExtensionScheme) + "://" + + data.SetURL(std::string(extensions::kExtensionScheme) + "://" + extension->id() + "/?q={searchTerms}"); Add(new TemplateURL(profile_, data)); } diff --git a/chrome/browser/search_engines/template_url_service_sync_unittest.cc b/chrome/browser/search_engines/template_url_service_sync_unittest.cc index 4d5fa59..5ba4974 100644 --- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc +++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc @@ -19,6 +19,7 @@ #include "chrome/test/base/testing_pref_service.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/notification_service.h" +#include "extensions/common/constants.h" #include "net/base/net_util.h" #include "sync/api/sync_error_factory.h" #include "sync/api/sync_error_factory_mock.h" @@ -399,7 +400,7 @@ TEST_F(TemplateURLServiceSyncTest, GetAllSyncDataNoExtensions) { model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key1"), "http://key1.com")); model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key2"), "http://key2.com")); model()->Add(CreateTestTemplateURL(ASCIIToUTF16("key3"), - std::string(chrome::kExtensionScheme) + "://blahblahblah")); + std::string(extensions::kExtensionScheme) + "://blahblahblah")); syncer::SyncDataList all_sync_data = model()->GetAllSyncData(syncer::SEARCH_ENGINES); @@ -1008,10 +1009,10 @@ TEST_F(TemplateURLServiceSyncTest, ProcessChangesWithLocalExtensions) { // Add some extension keywords locally. These shouldn't be synced. TemplateURL* extension1 = CreateTestTemplateURL(ASCIIToUTF16("keyword1"), - std::string(chrome::kExtensionScheme) + "://extension1"); + std::string(extensions::kExtensionScheme) + "://extension1"); model()->Add(extension1); TemplateURL* extension2 = CreateTestTemplateURL(ASCIIToUTF16("keyword2"), - std::string(chrome::kExtensionScheme) + "://extension2"); + std::string(extensions::kExtensionScheme) + "://extension2"); model()->Add(extension2); EXPECT_EQ(0U, processor()->change_list_size()); diff --git a/chrome/browser/search_engines/template_url_service_unittest.cc b/chrome/browser/search_engines/template_url_service_unittest.cc index 0ef9736..b67fc3e 100644 --- a/chrome/browser/search_engines/template_url_service_unittest.cc +++ b/chrome/browser/search_engines/template_url_service_unittest.cc @@ -27,6 +27,7 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread.h" +#include "extensions/common/constants.h" #include "testing/gtest/include/gtest/gtest.h" using base::Time; @@ -501,7 +502,7 @@ TEST_F(TemplateURLServiceTest, AddExtensionKeyword) { "http://test2", std::string(), std::string(), false, "UTF-8", Time(), Time()); TemplateURL* original3 = AddKeywordWithDate("extension", "keyword3", - std::string(chrome::kExtensionScheme) + "://test3", std::string(), + std::string(extensions::kExtensionScheme) + "://test3", std::string(), std::string(), false, "UTF-8", Time(), Time()); // Add an extension keyword that conflicts with each of the above three @@ -509,7 +510,7 @@ TEST_F(TemplateURLServiceTest, AddExtensionKeyword) { TemplateURLData data; data.short_name = ASCIIToUTF16("test"); data.SetKeyword(ASCIIToUTF16("keyword1")); - data.SetURL(std::string(chrome::kExtensionScheme) + "://test4"); + data.SetURL(std::string(extensions::kExtensionScheme) + "://test4"); data.safe_for_autoreplace = false; // Extension keywords should override replaceable keywords. @@ -551,7 +552,7 @@ TEST_F(TemplateURLServiceTest, AddSameKeywordWithExtensionPresent) { AddKeywordWithDate("replaceable", "keyword", "http://test1", std::string(), std::string(), true, "UTF-8", Time(), Time()); TemplateURL* extension = AddKeywordWithDate("extension", "keyword", - std::string(chrome::kExtensionScheme) + "://test2", std::string(), + std::string(extensions::kExtensionScheme) + "://test2", std::string(), std::string(), false, "UTF-8", Time(), Time()); // Adding another replaceable keyword should remove the existing one, but diff --git a/chrome/browser/tab_contents/render_view_context_menu_unittest.cc b/chrome/browser/tab_contents/render_view_context_menu_unittest.cc index 565c8d5..7cf03e4 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_unittest.cc +++ b/chrome/browser/tab_contents/render_view_context_menu_unittest.cc @@ -5,7 +5,7 @@ #include "chrome/browser/tab_contents/render_view_context_menu.h" #include "chrome/browser/extensions/extension_prefs.h" -#include "chrome/common/extensions/url_pattern.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index e01bc99..3449325 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -58,6 +58,7 @@ #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" #include "content/public/common/process_type.h" +#include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "third_party/sqlite/sqlite3.h" @@ -311,7 +312,7 @@ bool TaskManagerTabContentsResource::IsPrerendering() const { bool TaskManagerTabContentsResource::HostsExtension() const { return tab_contents_->web_contents()->GetURL().SchemeIs( - chrome::kExtensionScheme); + extensions::kExtensionScheme); } TaskManager::Resource::Type TaskManagerTabContentsResource::GetType() const { diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc index 909c95b..7491329 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc @@ -20,9 +20,9 @@ #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/ash/app_sync_ui_state.h" #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" #include "chrome/browser/ui/ash/extension_utils.h" -#include "chrome/browser/ui/ash/app_sync_ui_state.h" #include "chrome/browser/ui/ash/launcher/launcher_app_icon_loader.h" #include "chrome/browser/ui/ash/launcher/launcher_app_tab_helper.h" #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" @@ -40,12 +40,12 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_resource.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" +#include "extensions/common/url_pattern.h" #include "grit/theme_resources.h" #include "ui/aura/window.h" diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index fcbb3b7..f3faf30 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -174,6 +174,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/page_zoom.h" #include "content/public/common/renderer_preferences.h" +#include "extensions/common/constants.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -1880,7 +1881,7 @@ void Browser::Observe(int type, details)->extension; for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { WebContents* tc = chrome::GetTabContentsAt(this, i)->web_contents(); - if (tc->GetURL().SchemeIs(chrome::kExtensionScheme) && + if (tc->GetURL().SchemeIs(extensions::kExtensionScheme) && tc->GetURL().host() == extension->id()) chrome::CloseWebContents(this, tc); } diff --git a/chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.cc b/chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.cc index 044ba23..c1a2a6e 100644 --- a/chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.cc +++ b/chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.cc @@ -9,6 +9,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_set.h" #include "chrome/common/url_constants.h" +#include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -25,7 +26,7 @@ string16 GetLabelTextForType(FullscreenExitBubbleType type, extensions->GetExtensionOrAppByURL(ExtensionURLInfo(url)); if (extension) { host = UTF8ToUTF16(extension->name()); - } else if (url.SchemeIs(chrome::kExtensionScheme)) { + } else if (url.SchemeIs(extensions::kExtensionScheme)) { // In this case, |host| is set to an extension ID. // We are not going to show it because it's human-unreadable. host.clear(); diff --git a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc index 55330d6..3cc8a37 100644 --- a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc +++ b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc @@ -37,6 +37,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_intents_dispatcher.h" #include "content/public/test/test_utils.h" +#include "extensions/common/constants.h" #include "net/base/escape.h" #include "net/base/mock_host_resolver.h" #include "net/url_request/test_url_fetcher_factory.h" @@ -636,7 +637,7 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest, explicitIntent.action = kAction1; explicitIntent.type = kType2; explicitIntent.service = GURL(StringPrintf("%s://%s/%s", - chrome::kExtensionScheme, + extensions::kExtensionScheme, extension_id, "share.html")); IntentsDispatcherMock dispatcher2(explicitIntent); @@ -680,7 +681,7 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest, intent.action = kAction1; intent.type = kType1; intent.service = GURL(StringPrintf("%s://%s/%s", - chrome::kExtensionScheme, + extensions::kExtensionScheme, kDummyExtensionId, UTF16ToASCII(kAction1).c_str())); IntentsDispatcherMock dispatcher(intent); diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc index cabe939..188611d 100644 --- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc +++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc @@ -56,6 +56,7 @@ #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" +#include "extensions/common/constants.h" #include "googleurl/src/url_util.h" #include "ui/gfx/image/image.h" @@ -1246,7 +1247,7 @@ void OmniboxEditModel::DoPrerender(const AutocompleteMatch& match) { } void OmniboxEditModel::DoPreconnect(const AutocompleteMatch& match) { - if (!match.destination_url.SchemeIs(chrome::kExtensionScheme)) { + if (!match.destination_url.SchemeIs(extensions::kExtensionScheme)) { // Warm up DNS Prefetch cache, or preconnect to a search service. UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type, AutocompleteMatch::NUM_TYPES); diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc index 47f56be..d178276 100644 --- a/chrome/browser/ui/panels/panel_browsertest.cc +++ b/chrome/browser/ui/panels/panel_browsertest.cc @@ -35,6 +35,7 @@ #include "content/public/common/url_constants.h" #include "content/public/test/browser_test_utils.h" #include "content/test/net/url_request_mock_http_job.h" +#include "extensions/common/constants.h" #include "net/base/net_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/screen.h" @@ -1397,7 +1398,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, // Create a panel with the extension as host. CreatePanelParams params(extension_app_name, gfx::Rect(), SHOW_AS_INACTIVE); - std::string extension_domain_url(chrome::kExtensionScheme); + std::string extension_domain_url(extensions::kExtensionScheme); extension_domain_url += "://"; extension_domain_url += extension->id(); extension_domain_url += "/hello.html"; diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc index 30a91da..14df8ef 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc @@ -24,6 +24,7 @@ #include "content/public/browser/web_ui.h" #include "content/public/common/content_constants.h" #include "content/public/common/ssl_status.h" +#include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "net/base/cert_status_flags.h" @@ -105,7 +106,7 @@ bool ToolbarModelImpl::ShouldDisplayURL() const { if (web_contents && web_contents->GetWebUIForCurrentState()) return !web_contents->GetWebUIForCurrentState()->ShouldHideURL(); - if (entry && entry->GetURL().SchemeIs(chrome::kExtensionScheme)) + if (entry && entry->GetURL().SchemeIs(extensions::kExtensionScheme)) return false; #if defined(OS_CHROMEOS) diff --git a/chrome/browser/ui/website_settings/website_settings_utils.cc b/chrome/browser/ui/website_settings/website_settings_utils.cc index f18dab4..a2b7a02 100644 --- a/chrome/browser/ui/website_settings/website_settings_utils.cc +++ b/chrome/browser/ui/website_settings/website_settings_utils.cc @@ -5,11 +5,12 @@ #include "chrome/browser/ui/website_settings/website_settings_utils.h" #include "chrome/common/url_constants.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" // Returns true if the passed |url| refers to an internal chrome page. bool InternalChromePage(const GURL& url) { return url.SchemeIs(chrome::kChromeInternalScheme) || url.SchemeIs(chrome::kChromeUIScheme) || - url.SchemeIs(chrome::kExtensionScheme); + 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 7b3e48d..877de2a 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc @@ -59,6 +59,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "content/public/common/content_client.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "ui/gfx/favicon_size.h" #include "ui/web_dialogs/web_dialog_ui.h" @@ -75,10 +76,10 @@ #endif #if defined(OS_CHROMEOS) -#include "chrome/browser/ui/webui/chromeos/drive_internals_ui.h" #include "chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h" #include "chrome/browser/ui/webui/chromeos/cryptohome_ui.h" #include "chrome/browser/ui/webui/chromeos/diagnostics/diagnostics_ui.h" +#include "chrome/browser/ui/webui/chromeos/drive_internals_ui.h" #include "chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.h" #include "chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" @@ -493,7 +494,7 @@ void ChromeWebUIControllerFactory::GetFaviconForURL( // All extensions but the bookmark manager get their favicon from the icons // part of the manifest. - if (url.SchemeIs(chrome::kExtensionScheme) && + if (url.SchemeIs(extensions::kExtensionScheme) && url.host() != extension_misc::kBookmarkManagerId) { #if defined(ENABLE_EXTENSIONS) ExtensionWebUI::GetFaviconForURL(profile, request, url); @@ -557,7 +558,7 @@ base::RefCountedMemory* ChromeWebUIControllerFactory::GetFaviconResourceBytes( return BookmarksUI::GetFaviconResourceBytes(scale_factor); // The extension scheme is handled in GetFaviconForURL. - if (page_url.SchemeIs(chrome::kExtensionScheme)) { + if (page_url.SchemeIs(extensions::kExtensionScheme)) { NOTREACHED(); return NULL; } diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index 9a2b6ea..10352bc 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -10,8 +10,8 @@ #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/file_util.h" -#include "base/string_util.h" #include "base/string_number_conversions.h" +#include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "base/version.h" @@ -57,6 +57,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" #include "content/public/browser/web_ui.h" +#include "extensions/common/constants.h" #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -183,7 +184,7 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( for (std::vector<ExtensionPage>::const_iterator iter = pages.begin(); iter != pages.end(); ++iter) { DictionaryValue* view_value = new DictionaryValue; - if (iter->url.scheme() == chrome::kExtensionScheme) { + if (iter->url.scheme() == extensions::kExtensionScheme) { // No leading slash. view_value->SetString("path", iter->url.path().substr(1)); } else { diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index 654299e..aa89513 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -11,10 +11,11 @@ #include "base/string_util.h" #include "base/threading/thread.h" #include "base/utf_string_conversions.h" -#include "chrome/common/extensions/extension.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" +#include "extensions/common/constants.h" using content::BrowserThread; @@ -184,7 +185,7 @@ bool IsValidUrl(const GURL& url) { chrome::kFtpScheme, chrome::kHttpScheme, chrome::kHttpsScheme, - chrome::kExtensionScheme, + extensions::kExtensionScheme, }; for (size_t i = 0; i < arraysize(kValidUrlSchemes); ++i) { diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 87c894d..edac7bd 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -51,6 +51,10 @@ '<(DEPTH)/webkit/support/webkit_support.gyp:user_agent', ], 'sources': [ + '../extensions/common/constants.cc', + '../extensions/common/constants.h', + '../extensions/common/url_pattern.cc', + '../extensions/common/url_pattern.h', 'common/all_messages.h', 'common/attrition_experiments.h', 'common/auto_start_linux.cc', @@ -197,8 +201,6 @@ 'common/extensions/unpacker.h', 'common/extensions/update_manifest.cc', 'common/extensions/update_manifest.h', - 'common/extensions/url_pattern.cc', - 'common/extensions/url_pattern.h', 'common/extensions/url_pattern_set.cc', 'common/extensions/url_pattern_set.h', 'common/extensions/user_script.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 945f5ad..63ac083 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -49,6 +49,7 @@ '..', ], 'sources': [ + '../extensions/common/url_pattern_unittest.cc', 'app/breakpad_mac_stubs.mm', 'app/chrome_main_delegate.cc', 'app/chrome_main_delegate.h', @@ -1479,7 +1480,6 @@ 'common/extensions/unpacker_unittest.cc', 'common/extensions/update_manifest_unittest.cc', 'common/extensions/url_pattern_set_unittest.cc', - 'common/extensions/url_pattern_unittest.cc', 'common/extensions/user_script_unittest.cc', 'common/extensions/value_counter_unittest.cc', 'common/extensions/api/extension_api_unittest.cc', diff --git a/chrome/common/DEPS b/chrome/common/DEPS index cefae53..6bb9e40 100644 --- a/chrome/common/DEPS +++ b/chrome/common/DEPS @@ -1,5 +1,6 @@ include_rules = [ "+chrome/plugin", # For checking whether we're a plugin process. + "+extensions/common", "+grit", # For generated headers "+libxml", "+ppapi/c", # For various types. diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index d187f06..b721cd2 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc @@ -25,6 +25,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/pepper_plugin_info.h" #include "content/public/common/url_constants.h" +#include "extensions/common/constants.h" #include "grit/common_resources.h" #include "ppapi/shared_impl/ppapi_permissions.h" #include "remoting/client/plugin/pepper_entrypoints.h" @@ -379,8 +380,8 @@ void ChromeContentClient::AddNPAPIPlugins( void ChromeContentClient::AddAdditionalSchemes( std::vector<std::string>* standard_schemes, std::vector<std::string>* savable_schemes) { - standard_schemes->push_back(kExtensionScheme); - savable_schemes->push_back(kExtensionScheme); + standard_schemes->push_back(extensions::kExtensionScheme); + savable_schemes->push_back(extensions::kExtensionScheme); standard_schemes->push_back(kExtensionResourceScheme); savable_schemes->push_back(kExtensionResourceScheme); #if defined(OS_CHROMEOS) diff --git a/chrome/common/content_settings_pattern.cc b/chrome/common/content_settings_pattern.cc index f5aa898..4420187 100644 --- a/chrome/common/content_settings_pattern.cc +++ b/chrome/common/content_settings_pattern.cc @@ -12,6 +12,7 @@ #include "chrome/common/content_settings_pattern_parser.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "googleurl/src/url_canon.h" #include "ipc/ipc_message_utils.h" @@ -209,7 +210,7 @@ bool ContentSettingsPattern::Builder::Validate(const PatternParts& parts) { } // If the pattern is for an extension URL test if it is valid. - if (parts.scheme == std::string(chrome::kExtensionScheme) && + if (parts.scheme == std::string(extensions::kExtensionScheme) && parts.port.empty() && !parts.is_port_wildcard) { return true; @@ -246,7 +247,7 @@ bool ContentSettingsPattern::Builder::LegacyValidate( return true; // If the pattern is for an extension URL test if it is valid. - if (parts.scheme == std::string(chrome::kExtensionScheme) && + if (parts.scheme == std::string(extensions::kExtensionScheme) && !parts.is_scheme_wildcard && !parts.host.empty() && !parts.has_domain_wildcard && @@ -457,7 +458,7 @@ bool ContentSettingsPattern::Matches( } // For chrome extensions URLs ignore the port. - if (parts_.scheme == std::string(chrome::kExtensionScheme)) + if (parts_.scheme == std::string(extensions::kExtensionScheme)) return true; // Match the port part. diff --git a/chrome/common/content_settings_pattern_parser.cc b/chrome/common/content_settings_pattern_parser.cc index 1498586..2f823cc 100644 --- a/chrome/common/content_settings_pattern_parser.cc +++ b/chrome/common/content_settings_pattern_parser.cc @@ -6,6 +6,7 @@ #include "base/string_util.h" #include "chrome/common/url_constants.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "googleurl/src/url_canon.h" #include "net/base/net_util.h" @@ -171,7 +172,7 @@ void PatternParser::Parse(const std::string& pattern_spec, builder->WithPort(port); } } else { - if (scheme != std::string(chrome::kExtensionScheme) && + if (scheme != std::string(extensions::kExtensionScheme) && scheme != std::string(chrome::kFileScheme)) builder->WithPortWildcard(); } @@ -216,7 +217,7 @@ std::string PatternParser::ToString( } str += parts.host; - if (parts.scheme == std::string(chrome::kExtensionScheme)) { + if (parts.scheme == std::string(extensions::kExtensionScheme)) { str += parts.path.empty() ? std::string(kUrlPathSeparator) : parts.path; return str; } diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index dc27118..bcd6806 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -15,10 +15,10 @@ #include "base/logging.h" #include "base/memory/singleton.h" #include "base/stl_util.h" +#include "base/string16.h" #include "base/string_number_conversions.h" #include "base/string_piece.h" #include "base/string_util.h" -#include "base/string16.h" #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "base/values.h" @@ -41,6 +41,7 @@ #include "chrome/common/extensions/user_script.h" #include "chrome/common/url_constants.h" #include "crypto/sha2.h" +#include "extensions/common/constants.h" #include "googleurl/src/url_util.h" #include "grit/chromium_strings.h" #include "grit/theme_resources.h" @@ -520,7 +521,7 @@ Extension::Type Extension::GetType() const { // static GURL Extension::GetResourceURL(const GURL& extension_url, const std::string& relative_path) { - DCHECK(extension_url.SchemeIs(chrome::kExtensionScheme)); + DCHECK(extension_url.SchemeIs(extensions::kExtensionScheme)); DCHECK_EQ("/", extension_url.path()); std::string path = relative_path; @@ -3185,7 +3186,7 @@ const gfx::ImageSkia& Extension::GetDefaultIcon(bool is_app) { // static GURL Extension::GetBaseURLFromExtensionId(const std::string& extension_id) { - return GURL(std::string(chrome::kExtensionScheme) + + return GURL(std::string(extensions::kExtensionScheme) + content::kStandardSchemeSeparator + extension_id + "/"); } @@ -3699,7 +3700,7 @@ bool Extension::CanExecuteScriptOnPage(const GURL& document_url, return false; } - if (top_frame_url.SchemeIs(chrome::kExtensionScheme) && + if (top_frame_url.SchemeIs(extensions::kExtensionScheme) && top_frame_url.GetOrigin() != GetBaseURLFromExtensionId(id()).GetOrigin() && !CanExecuteScriptEverywhere()) { diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index b640663..56e1af4 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -26,9 +26,9 @@ #include "chrome/common/extensions/permissions/api_permission.h" #include "chrome/common/extensions/permissions/api_permission_set.h" #include "chrome/common/extensions/permissions/permission_message.h" -#include "chrome/common/extensions/user_script.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/extensions/url_pattern_set.h" +#include "chrome/common/extensions/user_script.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" #include "ui/base/accelerators/accelerator.h" #include "ui/gfx/size.h" diff --git a/chrome/common/extensions/extension_localization_peer.cc b/chrome/common/extensions/extension_localization_peer.cc index 980d2a4..295b36a 100644 --- a/chrome/common/extensions/extension_localization_peer.cc +++ b/chrome/common/extensions/extension_localization_peer.cc @@ -9,6 +9,7 @@ #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/extensions/message_bundle.h" #include "chrome/common/url_constants.h" +#include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "net/base/net_errors.h" #include "net/http/http_response_headers.h" @@ -35,7 +36,7 @@ ExtensionLocalizationPeer::CreateExtensionLocalizationPeer( const GURL& request_url) { // Return NULL if content is not text/css or it doesn't belong to extension // scheme. - return (request_url.SchemeIs(chrome::kExtensionScheme) && + return (request_url.SchemeIs(extensions::kExtensionScheme) && StartsWithASCII(mime_type, "text/css", false)) ? new ExtensionLocalizationPeer(peer, message_sender, request_url) : NULL; } diff --git a/chrome/common/extensions/extension_messages.h b/chrome/common/extensions/extension_messages.h index a20301e..a28b152 100644 --- a/chrome/common/extensions/extension_messages.h +++ b/chrome/common/extensions/extension_messages.h @@ -11,11 +11,11 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/permissions/permission_set.h" #include "chrome/common/extensions/permissions/socket_permission_data.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/extensions/url_pattern_set.h" #include "chrome/common/view_type.h" #include "chrome/common/web_apps.h" #include "content/public/common/common_param_traits.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_macros.h" diff --git a/chrome/common/extensions/extension_set.cc b/chrome/common/extensions/extension_set.cc index 857471ce..e908613 100644 --- a/chrome/common/extensions/extension_set.cc +++ b/chrome/common/extensions/extension_set.cc @@ -7,6 +7,7 @@ #include "base/logging.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" +#include "extensions/common/constants.h" using WebKit::WebSecurityOrigin; using extensions::Extension; @@ -74,7 +75,7 @@ std::string ExtensionSet::GetExtensionOrAppIDByURL( const ExtensionURLInfo& info) const { DCHECK(!info.origin().isNull()); - if (info.url().SchemeIs(chrome::kExtensionScheme)) + if (info.url().SchemeIs(extensions::kExtensionScheme)) return info.origin().isUnique() ? "" : info.url().host(); const Extension* extension = GetExtensionOrAppByURL(info); @@ -94,7 +95,7 @@ const Extension* ExtensionSet::GetExtensionOrAppByURL( if (!info.origin().isNull() && info.origin().isUnique()) return NULL; - if (info.url().SchemeIs(chrome::kExtensionScheme)) + if (info.url().SchemeIs(extensions::kExtensionScheme)) return GetByID(info.url().host()); return GetHostedAppByURL(info); @@ -141,7 +142,7 @@ bool ExtensionSet::ExtensionBindingsAllowed( if (info.origin().isUnique() || IsSandboxedPage(info)) return false; - if (info.url().SchemeIs(chrome::kExtensionScheme)) + if (info.url().SchemeIs(extensions::kExtensionScheme)) return true; ExtensionMap::const_iterator i = extensions_.begin(); @@ -158,7 +159,7 @@ bool ExtensionSet::IsSandboxedPage(const ExtensionURLInfo& info) const { if (info.origin().isUnique()) return true; - if (info.url().SchemeIs(chrome::kExtensionScheme)) { + if (info.url().SchemeIs(extensions::kExtensionScheme)) { const Extension* extension = GetByID(info.url().host()); if (extension) { return extension->IsSandboxedPage(info.url().path()); diff --git a/chrome/common/extensions/file_browser_handler.cc b/chrome/common/extensions/file_browser_handler.cc index 58dea7c..772bb6f 100644 --- a/chrome/common/extensions/file_browser_handler.cc +++ b/chrome/common/extensions/file_browser_handler.cc @@ -5,7 +5,7 @@ #include "chrome/common/extensions/file_browser_handler.h" #include "base/logging.h" -#include "chrome/common/extensions/url_pattern.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" namespace { diff --git a/chrome/common/extensions/file_browser_handler.h b/chrome/common/extensions/file_browser_handler.h index e4bf1ea..ceef073 100644 --- a/chrome/common/extensions/file_browser_handler.h +++ b/chrome/common/extensions/file_browser_handler.h @@ -9,8 +9,8 @@ #include <vector> #include "base/basictypes.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/extensions/url_pattern_set.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" class URLPattern; diff --git a/chrome/common/extensions/permissions/permission_set.cc b/chrome/common/extensions/permissions/permission_set.cc index cf7225b..c1777e1 100644 --- a/chrome/common/extensions/permissions/permission_set.cc +++ b/chrome/common/extensions/permissions/permission_set.cc @@ -10,9 +10,9 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/permissions/permissions_info.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/extensions/url_pattern_set.h" #include "content/public/common/url_constants.h" +#include "extensions/common/url_pattern.h" #include "grit/generated_resources.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/common/extensions/url_pattern_set.cc b/chrome/common/extensions/url_pattern_set.cc index 1bc256c..691e750 100644 --- a/chrome/common/extensions/url_pattern_set.cc +++ b/chrome/common/extensions/url_pattern_set.cc @@ -11,8 +11,8 @@ #include "base/memory/linked_ptr.h" #include "base/values.h" #include "chrome/common/extensions/extension_error_utils.h" -#include "chrome/common/extensions/url_pattern.h" #include "content/public/common/url_constants.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" namespace { diff --git a/chrome/common/extensions/url_pattern_set.h b/chrome/common/extensions/url_pattern_set.h index 7347f09..b39c614 100644 --- a/chrome/common/extensions/url_pattern_set.h +++ b/chrome/common/extensions/url_pattern_set.h @@ -8,7 +8,7 @@ #include <set> #include "base/memory/scoped_ptr.h" -#include "chrome/common/extensions/url_pattern.h" +#include "extensions/common/url_pattern.h" class GURL; diff --git a/chrome/common/extensions/user_script.h b/chrome/common/extensions/user_script.h index e7caad6..4d52999 100644 --- a/chrome/common/extensions/user_script.h +++ b/chrome/common/extensions/user_script.h @@ -10,9 +10,9 @@ #include "base/file_path.h" #include "base/string_piece.h" -#include "googleurl/src/gurl.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/common/extensions/url_pattern_set.h" +#include "extensions/common/url_pattern.h" +#include "googleurl/src/gurl.h" class Pickle; class PickleIterator; diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 75a06ef..373f6ca 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -498,7 +498,6 @@ const char* const kChromeDebugURLs[] = { const int kNumberOfChromeDebugURLs = static_cast<int>(arraysize(kChromeDebugURLs)); -const char kExtensionScheme[] = "chrome-extension"; const char kExtensionResourceScheme[] = "chrome-extension-resource"; // Google SafeSearch query parameters. diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 3b7dd38..1a55645 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -399,9 +399,6 @@ extern const char* const kChromeDebugURLs[]; extern const int kNumberOfChromeDebugURLs; // Canonical schemes you can use as input to GURL.SchemeIs(). -extern const char kExtensionScheme[]; - -// Canonical schemes you can use as input to GURL.SchemeIs(). extern const char kExtensionResourceScheme[]; #if defined(OS_CHROMEOS) diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS index 768d625..ced815f 100644 --- a/chrome/renderer/DEPS +++ b/chrome/renderer/DEPS @@ -3,6 +3,7 @@ include_rules = [ # TODO(jam): remove this once all of chrome doesn't depend on content/common. "-content/common", "+content/public/renderer", + "+extensions/common", "+grit", # For generated headers "+media/base", # For initializing media library and media switches. "+ppapi/native_client/src/trusted/plugin/nacl_entry_points.h", # For NaCl registration. diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index e21d588..522b9a6 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -69,11 +69,15 @@ #include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view_visitor.h" +#include "extensions/common/constants.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/renderer_resources.h" #include "ipc/ipc_sync_channel.h" #include "net/base/net_errors.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" @@ -81,9 +85,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" @@ -237,7 +238,7 @@ void ChromeContentRendererClient::RenderThreadStarted() { // content warnings. WebSecurityPolicy::registerURLSchemeAsSecure(chrome_ui_scheme); - WebString extension_scheme(ASCIIToUTF16(chrome::kExtensionScheme)); + WebString extension_scheme(ASCIIToUTF16(extensions::kExtensionScheme)); WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme); // chrome-extension: resources should be allowed to receive CORS requests. @@ -323,7 +324,7 @@ std::string ChromeContentRendererClient::GetDefaultEncoding() { const extensions::Extension* ChromeContentRendererClient::GetExtension( const WebSecurityOrigin& origin) const { - if (!EqualsASCII(origin.protocol(), chrome::kExtensionScheme)) + if (!EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) return NULL; const std::string extension_id = origin.host().utf8().data(); @@ -716,7 +717,8 @@ void ChromeContentRendererClient::GetNavigationErrorStrings( error.domain == WebString::fromUTF8(net::kErrorDomain) && EqualsASCII(failed_request.httpMethod(), "POST"); - if (failed_url.is_valid() && !failed_url.SchemeIs(chrome::kExtensionScheme)) { + if (failed_url.is_valid() && + !failed_url.SchemeIs(extensions::kExtensionScheme)) { extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL( ExtensionURLInfo(failed_url)); } @@ -836,7 +838,7 @@ bool ChromeContentRendererClient::WillSendRequest(WebKit::WebFrame* frame, GURL* new_url) { // Check whether the request should be allowed. If not allowed, we reset the // URL to something invalid to prevent the request and cause an error. - if (url.SchemeIs(chrome::kExtensionScheme) && + if (url.SchemeIs(extensions::kExtensionScheme) && !extensions::ResourceRequestPolicy::CanRequestResource( url, frame, diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index 4c26192..fca9e75 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc @@ -27,29 +27,30 @@ #include "chrome/renderer/translate_helper.h" #include "chrome/renderer/webview_color_overlay.h" #include "content/public/common/bindings_policy.h" -#include "content/public/renderer/render_view.h" #include "content/public/renderer/content_renderer_client.h" +#include "content/public/renderer/render_view.h" +#include "extensions/common/constants.h" #include "net/base/data_url.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObject.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObject.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "ui/gfx/favicon_size.h" #include "ui/gfx/size.h" #include "ui/gfx/skbitmap_operations.h" +#include "v8/include/v8-testing.h" #include "webkit/glue/image_decoder.h" #include "webkit/glue/multi_resolution_image_resource_fetcher.h" #include "webkit/glue/webkit_glue.h" -#include "v8/include/v8-testing.h" using WebKit::WebAccessibilityObject; using WebKit::WebCString; @@ -475,7 +476,7 @@ bool ChromeRenderViewObserver::allowWriteToClipboard(WebFrame* frame, const extensions::Extension* ChromeRenderViewObserver::GetExtension( const WebSecurityOrigin& origin) const { - if (!EqualsASCII(origin.protocol(), chrome::kExtensionScheme)) + if (!EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) return NULL; const std::string extension_id = origin.host().utf8().data(); diff --git a/chrome/renderer/content_settings_observer.cc b/chrome/renderer/content_settings_observer.cc index dd1790c..76c6e741 100644 --- a/chrome/renderer/content_settings_observer.cc +++ b/chrome/renderer/content_settings_observer.cc @@ -9,12 +9,13 @@ #include "content/public/renderer/document_state.h" #include "content/public/renderer/navigation_state.h" #include "content/public/renderer/render_view.h" +#include "extensions/common/constants.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrameClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/weburlresponse_extradata_impl.h" @@ -343,7 +344,7 @@ bool ContentSettingsObserver::IsWhitelistedForContentSettings( if (EqualsASCII(origin.protocol(), chrome::kChromeDevToolsScheme)) return true; // DevTools UI elements should still work. - if (EqualsASCII(origin.protocol(), chrome::kExtensionScheme)) + if (EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) return true; if (EqualsASCII(origin.protocol(), chrome::kChromeInternalScheme)) diff --git a/chrome/renderer/content_settings_observer_unittest.cc b/chrome/renderer/content_settings_observer_unittest.cc index de49b71..32a473d 100644 --- a/chrome/renderer/content_settings_observer_unittest.cc +++ b/chrome/renderer/content_settings_observer_unittest.cc @@ -6,6 +6,7 @@ #include "chrome/common/url_constants.h" #include "content/public/common/url_constants.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" @@ -30,7 +31,7 @@ TEST_F(ContentSettingsObserverTest, WhitelistedSchemes) { GURL())); GURL extension_url = - GURL(std::string(chrome::kExtensionScheme).append(end_url)); + GURL(std::string(extensions::kExtensionScheme).append(end_url)); EXPECT_TRUE(ContentSettingsObserver::IsWhitelistedForContentSettings( WebSecurityOrigin::create(extension_url), GURL())); diff --git a/chrome/renderer/extensions/chrome_v8_context_set.cc b/chrome/renderer/extensions/chrome_v8_context_set.cc index 62a1144..49d016c 100644 --- a/chrome/renderer/extensions/chrome_v8_context_set.cc +++ b/chrome/renderer/extensions/chrome_v8_context_set.cc @@ -12,14 +12,15 @@ #include "chrome/common/url_constants.h" #include "chrome/renderer/extensions/chrome_v8_context.h" #include "content/public/renderer/render_thread.h" -#include "content/public/renderer/v8_value_converter.h" #include "content/public/renderer/render_view.h" -#include "v8/include/v8.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" +#include "content/public/renderer/v8_value_converter.h" +#include "extensions/common/constants.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "v8/include/v8.h" using content::RenderThread; using content::V8ValueConverter; @@ -43,7 +44,7 @@ namespace { WebKit::WebDocument document = render_view->GetWebView()->mainFrame()->document(); - return GURL(document.url()).SchemeIs(chrome::kExtensionScheme) && + return GURL(document.url()).SchemeIs(extensions::kExtensionScheme) && document.securityOrigin().canRequest(event_url); } diff --git a/chrome/renderer/extensions/extension_helper.cc b/chrome/renderer/extensions/extension_helper.cc index 893c0f1..2252186 100644 --- a/chrome/renderer/extensions/extension_helper.cc +++ b/chrome/renderer/extensions/extension_helper.cc @@ -23,10 +23,11 @@ #include "chrome/renderer/extensions/user_script_slave.h" #include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view_visitor.h" +#include "extensions/common/constants.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "webkit/glue/image_resource_fetcher.h" @@ -80,7 +81,7 @@ class ViewAccumulator : public content::RenderViewVisitor { return true; GURL url = render_view->GetWebView()->mainFrame()->document().url(); - if (!url.SchemeIs(chrome::kExtensionScheme)) + if (!url.SchemeIs(extensions::kExtensionScheme)) return true; const std::string& extension_id = url.host(); if (extension_id != extension_id_) diff --git a/chrome/renderer/extensions/file_system_natives.cc b/chrome/renderer/extensions/file_system_natives.cc index 6b6e029..3239c47 100644 --- a/chrome/renderer/extensions/file_system_natives.cc +++ b/chrome/renderer/extensions/file_system_natives.cc @@ -10,10 +10,11 @@ #include "base/logging.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/extensions/user_script_slave.h" +#include "extensions/common/constants.h" #include "grit/renderer_resources.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "webkit/fileapi/file_system_types.h" #include "webkit/fileapi/file_system_util.h" @@ -29,7 +30,7 @@ static v8::Handle<v8::Value> GetIsolatedFileSystem( GURL context_url = extensions::UserScriptSlave::GetDataSourceURLForFrame(webframe); - CHECK(context_url.SchemeIs(chrome::kExtensionScheme)); + CHECK(context_url.SchemeIs(extensions::kExtensionScheme)); std::string name(fileapi::GetIsolatedFileSystemName(context_url.GetOrigin(), file_system_id)); diff --git a/chrome/renderer/extensions/resource_request_policy.cc b/chrome/renderer/extensions/resource_request_policy.cc index da83a32..d6ac03a 100644 --- a/chrome/renderer/extensions/resource_request_policy.cc +++ b/chrome/renderer/extensions/resource_request_policy.cc @@ -8,15 +8,16 @@ #include "base/logging.h" #include "base/stringprintf.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/url_constants.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_set.h" +#include "chrome/common/url_constants.h" #include "content/public/common/page_transition_types.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" namespace extensions { @@ -26,7 +27,7 @@ bool ResourceRequestPolicy::CanRequestResource( WebKit::WebFrame* frame, content::PageTransition transition_type, const ExtensionSet* loaded_extensions) { - CHECK(resource_url.SchemeIs(chrome::kExtensionScheme)); + CHECK(resource_url.SchemeIs(extensions::kExtensionScheme)); const Extension* extension = loaded_extensions->GetExtensionOrAppByURL(ExtensionURLInfo(resource_url)); @@ -99,7 +100,7 @@ bool ResourceRequestPolicy::CanRequestExtensionResourceScheme( GURL frame_url = frame->document().url(); if (!frame_url.is_empty() && - !frame_url.SchemeIs(chrome::kExtensionScheme)) { + !frame_url.SchemeIs(extensions::kExtensionScheme)) { std::string message = base::StringPrintf( "Denying load of %s. chrome-extension-resources:// can only be " "loaded from extensions.", diff --git a/chrome/renderer/page_load_histograms.cc b/chrome/renderer/page_load_histograms.cc index 39c11ac..4398f2d 100644 --- a/chrome/renderer/page_load_histograms.cc +++ b/chrome/renderer/page_load_histograms.cc @@ -10,18 +10,18 @@ #include "base/metrics/histogram.h" #include "base/time.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/extensions/url_pattern.h" #include "chrome/renderer/chrome_content_renderer_client.h" #include "chrome/renderer/prerender/prerender_helper.h" #include "content/public/common/content_constants.h" #include "content/public/renderer/document_state.h" #include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_view.h" +#include "extensions/common/url_pattern.h" #include "googleurl/src/gurl.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPerformance.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLResponse.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" using WebKit::WebDataSource; diff --git a/chrome/test/DEPS b/chrome/test/DEPS index 76b32b1..47315b3 100644 --- a/chrome/test/DEPS +++ b/chrome/test/DEPS @@ -1,6 +1,7 @@ include_rules = [ # The test directory can do whatever it wants in chrome. "+chrome", + "+extensions", # Tests under chrome/ shouldn't need to access the internals of content/ and # as such are allowed only content/public. If you find yourself wanting to diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 2510025..b553cb8 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -57,10 +57,11 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" -#include "content/public/browser/storage_partition.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/storage_partition.h" #include "content/public/test/mock_resource_context.h" #include "content/public/test/test_utils.h" +#include "extensions/common/constants.h" #include "net/cookies/cookie_monster.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" @@ -111,7 +112,7 @@ class TestExtensionURLRequestContext : public net::URLRequestContext { public: TestExtensionURLRequestContext() { net::CookieMonster* cookie_monster = new net::CookieMonster(NULL, NULL); - const char* schemes[] = {chrome::kExtensionScheme}; + const char* schemes[] = {extensions::kExtensionScheme}; cookie_monster->SetCookieableSchemes(schemes, 1); set_cookie_store(cookie_monster); } diff --git a/chrome_frame/DEPS b/chrome_frame/DEPS index f75ba96..201a2a9 100644 --- a/chrome_frame/DEPS +++ b/chrome_frame/DEPS @@ -2,4 +2,5 @@ include_rules = [ "+content/public/browser", "+content/public/common", "+content/public/test", + "+extensions/common" ] diff --git a/chrome_frame/navigation_constraints.cc b/chrome_frame/navigation_constraints.cc index 78bd8df..7e999ba 100644 --- a/chrome_frame/navigation_constraints.cc +++ b/chrome_frame/navigation_constraints.cc @@ -8,6 +8,7 @@ #include "base/utf_string_conversions.h" #include "chrome/common/url_constants.h" #include "chrome_frame/utils.h" +#include "extensions/common/constants.h" NavigationConstraintsImpl::NavigationConstraintsImpl() : is_privileged_(false) { } @@ -48,7 +49,7 @@ bool NavigationConstraintsImpl::IsSchemeAllowed(const GURL& url) { if (is_privileged_ && (url.SchemeIs(chrome::kDataScheme) || - url.SchemeIs(chrome::kExtensionScheme))) { + url.SchemeIs(extensions::kExtensionScheme))) { return true; } diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc index 1450d46..a4814fea 100644 --- a/chrome_frame/utils.cc +++ b/chrome_frame/utils.cc @@ -37,6 +37,7 @@ #include "chrome_frame/policy_settings.h" #include "chrome_frame/registry_list_preferences_holder.h" #include "chrome_frame/simple_resource_loader.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "googleurl/src/url_canon.h" #include "grit/chromium_strings.h" @@ -974,7 +975,7 @@ bool IsValidUrlScheme(const GURL& url, bool is_privileged) { if (is_privileged && (url.SchemeIs(chrome::kDataScheme) || - url.SchemeIs(chrome::kExtensionScheme))) + url.SchemeIs(extensions::kExtensionScheme))) return true; return false; diff --git a/extensions/DEPS b/extensions/DEPS new file mode 100644 index 0000000..fd6200f --- /dev/null +++ b/extensions/DEPS @@ -0,0 +1,4 @@ +include_rules = [ + "+base", + "+googleurl" +] diff --git a/extensions/README b/extensions/README new file mode 100644 index 0000000..c994549 --- /dev/null +++ b/extensions/README @@ -0,0 +1,3 @@ +This will become a reusable extensions module. It implements the core parts of +Chrome's extension system, and can be used with any host of the 'content' +module. diff --git a/extensions/common/DEPS b/extensions/common/DEPS new file mode 100644 index 0000000..630953d --- /dev/null +++ b/extensions/common/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+content/public/common" +] diff --git a/extensions/common/constants.cc b/extensions/common/constants.cc new file mode 100644 index 0000000..ecafa43 --- /dev/null +++ b/extensions/common/constants.cc @@ -0,0 +1,11 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "extensions/common/constants.h" + +namespace extensions { + +const char kExtensionScheme[] = "chrome-extension"; + +} // namespace extensions diff --git a/extensions/common/constants.h b/extensions/common/constants.h new file mode 100644 index 0000000..f601b38 --- /dev/null +++ b/extensions/common/constants.h @@ -0,0 +1,15 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef EXTENSIONS_COMMON_CONSTANTS_H_ +#define EXTENSIONS_COMMON_CONSTANTS_H_ + +namespace extensions { + +// Scheme we serve extension content from. +extern const char kExtensionScheme[]; + +} // namespace extensions + +#endif // EXTENSIONS_COMMON_CONSTANTS_H_ diff --git a/chrome/common/extensions/url_pattern.cc b/extensions/common/url_pattern.cc index 34ec6f8..73159b3 100644 --- a/chrome/common/extensions/url_pattern.cc +++ b/extensions/common/url_pattern.cc @@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/common/extensions/url_pattern.h" +#include "extensions/common/url_pattern.h" #include "base/string_number_conversions.h" #include "base/string_piece.h" #include "base/string_split.h" #include "base/string_util.h" -#include "chrome/common/url_constants.h" +#include "content/public/common/url_constants.h" +#include "extensions/common/constants.h" #include "googleurl/src/gurl.h" #include "googleurl/src/url_util.h" @@ -24,7 +25,7 @@ const char* kValidSchemes[] = { chrome::kFileScheme, chrome::kFtpScheme, chrome::kChromeUIScheme, - chrome::kExtensionScheme, + extensions::kExtensionScheme, chrome::kFileSystemScheme, }; diff --git a/chrome/common/extensions/url_pattern.h b/extensions/common/url_pattern.h index 6968133..42188a5 100644 --- a/chrome/common/extensions/url_pattern.h +++ b/extensions/common/url_pattern.h @@ -1,8 +1,8 @@ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ -#define CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ +#ifndef EXTENSIONS_COMMON_URL_PATTERN_H_ +#define EXTENSIONS_COMMON_URL_PATTERN_H_ #include <functional> #include <string> @@ -233,4 +233,4 @@ class URLPattern { typedef std::vector<URLPattern> URLPatternList; -#endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ +#endif // EXTENSIONS_COMMON_URL_PATTERN_H_ diff --git a/chrome/common/extensions/url_pattern_unittest.cc b/extensions/common/url_pattern_unittest.cc index d19d72d..c37b73d 100644 --- a/chrome/common/extensions/url_pattern_unittest.cc +++ b/extensions/common/url_pattern_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/memory/scoped_ptr.h" -#include "chrome/common/extensions/url_pattern.h" +#include "extensions/common/url_pattern.h" #include "testing/gtest/include/gtest/gtest.h" #include "googleurl/src/gurl.h" |