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 "chrome/common/net/url_util.h" | 13 #include "net/base/url_util.h" |
14 | 14 |
15 namespace extension_urls { | 15 namespace extension_urls { |
16 | 16 |
17 std::string GetWebstoreLaunchURL() { | 17 std::string GetWebstoreLaunchURL() { |
18 std::string gallery_prefix = kGalleryBrowsePrefix; | 18 std::string gallery_prefix = kGalleryBrowsePrefix; |
19 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsGalleryURL)) | 19 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAppsGalleryURL)) |
20 gallery_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 20 gallery_prefix = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
21 switches::kAppsGalleryURL); | 21 switches::kAppsGalleryURL); |
22 if (EndsWith(gallery_prefix, "/", true)) | 22 if (EndsWith(gallery_prefix, "/", true)) |
23 gallery_prefix = gallery_prefix.substr(0, gallery_prefix.length() - 1); | 23 gallery_prefix = gallery_prefix.substr(0, gallery_prefix.length() - 1); |
24 return gallery_prefix; | 24 return gallery_prefix; |
25 } | 25 } |
26 | 26 |
27 std::string GetExtensionGalleryURL() { | 27 std::string GetExtensionGalleryURL() { |
28 return GetWebstoreLaunchURL() + "/category/extensions"; | 28 return GetWebstoreLaunchURL() + "/category/extensions"; |
29 } | 29 } |
30 | 30 |
31 std::string GetWebstoreItemDetailURLPrefix() { | 31 std::string GetWebstoreItemDetailURLPrefix() { |
32 return GetWebstoreLaunchURL() + "/detail/"; | 32 return GetWebstoreLaunchURL() + "/detail/"; |
33 } | 33 } |
34 | 34 |
35 GURL GetWebstoreIntentQueryURL(const std::string& action, | 35 GURL GetWebstoreIntentQueryURL(const std::string& action, |
36 const std::string& type) { | 36 const std::string& type) { |
37 const char kIntentsCategoryPath[] = "category/collection/webintent_apps"; | 37 const char kIntentsCategoryPath[] = "category/collection/webintent_apps"; |
38 | 38 |
39 GURL url(std::string(kGalleryBrowsePrefix) + "/"); | 39 GURL url(std::string(kGalleryBrowsePrefix) + "/"); |
40 url = url.Resolve(kIntentsCategoryPath); | 40 url = url.Resolve(kIntentsCategoryPath); |
41 url = chrome_common_net::AppendQueryParameter(url, "_wi", action); | 41 url = net::AppendQueryParameter(url, "_wi", action); |
42 url = chrome_common_net::AppendQueryParameter(url, "_mt", type); | 42 url = net::AppendQueryParameter(url, "_mt", type); |
43 | 43 |
44 return url; | 44 return url; |
45 } | 45 } |
46 | 46 |
47 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) { | 47 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) { |
48 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id); | 48 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id); |
49 } | 49 } |
50 | 50 |
51 const char kGalleryUpdateHttpsUrl[] = | 51 const char kGalleryUpdateHttpsUrl[] = |
52 "https://clients2.google.com/service/update2/crx"; | 52 "https://clients2.google.com/service/update2/crx"; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 const int kScriptBadgeIconSizes[] = { | 181 const int kScriptBadgeIconSizes[] = { |
182 EXTENSION_ICON_BITTY, // 16 | 182 EXTENSION_ICON_BITTY, // 16 |
183 2 * EXTENSION_ICON_BITTY // 32 | 183 2 * EXTENSION_ICON_BITTY // 32 |
184 }; | 184 }; |
185 | 185 |
186 const size_t kNumScriptBadgeIconSizes = | 186 const size_t kNumScriptBadgeIconSizes = |
187 arraysize(kScriptBadgeIconSizes); | 187 arraysize(kScriptBadgeIconSizes); |
188 | 188 |
189 } // namespace extension_misc | 189 } // namespace extension_misc |
OLD | NEW |