diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 02:16:13 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 02:16:13 +0000 |
commit | e288840fb5acf7336568ea37527d2189c8733ae8 (patch) | |
tree | 1b349cf3b3e895d99defa2d7effe2d43707c8474 | |
parent | 2eba1513ea24399e08de0836ce622d383e4606b8 (diff) | |
download | chromium_src-e288840fb5acf7336568ea37527d2189c8733ae8.zip chromium_src-e288840fb5acf7336568ea37527d2189c8733ae8.tar.gz chromium_src-e288840fb5acf7336568ea37527d2189c8733ae8.tar.bz2 |
Special case the gallery to not show the scary download roadblock.
That was only needed because of clickjacking.
BUG=28227
Review URL: http://codereview.chromium.org/411004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32588 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/dom_ui/ntp_resource_cache.cc | 5 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service.cc | 22 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service.h | 7 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_ui.cc | 7 | ||||
-rw-r--r-- | chrome/common/extensions/extension.cc | 3 | ||||
-rw-r--r-- | chrome/common/extensions/extension.h | 3 | ||||
-rw-r--r-- | chrome/common/extensions/extension_constants.cc | 8 | ||||
-rw-r--r-- | chrome/common/extensions/extension_constants.h | 12 | ||||
-rw-r--r-- | chrome/renderer/user_script_slave.cc | 3 |
9 files changed, 42 insertions, 28 deletions
diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc index 13c4222..42a235a 100644 --- a/chrome/browser/dom_ui/ntp_resource_cache.cc +++ b/chrome/browser/dom_ui/ntp_resource_cache.cc @@ -18,6 +18,7 @@ #include "chrome/browser/user_data_manager.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" @@ -240,10 +241,10 @@ void NTPResourceCache::CreateNewTabHtml() { localized_strings.SetString(L"promomessage", l10n_util::GetStringF(IDS_NTP_PROMOTION_MESSAGE, l10n_util::GetString(IDS_PRODUCT_NAME), - ASCIIToWide(Extension::kGalleryBrowseUrl), + ASCIIToWide(extension_urls::kGalleryBrowsePrefix), GetUrlWithLang(kSyncServiceHelpUrl))); localized_strings.SetString(L"extensionslink", - ASCIIToWide(Extension::kGalleryBrowseUrl)); + ASCIIToWide(extension_urls::kGalleryBrowsePrefix)); // Don't initiate the sync related message passing with the page if the sync // code is not present. diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 4a8b7c3..c254b92 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -68,20 +68,24 @@ class InstalledExtensionSet { const char* ExtensionsService::kInstallDirectoryName = "Extensions"; const char* ExtensionsService::kCurrentVersionFileName = "Current Version"; -const char* ExtensionsService::kGalleryDownloadURLPrefix = - "https://dl-ssl.google.com/chrome/"; -const char* ExtensionsService::kGalleryURLPrefix = - "https://tools.google.com/chrome/"; - // static bool ExtensionsService::IsDownloadFromGallery(const GURL& download_url, const GURL& referrer_url) { - if (StartsWithASCII(download_url.spec(), kGalleryDownloadURLPrefix, false) && - StartsWithASCII(referrer_url.spec(), kGalleryURLPrefix, false)) { + if (StartsWithASCII(download_url.spec(), + extension_urls::kMiniGalleryDownloadPrefix, false) && + StartsWithASCII(referrer_url.spec(), + extension_urls::kMiniGalleryBrowsePrefix, false)) { return true; - } else { - return false; } + + if (StartsWithASCII(download_url.spec(), + extension_urls::kGalleryDownloadPrefix, false) && + StartsWithASCII(referrer_url.spec(), + extension_urls::kGalleryBrowsePrefix, false)) { + return true; + } + + return false; } ExtensionsService::ExtensionsService(Profile* profile, diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h index 1a8c336..4a91fff 100644 --- a/chrome/browser/extensions/extensions_service.h +++ b/chrome/browser/extensions/extensions_service.h @@ -71,13 +71,6 @@ class ExtensionsService // The name of the file that the current active version number is stored in. static const char* kCurrentVersionFileName; - // Hack: - // Extensions downloaded from kGalleryDownloadURLPrefix initiated from pages - // with kGalleryURLPrefix will not require --enable-extensions and will be - // prompt-free. - static const char* kGalleryDownloadURLPrefix; - static const char* kGalleryURLPrefix; - // Determine if a given extension download should be treated as if it came // from the gallery. static bool IsDownloadFromGallery(const GURL& download_url, diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index 14ae1db..2af1c01 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -27,6 +27,7 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_error_reporter.h" #include "chrome/common/extensions/user_script.h" #include "chrome/common/extensions/url_pattern.h" @@ -72,13 +73,13 @@ void ExtensionsUIHTMLSource::StartDataRequest(const std::string& path, l10n_util::GetString(IDS_EXTENSIONS_NONE_INSTALLED)); localized_strings.SetString(L"suggestGallery", l10n_util::GetStringF(IDS_EXTENSIONS_NONE_INSTALLED_SUGGEST_GALLERY, - std::wstring(L"<a href='") + - ASCIIToWide(Extension::kGalleryBrowseUrl) + + std::wstring(L"<a href='") + + ASCIIToWide(extension_urls::kGalleryBrowsePrefix) + L"'>", L"</a>")); localized_strings.SetString(L"getMoreExtensions", std::wstring(L"<a href='") + - ASCIIToWide(Extension::kGalleryBrowseUrl) + + ASCIIToWide(extension_urls::kGalleryBrowsePrefix) + L"'>" + l10n_util::GetString(IDS_GET_MORE_EXTENSIONS) + L"</a>"); diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 7b39253..93428a58 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -86,9 +86,6 @@ static const wchar_t* kValidThemeKeys[] = { keys::kUpdateURL }; -const char* Extension::kGalleryBrowseUrl = - "https://chrome.google.com/extensions"; - #if defined(OS_WIN) const char* Extension::kExtensionRegistryPath = "Software\\Google\\Chrome\\Extensions"; diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index 7738acf..9d5c1f5 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -63,9 +63,6 @@ class Extension { EXTENSION_ICON_BITTY = 16, }; - // The URL to browse the extensions gallery. - static const char* kGalleryBrowseUrl; - // Icon sizes used by the extension system. static const int kIconSizes[]; diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc index 733b4f8..efba4d3 100644 --- a/chrome/common/extensions/extension_constants.cc +++ b/chrome/common/extensions/extension_constants.cc @@ -195,3 +195,11 @@ const char* kLocalesMessagesFileMissing = const char* kInvalidOptionsPage = "Invalid value for 'options_page'."; } // namespace extension_manifest_errors + +namespace extension_urls { +const char* kGalleryBrowsePrefix = "https://chrome.google.com/extensions"; +const char* kGalleryDownloadPrefix = + "https://clients2.googleusercontent.com/crx/download"; +const char* kMiniGalleryBrowsePrefix = "https://tools.google.com/chrome/"; +const char* kMiniGalleryDownloadPrefix = "https://dl-ssl.google.com/chrome/"; +} diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h index c8a717a..8d2500a 100644 --- a/chrome/common/extensions/extension_constants.h +++ b/chrome/common/extensions/extension_constants.h @@ -130,4 +130,16 @@ namespace extension_manifest_errors { extern const char* kInvalidOptionsPage; } // namespace extension_manifest_errors +namespace extension_urls { + // The greatest common prefixes of the main extensions gallery's browse and + // download URLs. + extern const char* kGalleryBrowsePrefix; + extern const char* kGalleryDownloadPrefix; + + // Same thing for the "minigallery". The minigallery is the temporary static + // themes gallery that we put up when we launched themes. + extern const char* kMiniGalleryBrowsePrefix; + extern const char* kMiniGalleryDownloadPrefix; +} // namespace extension_urls + #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_CONSTANTS_H_ diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc index bdddbc3..1133849 100644 --- a/chrome/renderer/user_script_slave.cc +++ b/chrome/renderer/user_script_slave.cc @@ -12,6 +12,7 @@ #include "base/shared_memory.h" #include "base/string_util.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_constants.h" #include "chrome/renderer/extension_groups.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" @@ -131,7 +132,7 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame, // Don't inject user scripts into the gallery itself. This prevents // a user script from removing the "report abuse" link, for example. - if (frame_url.host() == GURL(Extension::kGalleryBrowseUrl).host()) + if (frame_url.host() == GURL(extension_urls::kGalleryBrowsePrefix).host()) return true; PerfTimer timer; |