| Index: extensions/common/extension_urls.cc
|
| diff --git a/extensions/common/extension_urls.cc b/extensions/common/extension_urls.cc
|
| index ba72a63ef21971225eb3a4d124d569a57e223a9f..1f47a8e8f3c059dfe67382937fd45c3c1934d980 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,53 @@ bool IsSourceFromAnExtension(const base::string16& source) {
|
| }
|
|
|
| } // namespace extensions
|
| +
|
| +namespace extension_urls {
|
| +
|
| +std::string GetWebstoreLaunchURL() {
|
| + return extensions::ExtensionsClient::Get()->GetWebstoreBaseURL();
|
| +}
|
| +
|
| +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));
|
| +}
|
| +
|
| +GURL GetWebstoreUpdateUrl() {
|
| + return GURL(extensions::ExtensionsClient::Get()->GetWebstoreUpdateURL());
|
| +}
|
| +
|
| +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) {
|
| + return extensions::ExtensionsClient::Get()->IsBlacklistUpdateURL(url);
|
| +}
|
| +
|
| +} // namespace extension_urls
|
|
|