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 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ |
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ | 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 // Returns the Update URL for this extension. | 33 // Returns the Update URL for this extension. |
34 static const GURL& GetUpdateURL(const Extension* extension); | 34 static const GURL& GetUpdateURL(const Extension* extension); |
35 | 35 |
36 // Returns true if this extension's update URL is the extension gallery. | 36 // Returns true if this extension's update URL is the extension gallery. |
37 static bool UpdatesFromGallery(const Extension* extension); | 37 static bool UpdatesFromGallery(const Extension* extension); |
38 static bool UpdatesFromGallery(const base::DictionaryValue* manifest); | 38 static bool UpdatesFromGallery(const base::DictionaryValue* manifest); |
39 | 39 |
40 // Returns the Options Page for this extension. | 40 // Returns the Options Page for this extension. |
41 static const GURL& GetOptionsPage(const Extension* extension); | 41 static const GURL& GetOptionsPage(const Extension* extension); |
42 | 42 |
| 43 // Returns the About Page for this extension. |
| 44 static const GURL& GetAboutPage(const Extension* extension); |
| 45 |
43 // Returns the webstore page URL for this extension. | 46 // Returns the webstore page URL for this extension. |
44 static const GURL GetDetailsURL(const Extension* extension); | 47 static const GURL GetDetailsURL(const Extension* extension); |
45 }; | 48 }; |
46 | 49 |
47 // A structure to hold the chrome URL overrides that may be specified | 50 // A structure to hold the chrome URL overrides that may be specified |
48 // in the manifest of an extension. | 51 // in the manifest of an extension. |
49 struct URLOverrides : public Extension::ManifestData { | 52 struct URLOverrides : public Extension::ManifestData { |
50 typedef std::map<const std::string, GURL> URLOverrideMap; | 53 typedef std::map<const std::string, GURL> URLOverrideMap; |
51 | 54 |
52 // Define out of line constructor/destructor to please Clang. | 55 // Define out of line constructor/destructor to please Clang. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 virtual bool Validate(const Extension* extension, | 116 virtual bool Validate(const Extension* extension, |
114 std::string* error, | 117 std::string* error, |
115 std::vector<InstallWarning>* warnings) const OVERRIDE; | 118 std::vector<InstallWarning>* warnings) const OVERRIDE; |
116 | 119 |
117 private: | 120 private: |
118 virtual const std::vector<std::string> Keys() const OVERRIDE; | 121 virtual const std::vector<std::string> Keys() const OVERRIDE; |
119 | 122 |
120 DISALLOW_COPY_AND_ASSIGN(OptionsPageHandler); | 123 DISALLOW_COPY_AND_ASSIGN(OptionsPageHandler); |
121 }; | 124 }; |
122 | 125 |
| 126 // Parses the "about_page" manifest key. |
| 127 // TODO(sashab): Make this and any other similar handlers extend from the same |
| 128 // abstract class, URLManifestHandler, which has pure virtual methods for |
| 129 // detecting the required URL type (relative or absolute) and abstracts the |
| 130 // URL parsing logic away. |
| 131 class AboutPageHandler : public ManifestHandler { |
| 132 public: |
| 133 AboutPageHandler(); |
| 134 virtual ~AboutPageHandler(); |
| 135 |
| 136 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; |
| 137 virtual bool Validate(const Extension* extension, |
| 138 std::string* error, |
| 139 std::vector<InstallWarning>* warnings) const OVERRIDE; |
| 140 |
| 141 private: |
| 142 virtual const std::vector<std::string> Keys() const OVERRIDE; |
| 143 |
| 144 DISALLOW_COPY_AND_ASSIGN(AboutPageHandler); |
| 145 }; |
| 146 |
123 // Parses the "chrome_url_overrides" manifest key. | 147 // Parses the "chrome_url_overrides" manifest key. |
124 class URLOverridesHandler : public ManifestHandler { | 148 class URLOverridesHandler : public ManifestHandler { |
125 public: | 149 public: |
126 URLOverridesHandler(); | 150 URLOverridesHandler(); |
127 virtual ~URLOverridesHandler(); | 151 virtual ~URLOverridesHandler(); |
128 | 152 |
129 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; | 153 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; |
130 | 154 |
131 private: | 155 private: |
132 virtual const std::vector<std::string> Keys() const OVERRIDE; | 156 virtual const std::vector<std::string> Keys() const OVERRIDE; |
133 | 157 |
134 DISALLOW_COPY_AND_ASSIGN(URLOverridesHandler); | 158 DISALLOW_COPY_AND_ASSIGN(URLOverridesHandler); |
135 }; | 159 }; |
136 | 160 |
137 } // namespace extensions | 161 } // namespace extensions |
138 | 162 |
139 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ | 163 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ |
OLD | NEW |