| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/extensions/extension_constants.h" | 5 #include "chrome/common/extensions/extension_constants.h" |
| 6 #include "chrome/common/extensions/extension_manifest_constants.h" | 6 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 #include "net/base/escape.h" |
| 13 #include "net/base/url_util.h" | 14 #include "net/base/url_util.h" |
| 14 | 15 |
| 15 namespace extension_urls { | 16 namespace extension_urls { |
| 16 | 17 |
| 17 std::string GetWebstoreLaunchURL() { | 18 std::string GetWebstoreLaunchURL() { |
| 18 std::string gallery_prefix = kGalleryBrowsePrefix; | 19 std::string gallery_prefix = kGalleryBrowsePrefix; |
| 19 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsGalleryURL)) | 20 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsGalleryURL)) |
| 20 gallery_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 21 gallery_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 21 switches::kAppsGalleryURL); | 22 switches::kAppsGalleryURL); |
| 22 if (EndsWith(gallery_prefix, "/", true)) | 23 if (EndsWith(gallery_prefix, "/", true)) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 url = net::AppendQueryParameter(url, "_wi", action); | 42 url = net::AppendQueryParameter(url, "_wi", action); |
| 42 url = net::AppendQueryParameter(url, "_mt", type); | 43 url = net::AppendQueryParameter(url, "_mt", type); |
| 43 | 44 |
| 44 return url; | 45 return url; |
| 45 } | 46 } |
| 46 | 47 |
| 47 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) { | 48 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) { |
| 48 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id); | 49 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id); |
| 49 } | 50 } |
| 50 | 51 |
| 52 GURL GetWebstoreJsonSearchUrl(const std::string& query, const std::string& hl) { |
| 53 GURL url(GetWebstoreLaunchURL() + "/jsonsearch"); |
| 54 url = net::AppendQueryParameter(url, "q", query); |
| 55 url = net::AppendQueryParameter(url, "hl", hl); |
| 56 return url; |
| 57 } |
| 58 |
| 59 GURL GetWebstoreSearchPageUrl(const std::string& query) { |
| 60 return GURL(GetWebstoreLaunchURL() + "/search/" + |
| 61 net::EscapeQueryParamValue(query, false)); |
| 62 } |
| 63 |
| 51 const char kGalleryUpdateHttpsUrl[] = | 64 const char kGalleryUpdateHttpsUrl[] = |
| 52 "https://clients2.google.com/service/update2/crx"; | 65 "https://clients2.google.com/service/update2/crx"; |
| 53 // TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS. | 66 // TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS. |
| 54 const char kExtensionBlocklistUrlPrefix[] = | 67 const char kExtensionBlocklistUrlPrefix[] = |
| 55 "http://www.gstatic.com/chrome/extensions/blacklist"; | 68 "http://www.gstatic.com/chrome/extensions/blacklist"; |
| 56 const char kExtensionBlocklistHttpsUrlPrefix[] = | 69 const char kExtensionBlocklistHttpsUrlPrefix[] = |
| 57 "https://www.gstatic.com/chrome/extensions/blacklist"; | 70 "https://www.gstatic.com/chrome/extensions/blacklist"; |
| 58 | 71 |
| 59 GURL GetWebstoreUpdateUrl() { | 72 GURL GetWebstoreUpdateUrl() { |
| 60 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 73 CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 208 |
| 196 const int kScriptBadgeIconSizes[] = { | 209 const int kScriptBadgeIconSizes[] = { |
| 197 EXTENSION_ICON_BITTY, // 16 | 210 EXTENSION_ICON_BITTY, // 16 |
| 198 2 * EXTENSION_ICON_BITTY // 32 | 211 2 * EXTENSION_ICON_BITTY // 32 |
| 199 }; | 212 }; |
| 200 | 213 |
| 201 const size_t kNumScriptBadgeIconSizes = | 214 const size_t kNumScriptBadgeIconSizes = |
| 202 arraysize(kScriptBadgeIconSizes); | 215 arraysize(kScriptBadgeIconSizes); |
| 203 | 216 |
| 204 } // namespace extension_misc | 217 } // namespace extension_misc |
| OLD | NEW |