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 extern const char kChromeWebstoreBaseURL[]; |
| 36 extern const char kChromeWebstoreUpdateURL[]; |
| 37 |
| 38 // Returns the URL prefix for the extension/apps gallery. Can be set via the |
| 39 // --apps-gallery-url switch. The URL returned will not contain a trailing |
| 40 // slash. Do not use this as a prefix/extent for the store. |
| 41 std::string GetWebstoreLaunchURL(); |
| 42 |
| 43 // Returns the URL to the extensions category on the Web Store. This is |
| 44 // derived from GetWebstoreLaunchURL(). |
| 45 std::string GetWebstoreExtensionsCategoryURL(); |
| 46 |
| 47 // Returns the URL prefix for an item in the extension/app gallery. This URL |
| 48 // will contain a trailing slash and should be concatenated with an item ID |
| 49 // to get the item detail URL. |
| 50 std::string GetWebstoreItemDetailURLPrefix(); |
| 51 |
| 52 // Returns the URL used to get webstore data (ratings, manifest, icon URL, |
| 53 // etc.) about an extension from the webstore as JSON. |
| 54 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id); |
| 55 |
| 56 // Returns the URL used to get webstore search results in JSON format. The URL |
| 57 // returns a JSON dictionary that has the search results (under "results"). |
| 58 // Each entry in the array is a dictionary as the data returned for |
| 59 // GetWebstoreItemJsonDataURL above. |query| is the user typed query string. |
| 60 // |host_language_code| is the host language code, e.g. en_US. Both arguments |
| 61 // will be escaped and added as a query parameter to the returned web store |
| 62 // json search URL. |
| 63 GURL GetWebstoreJsonSearchUrl(const std::string& query, |
| 64 const std::string& host_language_code); |
| 65 |
| 66 // Returns the URL of the web store search results page for |query|. |
| 67 GURL GetWebstoreSearchPageUrl(const std::string& query); |
| 68 |
| 69 // Return the update URL used by gallery/webstore extensions/apps. This may |
| 70 // have been overridden by a command line flag for testing purposes. |
| 71 GURL GetWebstoreUpdateUrl(); |
| 72 |
| 73 // Returns whether the URL is the webstore update URL (just considering host |
| 74 // and path, not scheme, query, etc.) |
| 75 bool IsWebstoreUpdateUrl(const GURL& update_url); |
| 76 |
| 77 // Returns true if the URL points to an extension blacklist. |
| 78 bool IsBlacklistUpdateUrl(const GURL& url); |
| 79 |
| 80 } // namespace extension_urls |
| 81 |
26 #endif // EXTENSIONS_COMMON_EXTENSION_URLS_H_ | 82 #endif // EXTENSIONS_COMMON_EXTENSION_URLS_H_ |
OLD | NEW |