Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/common/extensions/extension_constants.cc

Issue 65163003: Move GetWebstoreLaunchURL and GetWebstoreItemDetailURLPrefix to extensions/common/extension_urls.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "net/base/escape.h"
13 #include "net/base/url_util.h"
14 12
15 namespace extension_urls { 13 namespace extension_urls {
16 14
17 std::string GetWebstoreLaunchURL() {
18 std::string gallery_prefix = kGalleryBrowsePrefix;
19 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsGalleryURL))
20 gallery_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
21 switches::kAppsGalleryURL);
22 if (EndsWith(gallery_prefix, "/", true))
23 gallery_prefix = gallery_prefix.substr(0, gallery_prefix.length() - 1);
24 return gallery_prefix;
25 }
26
27 std::string GetExtensionGalleryURL() {
28 return GetWebstoreLaunchURL() + "/category/extensions";
29 }
30
31 std::string GetWebstoreItemDetailURLPrefix() {
32 return GetWebstoreLaunchURL() + "/detail/";
33 }
34
35 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) {
36 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id);
37 }
38
39 GURL GetWebstoreJsonSearchUrl(const std::string& query, const std::string& hl) {
40 GURL url(GetWebstoreLaunchURL() + "/jsonsearch");
41 url = net::AppendQueryParameter(url, "q", query);
42 url = net::AppendQueryParameter(url, "hl", hl);
43 return url;
44 }
45
46 GURL GetWebstoreSearchPageUrl(const std::string& query) {
47 return GURL(GetWebstoreLaunchURL() + "/search/" +
48 net::EscapeQueryParamValue(query, false));
49 }
miket_OOO 2013/11/07 21:39:41 I kind of regret that these are now getting spraye
Yoyo Zhou 2013/11/08 02:03:09 These belong to, for example, the app list and/or
50
51 const char kGalleryUpdateHttpsUrl[] = 15 const char kGalleryUpdateHttpsUrl[] =
52 "https://clients2.google.com/service/update2/crx"; 16 "https://clients2.google.com/service/update2/crx";
53 // TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS. 17 // TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS.
54 const char kExtensionBlocklistUrlPrefix[] = 18 const char kExtensionBlocklistUrlPrefix[] =
55 "http://www.gstatic.com/chrome/extensions/blacklist"; 19 "http://www.gstatic.com/chrome/extensions/blacklist";
56 const char kExtensionBlocklistHttpsUrlPrefix[] = 20 const char kExtensionBlocklistHttpsUrlPrefix[] =
57 "https://www.gstatic.com/chrome/extensions/blacklist"; 21 "https://www.gstatic.com/chrome/extensions/blacklist";
58 22
59 GURL GetWebstoreUpdateUrl() { 23 GURL GetWebstoreUpdateUrl() {
60 CommandLine* cmdline = CommandLine::ForCurrentProcess(); 24 CommandLine* cmdline = CommandLine::ForCurrentProcess();
(...skipping 17 matching lines...) Expand all
78 // The extension blacklist URL is returned from the update service and 42 // The extension blacklist URL is returned from the update service and
79 // therefore not determined by Chromium. If the location of the blacklist file 43 // therefore not determined by Chromium. If the location of the blacklist file
80 // ever changes, we need to update this function. A DCHECK in the 44 // ever changes, we need to update this function. A DCHECK in the
81 // ExtensionUpdater ensures that we notice a change. This is the full URL 45 // ExtensionUpdater ensures that we notice a change. This is the full URL
82 // of a blacklist: 46 // of a blacklist:
83 // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt 47 // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt
84 return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) || 48 return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) ||
85 StartsWithASCII(url.spec(), kExtensionBlocklistHttpsUrlPrefix, true); 49 StartsWithASCII(url.spec(), kExtensionBlocklistHttpsUrlPrefix, true);
86 } 50 }
87 51
88 const char kGalleryBrowsePrefix[] = "https://chrome.google.com/webstore";
89
90 const char kWebstoreSourceField[] = "utm_source"; 52 const char kWebstoreSourceField[] = "utm_source";
91 53
92 const char kLaunchSourceAppList[] = "chrome-app-launcher"; 54 const char kLaunchSourceAppList[] = "chrome-app-launcher";
93 const char kLaunchSourceAppListSearch[] = "chrome-app-launcher-search"; 55 const char kLaunchSourceAppListSearch[] = "chrome-app-launcher-search";
94 56
95 } // namespace extension_urls 57 } // namespace extension_urls
96 58
97 namespace extension_misc { 59 namespace extension_misc {
98 60
99 const char kBookmarkManagerId[] = "eemcgdkfndhakfknompkggombfjjjeno"; 61 const char kBookmarkManagerId[] = "eemcgdkfndhakfknompkggombfjjjeno";
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 144
183 const int kScriptBadgeIconSizes[] = { 145 const int kScriptBadgeIconSizes[] = {
184 EXTENSION_ICON_BITTY, // 16 146 EXTENSION_ICON_BITTY, // 16
185 2 * EXTENSION_ICON_BITTY // 32 147 2 * EXTENSION_ICON_BITTY // 32
186 }; 148 };
187 149
188 const size_t kNumScriptBadgeIconSizes = 150 const size_t kNumScriptBadgeIconSizes =
189 arraysize(kScriptBadgeIconSizes); 151 arraysize(kScriptBadgeIconSizes);
190 152
191 } // namespace extension_misc 153 } // namespace extension_misc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698