OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef EXTENSIONS_COMMON_EXTENSION_URLS_H_ | 5 #ifndef EXTENSIONS_COMMON_EXTENSION_URLS_H_ |
6 #define EXTENSIONS_COMMON_EXTENSION_URLS_H_ | 6 #define EXTENSIONS_COMMON_EXTENSION_URLS_H_ |
7 | 7 |
8 #include <string> | |
9 | |
8 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
9 | 11 |
12 class GURL; | |
13 | |
10 namespace extensions { | 14 namespace extensions { |
11 | 15 |
12 // The name of the event_bindings module. | 16 // The name of the event_bindings module. |
13 extern const char kEventBindings[]; | 17 extern const char kEventBindings[]; |
14 | 18 |
15 // The name of the schemaUtils module. | 19 // The name of the schemaUtils module. |
16 extern const char kSchemaUtils[]; | 20 extern const char kSchemaUtils[]; |
17 | 21 |
18 // Determine whether or not a source came from an extension. |source| can link | 22 // Determine whether or not a source came from an extension. |source| can link |
19 // to a page or a script, and can be external (e.g., "http://www.google.com"), | 23 // to a page or a script, and can be external (e.g., "http://www.google.com"), |
20 // extension-related (e.g., "chrome-extension://<extension_id>/background.js"), | 24 // extension-related (e.g., "chrome-extension://<extension_id>/background.js"), |
21 // or internal (e.g., "event_bindings" or "schemaUtils"). | 25 // or internal (e.g., "event_bindings" or "schemaUtils"). |
22 bool IsSourceFromAnExtension(const base::string16& source); | 26 bool IsSourceFromAnExtension(const base::string16& source); |
23 | 27 |
24 } // namespace extensions | 28 } // namespace extensions |
25 | 29 |
30 namespace extension_urls { | |
31 | |
32 // Canonical URLs for the Chrome Webstore. You probably want to use one of | |
33 // the calls below rather than using one of these constants directly, since | |
34 // the active extensions embedder may provide its own webstore URLs. | |
35 const char kChromeWebstoreBaseURL[] = "https://chrome.google.com/webstore"; | |
36 const char kChromeWebstoreUpdateURL[] = | |
37 "https://clients2.google.com/service/update2/crx"; | |
asargent_no_longer_on_chrome
2014/09/17 22:24:37
as mentioned in person, make sure to move definiti
| |
38 | |
39 // Returns the URL prefix for the extension/apps gallery. Can be set via the | |
40 // --apps-gallery-url switch. The URL returned will not contain a trailing | |
41 // slash. Do not use this as a prefix/extent for the store. | |
42 std::string GetWebstoreLaunchURL(); | |
43 | |
44 // Returns the URL to the extensions category on the Web Store. This is | |
45 // derived from GetWebstoreLaunchURL(). | |
46 std::string GetWebstoreExtensionsCategoryURL(); | |
47 | |
48 // Returns the URL prefix for an item in the extension/app gallery. This URL | |
49 // will contain a trailing slash and should be concatenated with an item ID | |
50 // to get the item detail URL. | |
51 std::string GetWebstoreItemDetailURLPrefix(); | |
52 | |
53 // Returns the URL used to get webstore data (ratings, manifest, icon URL, | |
54 // etc.) about an extension from the webstore as JSON. | |
55 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id); | |
56 | |
57 // Returns the URL used to get webstore search results in JSON format. The URL | |
58 // returns a JSON dictionary that has the search results (under "results"). | |
59 // Each entry in the array is a dictionary as the data returned for | |
60 // GetWebstoreItemJsonDataURL above. |query| is the user typed query string. | |
61 // |host_language_code| is the host language code, e.g. en_US. Both arguments | |
62 // will be escaped and added as a query parameter to the returned web store | |
63 // json search URL. | |
64 GURL GetWebstoreJsonSearchUrl(const std::string& query, | |
65 const std::string& host_language_code); | |
66 | |
67 // Returns the URL of the web store search results page for |query|. | |
68 GURL GetWebstoreSearchPageUrl(const std::string& query); | |
69 | |
70 // Return the update URL used by gallery/webstore extensions/apps. This may | |
71 // have been overridden by a command line flag for testing purposes. | |
72 GURL GetWebstoreUpdateUrl(); | |
73 | |
74 // Returns whether the URL is the webstore update URL (just considering host | |
75 // and path, not scheme, query, etc.) | |
76 bool IsWebstoreUpdateUrl(const GURL& update_url); | |
77 | |
78 // Returns true if the URL points to an extension blacklist. | |
79 bool IsBlacklistUpdateUrl(const GURL& url); | |
80 | |
81 } // namespace extension_urls | |
82 | |
26 #endif // EXTENSIONS_COMMON_EXTENSION_URLS_H_ | 83 #endif // EXTENSIONS_COMMON_EXTENSION_URLS_H_ |
OLD | NEW |