| 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 23 matching lines...) Expand all Loading... |
| 34 // manifest. | 34 // manifest. |
| 35 static bool SpecifiedHomepageURL(const Extension* extension); | 35 static bool SpecifiedHomepageURL(const Extension* extension); |
| 36 | 36 |
| 37 // Returns the Update URL for this extension. | 37 // Returns the Update URL for this extension. |
| 38 static const GURL& GetUpdateURL(const Extension* extension); | 38 static const GURL& GetUpdateURL(const Extension* extension); |
| 39 | 39 |
| 40 // Returns true if this extension's update URL is the extension gallery. | 40 // Returns true if this extension's update URL is the extension gallery. |
| 41 static bool UpdatesFromGallery(const Extension* extension); | 41 static bool UpdatesFromGallery(const Extension* extension); |
| 42 static bool UpdatesFromGallery(const base::DictionaryValue* manifest); | 42 static bool UpdatesFromGallery(const base::DictionaryValue* manifest); |
| 43 | 43 |
| 44 // Returns the Options Page for this extension. | |
| 45 static const GURL& GetOptionsPage(const Extension* extension); | |
| 46 | |
| 47 // Returns the About Page for this extension. | 44 // Returns the About Page for this extension. |
| 48 static const GURL& GetAboutPage(const Extension* extension); | 45 static const GURL& GetAboutPage(const Extension* extension); |
| 49 | 46 |
| 50 // Returns the webstore page URL for this extension. | 47 // Returns the webstore page URL for this extension. |
| 51 static const GURL GetDetailsURL(const Extension* extension); | 48 static const GURL GetDetailsURL(const Extension* extension); |
| 52 }; | 49 }; |
| 53 | 50 |
| 54 // A structure to hold the chrome URL overrides that may be specified | 51 // A structure to hold the chrome URL overrides that may be specified |
| 55 // in the manifest of an extension. | 52 // in the manifest of an extension. |
| 56 struct URLOverrides : public Extension::ManifestData { | 53 struct URLOverrides : public Extension::ManifestData { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 virtual ~UpdateURLHandler(); | 100 virtual ~UpdateURLHandler(); |
| 104 | 101 |
| 105 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; | 102 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; |
| 106 | 103 |
| 107 private: | 104 private: |
| 108 virtual const std::vector<std::string> Keys() const OVERRIDE; | 105 virtual const std::vector<std::string> Keys() const OVERRIDE; |
| 109 | 106 |
| 110 DISALLOW_COPY_AND_ASSIGN(UpdateURLHandler); | 107 DISALLOW_COPY_AND_ASSIGN(UpdateURLHandler); |
| 111 }; | 108 }; |
| 112 | 109 |
| 113 // Parses the "options_page" manifest key. | |
| 114 class OptionsPageHandler : public ManifestHandler { | |
| 115 public: | |
| 116 OptionsPageHandler(); | |
| 117 virtual ~OptionsPageHandler(); | |
| 118 | |
| 119 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; | |
| 120 virtual bool Validate(const Extension* extension, | |
| 121 std::string* error, | |
| 122 std::vector<InstallWarning>* warnings) const OVERRIDE; | |
| 123 | |
| 124 private: | |
| 125 virtual const std::vector<std::string> Keys() const OVERRIDE; | |
| 126 | |
| 127 DISALLOW_COPY_AND_ASSIGN(OptionsPageHandler); | |
| 128 }; | |
| 129 | |
| 130 // Parses the "about_page" manifest key. | 110 // Parses the "about_page" manifest key. |
| 131 // TODO(sashab): Make this and any other similar handlers extend from the same | 111 // TODO(sashab): Make this and any other similar handlers extend from the same |
| 132 // abstract class, URLManifestHandler, which has pure virtual methods for | 112 // abstract class, URLManifestHandler, which has pure virtual methods for |
| 133 // detecting the required URL type (relative or absolute) and abstracts the | 113 // detecting the required URL type (relative or absolute) and abstracts the |
| 134 // URL parsing logic away. | 114 // URL parsing logic away. |
| 135 class AboutPageHandler : public ManifestHandler { | 115 class AboutPageHandler : public ManifestHandler { |
| 136 public: | 116 public: |
| 137 AboutPageHandler(); | 117 AboutPageHandler(); |
| 138 virtual ~AboutPageHandler(); | 118 virtual ~AboutPageHandler(); |
| 139 | 119 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 158 | 138 |
| 159 private: | 139 private: |
| 160 virtual const std::vector<std::string> Keys() const OVERRIDE; | 140 virtual const std::vector<std::string> Keys() const OVERRIDE; |
| 161 | 141 |
| 162 DISALLOW_COPY_AND_ASSIGN(URLOverridesHandler); | 142 DISALLOW_COPY_AND_ASSIGN(URLOverridesHandler); |
| 163 }; | 143 }; |
| 164 | 144 |
| 165 } // namespace extensions | 145 } // namespace extensions |
| 166 | 146 |
| 167 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ | 147 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ |
| OLD | NEW |