Migrate to github hosting of CLD2 project.
[chromium-blink-merge.git] / extensions / common / extension_urls.h
blob2fd72c8cf3cb7effbd7fb84afc7855fb44815a10
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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_COMMON_EXTENSION_URLS_H_
6 #define EXTENSIONS_COMMON_EXTENSION_URLS_H_
8 #include <string>
10 #include "base/strings/string16.h"
12 class GURL;
14 namespace extensions {
16 // The name of the event_bindings module.
17 extern const char kEventBindings[];
19 // The name of the schemaUtils module.
20 extern const char kSchemaUtils[];
22 // Determine whether or not a source came from an extension. |source| can link
23 // to a page or a script, and can be external (e.g., "http://www.google.com"),
24 // extension-related (e.g., "chrome-extension://<extension_id>/background.js"),
25 // or internal (e.g., "event_bindings" or "schemaUtils").
26 bool IsSourceFromAnExtension(const base::string16& source);
28 } // namespace extensions
30 namespace extension_urls {
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[];
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();
43 // Returns the URL to the extensions category on the Web Store. This is
44 // derived from GetWebstoreLaunchURL().
45 std::string GetWebstoreExtensionsCategoryURL();
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();
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);
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);
66 // Returns the URL of the web store search results page for |query|.
67 GURL GetWebstoreSearchPageUrl(const std::string& query);
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();
73 // Returns the url to visit to report abuse for the given |extension_id|
74 // and |referrer_id|.
75 GURL GetWebstoreReportAbuseUrl(const std::string& extension_id,
76 const std::string& referrer_id);
78 // Returns whether the URL is the webstore update URL (just considering host
79 // and path, not scheme, query, etc.)
80 bool IsWebstoreUpdateUrl(const GURL& update_url);
82 // Returns true if the URL points to an extension blacklist.
83 bool IsBlacklistUpdateUrl(const GURL& url);
85 } // namespace extension_urls
87 #endif // EXTENSIONS_COMMON_EXTENSION_URLS_H_