summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrockot <rockot@chromium.org>2014-09-18 12:31:52 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-18 19:32:14 +0000
commit9065985da2ce2a4f73150ac5eabab29c5d67505d (patch)
treea7e5407965a7b5e6905210344c2352ff2ce4adb5
parentd4a62b87d28f0bda1c9453f02d9ea22fccaf700c (diff)
downloadchromium_src-9065985da2ce2a4f73150ac5eabab29c5d67505d.zip
chromium_src-9065985da2ce2a4f73150ac5eabab29c5d67505d.tar.gz
chromium_src-9065985da2ce2a4f73150ac5eabab29c5d67505d.tar.bz2
Move Webstore URL concepts to //extensions and out
of Chrome-specific "constants." These URLs can be overridden by extensions embedders now and are no longer incorrectly classified as "constants." BUG=398671 TBR=xiyuan@chromium.org,sky@chromium.org for various files with header updates Review URL: https://codereview.chromium.org/575113002 Cr-Commit-Position: refs/heads/master@{#295523}
-rw-r--r--chrome/browser/apps/ephemeral_app_throttle.cc2
-rw-r--r--chrome/browser/chromeos/app_mode/kiosk_app_data.cc2
-rw-r--r--chrome/browser/chromeos/customization_document.cc2
-rw-r--r--chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc2
-rw-r--r--chrome/browser/chromeos/extensions/external_cache.cc2
-rw-r--r--chrome/browser/chromeos/extensions/external_cache_unittest.cc2
-rw-r--r--chrome/browser/extensions/api/web_request/web_request_permissions.cc2
-rw-r--r--chrome/browser/extensions/extension_assets_manager_chromeos.cc2
-rw-r--r--chrome/browser/extensions/extension_service.cc1
-rw-r--r--chrome/browser/extensions/extension_system_impl.cc1
-rw-r--r--chrome/browser/extensions/external_component_loader.cc1
-rw-r--r--chrome/browser/extensions/installed_loader.cc2
-rw-r--r--chrome/browser/extensions/shared_module_service.cc2
-rw-r--r--chrome/browser/extensions/updater/extension_downloader.cc2
-rw-r--r--chrome/browser/extensions/updater/extension_updater_unittest.cc1
-rw-r--r--chrome/browser/extensions/webstore_data_fetcher.cc2
-rw-r--r--chrome/browser/extensions/webstore_installer.cc2
-rw-r--r--chrome/browser/extensions/webstore_standalone_installer.cc1
-rw-r--r--chrome/browser/prerender/prerender_browsertest.cc1
-rw-r--r--chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc4
-rw-r--r--chrome/browser/ui/app_list/search/search_webstore_result.cc1
-rw-r--r--chrome/browser/ui/app_list/search/webstore/webstore_provider.cc2
-rw-r--r--chrome/browser/ui/app_list/search/webstore/webstore_result.cc1
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_action_context_menu_controller.mm6
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm1
-rw-r--r--chrome/browser/ui/views/extensions/extension_install_dialog_view.cc2
-rw-r--r--chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc2
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.cc15
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_resource_cache.cc2
-rw-r--r--chrome/browser/ui/webui/options/font_settings_handler.cc2
-rw-r--r--chrome/common/extensions/chrome_extensions_client.cc39
-rw-r--r--chrome/common/extensions/chrome_extensions_client.h3
-rw-r--r--chrome/common/extensions/extension_constants.cc80
-rw-r--r--chrome/common/extensions/extension_constants.h47
-rw-r--r--chrome/common/extensions/manifest_url_handler.cc2
-rw-r--r--chrome/renderer/extensions/webstore_bindings.cc2
-rw-r--r--extensions/common/extension_urls.cc67
-rw-r--r--extensions/common/extension_urls.h56
-rw-r--r--extensions/common/extensions_client.h10
-rw-r--r--extensions/shell/common/shell_extensions_client.cc15
-rw-r--r--extensions/shell/common/shell_extensions_client.h3
-rw-r--r--extensions/test/test_extensions_client.cc13
-rw-r--r--extensions/test/test_extensions_client.h3
43 files changed, 257 insertions, 153 deletions
diff --git a/chrome/browser/apps/ephemeral_app_throttle.cc b/chrome/browser/apps/ephemeral_app_throttle.cc
index 504e1b0..e562c82 100644
--- a/chrome/browser/apps/ephemeral_app_throttle.cc
+++ b/chrome/browser/apps/ephemeral_app_throttle.cc
@@ -10,7 +10,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "components/crx_file/id_util.h"
#include "components/navigation_interception/intercept_navigation_resource_throttle.h"
#include "components/navigation_interception/navigation_params.h"
@@ -18,6 +17,7 @@
#include "content/public/browser/resource_throttle.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/common/extension_urls.h"
#include "net/url_request/url_request.h"
using content::BrowserThread;
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc
index d7cdec3..31cf27f 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc
@@ -23,11 +23,11 @@
#include "chrome/browser/extensions/webstore_install_helper.h"
#include "chrome/browser/image_decoder.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/image_loader.h"
#include "extensions/common/constants.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
diff --git a/chrome/browser/chromeos/customization_document.cc b/chrome/browser/chromeos/customization_document.cc
index bfd7f3f..5edc590 100644
--- a/chrome/browser/chromeos/customization_document.cc
+++ b/chrome/browser/chromeos/customization_document.cc
@@ -34,11 +34,11 @@
#include "chrome/browser/ui/app_list/app_list_syncable_service.h"
#include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "chromeos/system/statistics_provider.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "content/public/browser/browser_thread.h"
+#include "extensions/common/extension_urls.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
diff --git a/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc b/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc
index 651fff4..ecde290 100644
--- a/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc
+++ b/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader_unittest.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/extensions/external_provider_impl.h"
#include "chrome/browser/extensions/updater/extension_downloader.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/test/base/testing_browser_process.h"
#include "components/policy/core/common/cloud/mock_cloud_policy_store.h"
#include "components/policy/core/common/policy_map.h"
@@ -31,6 +30,7 @@
#include "extensions/browser/external_provider_interface.h"
#include "extensions/browser/notification_types.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher_delegate.h"
diff --git a/chrome/browser/chromeos/extensions/external_cache.cc b/chrome/browser/chromeos/extensions/external_cache.cc
index a57d612..8e8f205 100644
--- a/chrome/browser/chromeos/extensions/external_cache.cc
+++ b/chrome/browser/chromeos/extensions/external_cache.cc
@@ -18,12 +18,12 @@
#include "chrome/browser/extensions/external_provider_impl.h"
#include "chrome/browser/extensions/updater/chrome_extension_downloader_factory.h"
#include "chrome/browser/extensions/updater/extension_downloader.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "extensions/browser/notification_types.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "net/url_request/url_request_context_getter.h"
namespace chromeos {
diff --git a/chrome/browser/chromeos/extensions/external_cache_unittest.cc b/chrome/browser/chromeos/extensions/external_cache_unittest.cc
index a40d3f1..fcbb30e 100644
--- a/chrome/browser/chromeos/extensions/external_cache_unittest.cc
+++ b/chrome/browser/chromeos/extensions/external_cache_unittest.cc
@@ -15,9 +15,9 @@
#include "base/test/sequenced_worker_pool_owner.h"
#include "base/values.h"
#include "chrome/browser/extensions/external_provider_impl.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
+#include "extensions/common/extension_urls.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher_impl.h"
#include "net/url_request/url_request_test_util.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 3827cd9..3a499a3 100644
--- a/chrome/browser/extensions/api/web_request/web_request_permissions.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_permissions.cc
@@ -6,12 +6,12 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "content/public/browser/resource_request_info.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#include "extensions/browser/info_map.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/permissions/permissions_data.h"
#include "net/url_request/url_request.h"
#include "url/gurl.h"
diff --git a/chrome/browser/extensions/extension_assets_manager_chromeos.cc b/chrome/browser/extensions/extension_assets_manager_chromeos.cc
index 3d05725ff..27b0bb3 100644
--- a/chrome/browser/extensions/extension_assets_manager_chromeos.cc
+++ b/chrome/browser/extensions/extension_assets_manager_chromeos.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/manifest_url_handler.h"
#include "chromeos/chromeos_switches.h"
#include "components/user_manager/user_manager.h"
@@ -27,6 +26,7 @@
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/file_util.h"
#include "extensions/common/manifest.h"
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 68ccff8..e7d46ef 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -73,6 +73,7 @@
#include "extensions/browser/uninstall_reason.h"
#include "extensions/browser/update_observer.h"
#include "extensions/common/extension_messages.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/file_util.h"
#include "extensions/common/manifest_constants.h"
diff --git a/chrome/browser/extensions/extension_system_impl.cc b/chrome/browser/extensions/extension_system_impl.cc
index cb953c9..ca34198 100644
--- a/chrome/browser/extensions/extension_system_impl.cc
+++ b/chrome/browser/extensions/extension_system_impl.cc
@@ -61,6 +61,7 @@
#include "extensions/browser/warning_set.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest.h"
#include "net/base/escape.h"
diff --git a/chrome/browser/extensions/external_component_loader.cc b/chrome/browser/extensions/external_component_loader.cc
index d7d8a29..efdd2964 100644
--- a/chrome/browser/extensions/external_component_loader.cc
+++ b/chrome/browser/extensions/external_component_loader.cc
@@ -14,6 +14,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
#include "components/signin/core/browser/signin_manager.h"
+#include "extensions/common/extension_urls.h"
namespace extensions {
diff --git a/chrome/browser/extensions/installed_loader.cc b/chrome/browser/extensions/installed_loader.cc
index 71fc70e..2ba8ee0 100644
--- a/chrome/browser/extensions/installed_loader.cc
+++ b/chrome/browser/extensions/installed_loader.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/supervised_user_private/supervised_user_handler.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/manifest_url_handler.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
@@ -32,6 +31,7 @@
#include "extensions/common/extension.h"
#include "extensions/common/extension_l10n_util.h"
#include "extensions/common/extension_set.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/file_util.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
diff --git a/chrome/browser/extensions/shared_module_service.cc b/chrome/browser/extensions/shared_module_service.cc
index 1a2c197..8768a62 100644
--- a/chrome/browser/extensions/shared_module_service.cc
+++ b/chrome/browser/extensions/shared_module_service.cc
@@ -10,11 +10,11 @@
#include "base/version.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/pending_extension_manager.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
namespace extensions {
diff --git a/chrome/browser/extensions/updater/extension_downloader.cc b/chrome/browser/extensions/updater/extension_downloader.cc
index 3ae3990..9813193 100644
--- a/chrome/browser/extensions/updater/extension_downloader.cc
+++ b/chrome/browser/extensions/updater/extension_downloader.cc
@@ -26,11 +26,11 @@
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/manifest_url_handler.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/extension_urls.h"
#include "google_apis/gaia/identity_provider.h"
#include "net/base/backoff_entry.h"
#include "net/base/load_flags.h"
diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc
index a3bdc61..bd47521 100644
--- a/chrome/browser/extensions/updater/extension_updater_unittest.cc
+++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc
@@ -53,6 +53,7 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/updater/manifest_fetch_data.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest_constants.h"
#include "google_apis/gaia/fake_identity_provider.h"
#include "google_apis/gaia/fake_oauth2_token_service.h"
diff --git a/chrome/browser/extensions/webstore_data_fetcher.cc b/chrome/browser/extensions/webstore_data_fetcher.cc
index d71fe01..0300519 100644
--- a/chrome/browser/extensions/webstore_data_fetcher.cc
+++ b/chrome/browser/extensions/webstore_data_fetcher.cc
@@ -8,7 +8,7 @@
#include "base/values.h"
#include "chrome/browser/extensions/webstore_data_fetcher_delegate.h"
#include "chrome/browser/safe_json_parser.h"
-#include "chrome/common/extensions/extension_constants.h"
+#include "extensions/common/extension_urls.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_status.h"
diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc
index 454197c..7c069ce 100644
--- a/chrome/browser/extensions/webstore_installer.cc
+++ b/chrome/browser/extensions/webstore_installer.cc
@@ -34,7 +34,6 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "components/crx_file/id_util.h"
#include "components/omaha_query_params/omaha_query_params.h"
#include "content/public/browser/browser_thread.h"
@@ -52,6 +51,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/shared_module_info.h"
#include "net/base/escape.h"
diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc
index 14c5643..617438d 100644
--- a/chrome/browser/extensions/webstore_standalone_installer.cc
+++ b/chrome/browser/extensions/webstore_standalone_installer.cc
@@ -21,6 +21,7 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "url/gurl.h"
using content::WebContents;
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index 80a40a5..ab2f4ce 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -81,6 +81,7 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/switches.h"
#include "extensions/test/result_catcher.h"
#include "net/base/escape.h"
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
index c3c6480..093dc59 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -31,7 +31,6 @@
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/login/login_prompt.h"
#include "chrome/browser/ui/sync/one_click_signin_helper.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "components/google/core/browser/google_util.h"
@@ -69,6 +68,7 @@
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#include "extensions/browser/info_map.h"
#include "extensions/common/constants.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/user_script.h"
#endif
@@ -661,6 +661,7 @@ void ChromeResourceDispatcherHostDelegate::OnResponseStarted(
info->GetRouteID());
// Build in additional protection for the chrome web store origin.
+#if defined(ENABLE_EXTENSIONS)
GURL webstore_url(extension_urls::GetWebstoreLaunchURL());
if (request->url().DomainIs(webstore_url.host().c_str())) {
net::HttpResponseHeaders* response_headers = request->response_headers();
@@ -670,6 +671,7 @@ void ChromeResourceDispatcherHostDelegate::OnResponseStarted(
response_headers->AddHeader("x-frame-options: sameorigin");
}
}
+#endif
// Ignores x-frame-options for the chrome signin UI.
const std::string request_spec(
diff --git a/chrome/browser/ui/app_list/search/search_webstore_result.cc b/chrome/browser/ui/app_list/search/search_webstore_result.cc
index ecae4c8..a979da6 100644
--- a/chrome/browser/ui/app_list/search/search_webstore_result.cc
+++ b/chrome/browser/ui/app_list/search/search_webstore_result.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/grit/generated_resources.h"
+#include "extensions/common/extension_urls.h"
#include "grit/theme_resources.h"
#include "net/base/url_util.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
index 7bd8671..81ad199 100644
--- a/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
+++ b/chrome/browser/ui/app_list/search/webstore/webstore_provider.cc
@@ -17,7 +17,7 @@
#include "chrome/browser/ui/app_list/search/common/json_response_fetcher.h"
#include "chrome/browser/ui/app_list/search/search_webstore_result.h"
#include "chrome/browser/ui/app_list/search/webstore/webstore_result.h"
-#include "chrome/common/extensions/extension_constants.h"
+#include "extensions/common/extension_urls.h"
#include "url/gurl.h"
namespace app_list {
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
index 2be75d6..f99e436 100644
--- a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
+++ b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
@@ -25,6 +25,7 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "grit/theme_resources.h"
#include "net/base/url_util.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu_controller.mm
index 0efcb9d..f6b70b3 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu_controller.mm
@@ -21,7 +21,6 @@
#include "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
#include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/manifest_url_handler.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -31,7 +30,9 @@
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/uninstall_reason.h"
+#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest_handlers/options_page_info.h"
#include "ui/base/l10n/l10n_util_mac.h"
@@ -179,8 +180,7 @@ class AsyncUninstaller : public extensions::ExtensionUninstallDialog::Delegate {
}
- (void)onExtensionName:(id)sender {
- GURL url(std::string(extension_urls::kGalleryBrowsePrefix) +
- std::string("/detail/") + extension_->id());
+ GURL url(extension_urls::GetWebstoreItemDetailURLPrefix() + extension_->id());
OpenURLParams params(url,
Referrer(),
NEW_FOREGROUND_TAB,
diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
index df70881..d8ef9aa 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
@@ -17,6 +17,7 @@
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/page_navigator.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "skia/ext/skia_utils_mac.h"
#import "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTweaker.h"
#import "ui/base/cocoa/controls/hyperlink_button_cell.h"
diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
index 4ceb8cc..14537d0 100644
--- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
@@ -20,13 +20,13 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
-#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/installer/util/browser_distribution.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
diff --git a/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc b/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc
index 93b889d..d8a0567 100644
--- a/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc
+++ b/chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc
@@ -16,7 +16,6 @@
#include "base/sys_info.h"
#include "base/values.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/chromeos_switches.h"
@@ -25,6 +24,7 @@
#include "components/user_manager/user_manager.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
+#include "extensions/common/extension_urls.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
#include "url/gurl.h"
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index 20e6b3f..b1ee352 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -54,7 +54,6 @@
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/features/feature_channel.h"
#include "chrome/common/extensions/manifest_url_handler.h"
#include "chrome/common/pref_names.h"
@@ -89,6 +88,7 @@
#include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h"
#include "extensions/common/extension_set.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_handlers/background_info.h"
@@ -471,15 +471,16 @@ void ExtensionSettingsHandler::GetLocalizedValues(
IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY,
base::ASCIIToUTF16(
google_util::AppendGoogleLocaleParam(
- GURL(extension_urls::GetExtensionGalleryURL()),
+ GURL(extension_urls::GetWebstoreExtensionsCategoryURL()),
g_browser_process->GetApplicationLocale()).spec())));
source->AddString("extensionSettingsGetMoreExtensions",
l10n_util::GetStringUTF16(IDS_GET_MORE_EXTENSIONS));
- source->AddString("extensionSettingsGetMoreExtensionsUrl",
- base::ASCIIToUTF16(
- google_util::AppendGoogleLocaleParam(
- GURL(extension_urls::GetExtensionGalleryURL()),
- g_browser_process->GetApplicationLocale()).spec()));
+ source->AddString(
+ "extensionSettingsGetMoreExtensionsUrl",
+ base::ASCIIToUTF16(
+ google_util::AppendGoogleLocaleParam(
+ GURL(extension_urls::GetWebstoreExtensionsCategoryURL()),
+ g_browser_process->GetApplicationLocale()).spec()));
source->AddString("extensionSettingsExtensionId",
l10n_util::GetStringUTF16(IDS_EXTENSIONS_ID));
source->AddString("extensionSettingsExtensionPath",
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
index f1c59a3..67a3cfa 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -35,7 +35,6 @@
#include "chrome/browser/ui/webui/sync_setup_handler.h"
#include "chrome/browser/web_resource/notification_promo.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
@@ -46,6 +45,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "grit/browser_resources.h"
#include "grit/components_strings.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/ui/webui/options/font_settings_handler.cc b/chrome/browser/ui/webui/options/font_settings_handler.cc
index a6b49ec..865e671 100644
--- a/chrome/browser/ui/webui/options/font_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/font_settings_handler.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/options/font_settings_utils.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/font_list_async.h"
@@ -32,6 +31,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
diff --git a/chrome/common/extensions/chrome_extensions_client.cc b/chrome/common/extensions/chrome_extensions_client.cc
index d29b353..e72162c 100644
--- a/chrome/common/extensions/chrome_extensions_client.cc
+++ b/chrome/common/extensions/chrome_extensions_client.cc
@@ -4,6 +4,9 @@
#include "chrome/common/extensions/chrome_extensions_client.h"
+#include "base/command_line.h"
+#include "base/strings/string_util.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/extensions/api/generated_schemas.h"
#include "chrome/common/extensions/chrome_manifest_handlers.h"
@@ -19,6 +22,7 @@
#include "extensions/common/common_manifest_handlers.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_api.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/features/api_feature.h"
#include "extensions/common/features/base_feature_provider.h"
#include "extensions/common/features/feature_provider.h"
@@ -45,6 +49,12 @@ namespace extensions {
namespace {
+// TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS.
+const char kExtensionBlocklistUrlPrefix[] =
+ "http://www.gstatic.com/chrome/extensions/blacklist";
+const char kExtensionBlocklistHttpsUrlPrefix[] =
+ "https://www.gstatic.com/chrome/extensions/blacklist";
+
const char kThumbsWhiteListedExtension[] = "khopmbdjffemhegeeobelklnbglcdgfh";
template <class FeatureClass>
@@ -273,6 +283,35 @@ bool ChromeExtensionsClient::ShouldSuppressFatalErrors() const {
return GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV;
}
+std::string ChromeExtensionsClient::GetWebstoreBaseURL() const {
+ std::string gallery_prefix = extension_urls::kChromeWebstoreBaseURL;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsGalleryURL))
+ gallery_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kAppsGalleryURL);
+ if (EndsWith(gallery_prefix, "/", true))
+ gallery_prefix = gallery_prefix.substr(0, gallery_prefix.length() - 1);
+ return gallery_prefix;
+}
+
+std::string ChromeExtensionsClient::GetWebstoreUpdateURL() const {
+ CommandLine* cmdline = CommandLine::ForCurrentProcess();
+ if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL))
+ return cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL);
+ else
+ return extension_urls::GetDefaultWebstoreUpdateUrl().spec();
+}
+
+bool ChromeExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const {
+ // The extension blacklist URL is returned from the update service and
+ // therefore not determined by Chromium. If the location of the blacklist file
+ // ever changes, we need to update this function. A DCHECK in the
+ // ExtensionUpdater ensures that we notice a change. This is the full URL
+ // of a blacklist:
+ // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt
+ return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) ||
+ StartsWithASCII(url.spec(), kExtensionBlocklistHttpsUrlPrefix, true);
+}
+
// static
ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() {
return g_client.Pointer();
diff --git a/chrome/common/extensions/chrome_extensions_client.h b/chrome/common/extensions/chrome_extensions_client.h
index 27a3e2c..b68b1c5 100644
--- a/chrome/common/extensions/chrome_extensions_client.h
+++ b/chrome/common/extensions/chrome_extensions_client.h
@@ -48,6 +48,9 @@ class ChromeExtensionsClient : public ExtensionsClient {
OVERRIDE;
virtual void RegisterAPISchemaResources(ExtensionAPI* api) const OVERRIDE;
virtual bool ShouldSuppressFatalErrors() const OVERRIDE;
+ virtual std::string GetWebstoreBaseURL() const OVERRIDE;
+ virtual std::string GetWebstoreUpdateURL() const OVERRIDE;
+ virtual bool IsBlacklistUpdateURL(const GURL& url) const OVERRIDE;
// Get the LazyInstance for ChromeExtensionsClient.
static ChromeExtensionsClient* GetInstance();
diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc
index 533fd87..dcfca2f 100644
--- a/chrome/common/extensions/extension_constants.cc
+++ b/chrome/common/extensions/extension_constants.cc
@@ -4,93 +4,19 @@
#include "chrome/common/extensions/extension_constants.h"
-#include <vector>
-
-#include "base/command_line.h"
-#include "base/strings/string_util.h"
-#include "chrome/common/chrome_switches.h"
-#include "net/base/escape.h"
-#include "net/base/url_util.h"
-
namespace extension_urls {
-std::string GetWebstoreLaunchURL() {
- std::string gallery_prefix = kGalleryBrowsePrefix;
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsGalleryURL))
- gallery_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kAppsGalleryURL);
- if (EndsWith(gallery_prefix, "/", true))
- gallery_prefix = gallery_prefix.substr(0, gallery_prefix.length() - 1);
- return gallery_prefix;
-}
-
-std::string GetExtensionGalleryURL() {
- return GetWebstoreLaunchURL() + "/category/extensions";
-}
-
-std::string GetWebstoreItemDetailURLPrefix() {
- return GetWebstoreLaunchURL() + "/detail/";
-}
-
-GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) {
- return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id);
-}
-
-GURL GetWebstoreJsonSearchUrl(const std::string& query, const std::string& hl) {
- GURL url(GetWebstoreLaunchURL() + "/jsonsearch");
- url = net::AppendQueryParameter(url, "q", query);
- url = net::AppendQueryParameter(url, "hl", hl);
- return url;
-}
-
-GURL GetWebstoreSearchPageUrl(const std::string& query) {
- return GURL(GetWebstoreLaunchURL() + "/search/" +
- net::EscapeQueryParamValue(query, false));
-}
+namespace {
const char kGalleryUpdateHttpsUrl[] =
"https://clients2.google.com/service/update2/crx";
-// TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS.
-const char kExtensionBlocklistUrlPrefix[] =
- "http://www.gstatic.com/chrome/extensions/blacklist";
-const char kExtensionBlocklistHttpsUrlPrefix[] =
- "https://www.gstatic.com/chrome/extensions/blacklist";
-
-GURL GetWebstoreUpdateUrl() {
- CommandLine* cmdline = CommandLine::ForCurrentProcess();
- if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL))
- return GURL(cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL));
- else
- return GetDefaultWebstoreUpdateUrl();
-}
+
+} // namespace
GURL GetDefaultWebstoreUpdateUrl() {
return GURL(kGalleryUpdateHttpsUrl);
}
-bool IsWebstoreUpdateUrl(const GURL& update_url) {
- GURL store_url = GetWebstoreUpdateUrl();
- if (update_url == store_url) {
- return true;
- } else {
- return (update_url.host() == store_url.host() &&
- update_url.path() == store_url.path());
- }
-}
-
-bool IsBlacklistUpdateUrl(const GURL& url) {
- // The extension blacklist URL is returned from the update service and
- // therefore not determined by Chromium. If the location of the blacklist file
- // ever changes, we need to update this function. A DCHECK in the
- // ExtensionUpdater ensures that we notice a change. This is the full URL
- // of a blacklist:
- // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt
- return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) ||
- StartsWithASCII(url.spec(), kExtensionBlocklistHttpsUrlPrefix, true);
-}
-
-const char kGalleryBrowsePrefix[] = "https://chrome.google.com/webstore";
-
const char kWebstoreSourceField[] = "utm_source";
const char kLaunchSourceAppList[] = "chrome-app-launcher";
diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h
index 8d4122a..94dda8b 100644
--- a/chrome/common/extensions/extension_constants.h
+++ b/chrome/common/extensions/extension_constants.h
@@ -12,53 +12,10 @@
namespace extension_urls {
-// Returns the URL prefix for the extension/apps gallery. Can be set via the
-// --apps-gallery-url switch. The URL returned will not contain a trailing
-// slash. Do not use this as a prefix/extent for the store.
-std::string GetWebstoreLaunchURL();
-
-// Returns the URL to the extensions category on the Web Store. This is
-// derived from GetWebstoreLaunchURL().
-std::string GetExtensionGalleryURL();
-
-// Returns the URL prefix for an item in the extension/app gallery. This URL
-// will contain a trailing slash and should be concatenated with an item ID
-// to get the item detail URL.
-std::string GetWebstoreItemDetailURLPrefix();
-
-// Returns the URL used to get webstore data (ratings, manifest, icon URL,
-// etc.) about an extension from the webstore as JSON.
-GURL GetWebstoreItemJsonDataURL(const std::string& extension_id);
-
-// Returns the URL used to get webstore search results in JSON format. The URL
-// returns a JSON dictionary that has the search results (under "results").
-// Each entry in the array is a dictionary as the data returned for
-// GetWebstoreItemJsonDataURL above. |query| is the user typed query string.
-// |hl| is the host language code, e.g. en_US. Both arguments will be escaped
-// and added as a query parameter to the returned web store json search URL.
-GURL GetWebstoreJsonSearchUrl(const std::string& query, const std::string& hl);
-
-// Returns the URL of the web store search results page for |query|.
-GURL GetWebstoreSearchPageUrl(const std::string& query);
-
-// Return the update URL used by gallery/webstore extensions/apps. This may
-// have been overridden by a command line flag for testing purposes.
-GURL GetWebstoreUpdateUrl();
-
-// This returns the compile-time constant webstore update url. Usually you
-// should prefer using GetWebstoreUpdateUrl.
+// This returns the compile-time constant webstore update url specific to
+// Chrome. Usually you should prefer using GetWebstoreUpdateUrl.
GURL GetDefaultWebstoreUpdateUrl();
-// Returns whether the URL is the webstore update URL (just considering host
-// and path, not scheme, query, etc.)
-bool IsWebstoreUpdateUrl(const GURL& update_url);
-
-// Returns true if the URL points to an extension blacklist.
-bool IsBlacklistUpdateUrl(const GURL& url);
-// The greatest common prefixes of the main extensions gallery's browse and
-// download URLs.
-extern const char kGalleryBrowsePrefix[];
-
// Field to use with webstore URL for tracking launch source.
extern const char kWebstoreSourceField[];
diff --git a/chrome/common/extensions/manifest_url_handler.cc b/chrome/common/extensions/manifest_url_handler.cc
index 4833bdd..c883a26 100644
--- a/chrome/common/extensions/manifest_url_handler.cc
+++ b/chrome/common/extensions/manifest_url_handler.cc
@@ -12,10 +12,10 @@
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "extensions/common/error_utils.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/file_util.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
diff --git a/chrome/renderer/extensions/webstore_bindings.cc b/chrome/renderer/extensions/webstore_bindings.cc
index 3a82d15..c46a23c 100644
--- a/chrome/renderer/extensions/webstore_bindings.cc
+++ b/chrome/renderer/extensions/webstore_bindings.cc
@@ -7,10 +7,10 @@
#include "base/strings/string_util.h"
#include "chrome/common/extensions/api/webstore/webstore_api_constants.h"
#include "chrome/common/extensions/chrome_extension_messages.h"
-#include "chrome/common/extensions/extension_constants.h"
#include "components/crx_file/id_util.h"
#include "content/public/renderer/render_view.h"
#include "extensions/common/extension.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/renderer/script_context.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
diff --git a/extensions/common/extension_urls.cc b/extensions/common/extension_urls.cc
index ba72a63..c58a2d6 100644
--- a/extensions/common/extension_urls.cc
+++ b/extensions/common/extension_urls.cc
@@ -7,6 +7,9 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "extensions/common/constants.h"
+#include "extensions/common/extensions_client.h"
+#include "net/base/escape.h"
+#include "net/base/url_util.h"
#include "url/gurl.h"
namespace extensions {
@@ -23,3 +26,67 @@ bool IsSourceFromAnExtension(const base::string16& source) {
}
} // namespace extensions
+
+namespace extension_urls {
+
+const char kChromeWebstoreBaseURL[] = "https://chrome.google.com/webstore";
+const char kChromeWebstoreUpdateURL[] =
+ "https://clients2.google.com/service/update2/crx";
+
+std::string GetWebstoreLaunchURL() {
+ extensions::ExtensionsClient* client = extensions::ExtensionsClient::Get();
+ if (client)
+ return client->GetWebstoreBaseURL();
+ return kChromeWebstoreBaseURL;
+}
+
+std::string GetWebstoreExtensionsCategoryURL() {
+ return GetWebstoreLaunchURL() + "/category/extensions";
+}
+
+std::string GetWebstoreItemDetailURLPrefix() {
+ return GetWebstoreLaunchURL() + "/detail/";
+}
+
+GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) {
+ return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id);
+}
+
+GURL GetWebstoreJsonSearchUrl(const std::string& query,
+ const std::string& host_language_code) {
+ GURL url(GetWebstoreLaunchURL() + "/jsonsearch");
+ url = net::AppendQueryParameter(url, "q", query);
+ url = net::AppendQueryParameter(url, "hl", host_language_code);
+ return url;
+}
+
+GURL GetWebstoreSearchPageUrl(const std::string& query) {
+ return GURL(GetWebstoreLaunchURL() + "/search/" +
+ net::EscapeQueryParamValue(query, false));
+}
+
+GURL GetWebstoreUpdateUrl() {
+ extensions::ExtensionsClient* client = extensions::ExtensionsClient::Get();
+ if (client)
+ return GURL(client->GetWebstoreUpdateURL());
+ return GURL(kChromeWebstoreUpdateURL);
+}
+
+bool IsWebstoreUpdateUrl(const GURL& update_url) {
+ GURL store_url = GetWebstoreUpdateUrl();
+ if (update_url == store_url) {
+ return true;
+ } else {
+ return (update_url.host() == store_url.host() &&
+ update_url.path() == store_url.path());
+ }
+}
+
+bool IsBlacklistUpdateUrl(const GURL& url) {
+ extensions::ExtensionsClient* client = extensions::ExtensionsClient::Get();
+ if (client)
+ return client->IsBlacklistUpdateURL(url);
+ return false;
+}
+
+} // namespace extension_urls
diff --git a/extensions/common/extension_urls.h b/extensions/common/extension_urls.h
index 2236a81..2440a83 100644
--- a/extensions/common/extension_urls.h
+++ b/extensions/common/extension_urls.h
@@ -5,8 +5,12 @@
#ifndef EXTENSIONS_COMMON_EXTENSION_URLS_H_
#define EXTENSIONS_COMMON_EXTENSION_URLS_H_
+#include <string>
+
#include "base/strings/string16.h"
+class GURL;
+
namespace extensions {
// The name of the event_bindings module.
@@ -23,4 +27,56 @@ bool IsSourceFromAnExtension(const base::string16& source);
} // namespace extensions
+namespace extension_urls {
+
+// Canonical URLs for the Chrome Webstore. You probably want to use one of
+// the calls below rather than using one of these constants directly, since
+// the active extensions embedder may provide its own webstore URLs.
+extern const char kChromeWebstoreBaseURL[];
+extern const char kChromeWebstoreUpdateURL[];
+
+// Returns the URL prefix for the extension/apps gallery. Can be set via the
+// --apps-gallery-url switch. The URL returned will not contain a trailing
+// slash. Do not use this as a prefix/extent for the store.
+std::string GetWebstoreLaunchURL();
+
+// Returns the URL to the extensions category on the Web Store. This is
+// derived from GetWebstoreLaunchURL().
+std::string GetWebstoreExtensionsCategoryURL();
+
+// Returns the URL prefix for an item in the extension/app gallery. This URL
+// will contain a trailing slash and should be concatenated with an item ID
+// to get the item detail URL.
+std::string GetWebstoreItemDetailURLPrefix();
+
+// Returns the URL used to get webstore data (ratings, manifest, icon URL,
+// etc.) about an extension from the webstore as JSON.
+GURL GetWebstoreItemJsonDataURL(const std::string& extension_id);
+
+// Returns the URL used to get webstore search results in JSON format. The URL
+// returns a JSON dictionary that has the search results (under "results").
+// Each entry in the array is a dictionary as the data returned for
+// GetWebstoreItemJsonDataURL above. |query| is the user typed query string.
+// |host_language_code| is the host language code, e.g. en_US. Both arguments
+// will be escaped and added as a query parameter to the returned web store
+// json search URL.
+GURL GetWebstoreJsonSearchUrl(const std::string& query,
+ const std::string& host_language_code);
+
+// Returns the URL of the web store search results page for |query|.
+GURL GetWebstoreSearchPageUrl(const std::string& query);
+
+// Return the update URL used by gallery/webstore extensions/apps. This may
+// have been overridden by a command line flag for testing purposes.
+GURL GetWebstoreUpdateUrl();
+
+// Returns whether the URL is the webstore update URL (just considering host
+// and path, not scheme, query, etc.)
+bool IsWebstoreUpdateUrl(const GURL& update_url);
+
+// Returns true if the URL points to an extension blacklist.
+bool IsBlacklistUpdateUrl(const GURL& url);
+
+} // namespace extension_urls
+
#endif // EXTENSIONS_COMMON_EXTENSION_URLS_H_
diff --git a/extensions/common/extensions_client.h b/extensions/common/extensions_client.h
index 623a2de..77037d4 100644
--- a/extensions/common/extensions_client.h
+++ b/extensions/common/extensions_client.h
@@ -97,6 +97,16 @@ class ExtensionsClient {
// (i.e., only logged) or allowed (i.e., logged before crashing).
virtual bool ShouldSuppressFatalErrors() const = 0;
+ // Returns the base webstore URL prefix.
+ virtual std::string GetWebstoreBaseURL() const = 0;
+
+ // Returns the URL to use for update manifest queries.
+ virtual std::string GetWebstoreUpdateURL() const = 0;
+
+ // Returns a flag indicating whether or not a given URL is a valid
+ // extension blacklist URL.
+ virtual bool IsBlacklistUpdateURL(const GURL& url) const = 0;
+
// Return the extensions client.
static ExtensionsClient* Get();
diff --git a/extensions/shell/common/shell_extensions_client.cc b/extensions/shell/common/shell_extensions_client.cc
index be135c7..493acca 100644
--- a/extensions/shell/common/shell_extensions_client.cc
+++ b/extensions/shell/common/shell_extensions_client.cc
@@ -9,6 +9,7 @@
#include "extensions/common/api/generated_schemas.h"
#include "extensions/common/api/sockets/sockets_manifest_handler.h"
#include "extensions/common/common_manifest_handlers.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/features/api_feature.h"
#include "extensions/common/features/base_feature_provider.h"
#include "extensions/common/features/json_feature_provider_source.h"
@@ -193,4 +194,18 @@ bool ShellExtensionsClient::ShouldSuppressFatalErrors() const {
return true;
}
+std::string ShellExtensionsClient::GetWebstoreBaseURL() const {
+ return extension_urls::kChromeWebstoreBaseURL;
+}
+
+std::string ShellExtensionsClient::GetWebstoreUpdateURL() const {
+ return extension_urls::kChromeWebstoreUpdateURL;
+}
+
+bool ShellExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const {
+ // TODO(rockot): Maybe we want to do something else here. For now we accept
+ // any URL as a blacklist URL because we don't really care.
+ return true;
+}
+
} // namespace extensions
diff --git a/extensions/shell/common/shell_extensions_client.h b/extensions/shell/common/shell_extensions_client.h
index 10e6f20..43fc4b7 100644
--- a/extensions/shell/common/shell_extensions_client.h
+++ b/extensions/shell/common/shell_extensions_client.h
@@ -44,6 +44,9 @@ class ShellExtensionsClient : public ExtensionsClient {
const std::string& name) const OVERRIDE;
virtual void RegisterAPISchemaResources(ExtensionAPI* api) const OVERRIDE;
virtual bool ShouldSuppressFatalErrors() const OVERRIDE;
+ virtual std::string GetWebstoreBaseURL() const OVERRIDE;
+ virtual std::string GetWebstoreUpdateURL() const OVERRIDE;
+ virtual bool IsBlacklistUpdateURL(const GURL& url) const OVERRIDE;
private:
const ExtensionsAPIPermissions extensions_api_permissions_;
diff --git a/extensions/test/test_extensions_client.cc b/extensions/test/test_extensions_client.cc
index a47e60e..e93666a 100644
--- a/extensions/test/test_extensions_client.cc
+++ b/extensions/test/test_extensions_client.cc
@@ -6,6 +6,7 @@
#include "extensions/common/api/generated_schemas.h"
#include "extensions/common/common_manifest_handlers.h"
+#include "extensions/common/extension_urls.h"
#include "extensions/common/features/api_feature.h"
#include "extensions/common/features/base_feature_provider.h"
#include "extensions/common/features/feature_provider.h"
@@ -142,4 +143,16 @@ bool TestExtensionsClient::ShouldSuppressFatalErrors() const {
return true;
}
+std::string TestExtensionsClient::GetWebstoreBaseURL() const {
+ return extension_urls::kChromeWebstoreBaseURL;
+}
+
+std::string TestExtensionsClient::GetWebstoreUpdateURL() const {
+ return extension_urls::kChromeWebstoreUpdateURL;
+}
+
+bool TestExtensionsClient::IsBlacklistUpdateURL(const GURL& url) const {
+ return true;
+}
+
} // namespace extensions
diff --git a/extensions/test/test_extensions_client.h b/extensions/test/test_extensions_client.h
index 6c6f7e5..1d1b8d6 100644
--- a/extensions/test/test_extensions_client.h
+++ b/extensions/test/test_extensions_client.h
@@ -41,6 +41,9 @@ class TestExtensionsClient : public ExtensionsClient {
const std::string& name) const OVERRIDE;
virtual void RegisterAPISchemaResources(ExtensionAPI* api) const OVERRIDE;
virtual bool ShouldSuppressFatalErrors() const OVERRIDE;
+ virtual std::string GetWebstoreBaseURL() const OVERRIDE;
+ virtual std::string GetWebstoreUpdateURL() const OVERRIDE;
+ virtual bool IsBlacklistUpdateURL(const GURL& url) const OVERRIDE;
// A whitelist of extensions that can script anywhere. Do not add to this
// list (except in tests) without consulting the Extensions team first.