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 19 matching lines...) Expand all Loading... |
30 // this returns a blank GURL. | 30 // this returns a blank GURL. |
31 static const GURL GetHomepageURL(const Extension* extension); | 31 static const GURL GetHomepageURL(const Extension* extension); |
32 | 32 |
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. | |
41 static const GURL& GetOptionsPage(const Extension* extension); | |
42 | |
43 // Returns the About Page for this extension. | 40 // Returns the About Page for this extension. |
44 static const GURL& GetAboutPage(const Extension* extension); | 41 static const GURL& GetAboutPage(const Extension* extension); |
45 | 42 |
46 // Returns the webstore page URL for this extension. | 43 // Returns the webstore page URL for this extension. |
47 static const GURL GetDetailsURL(const Extension* extension); | 44 static const GURL GetDetailsURL(const Extension* extension); |
48 }; | 45 }; |
49 | 46 |
50 // A structure to hold the chrome URL overrides that may be specified | 47 // A structure to hold the chrome URL overrides that may be specified |
51 // in the manifest of an extension. | 48 // in the manifest of an extension. |
52 struct URLOverrides : public Extension::ManifestData { | 49 struct URLOverrides : public Extension::ManifestData { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 virtual ~UpdateURLHandler(); | 96 virtual ~UpdateURLHandler(); |
100 | 97 |
101 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; | 98 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; |
102 | 99 |
103 private: | 100 private: |
104 virtual const std::vector<std::string> Keys() const OVERRIDE; | 101 virtual const std::vector<std::string> Keys() const OVERRIDE; |
105 | 102 |
106 DISALLOW_COPY_AND_ASSIGN(UpdateURLHandler); | 103 DISALLOW_COPY_AND_ASSIGN(UpdateURLHandler); |
107 }; | 104 }; |
108 | 105 |
109 // Parses the "options_page" manifest key. | |
110 class OptionsPageHandler : public ManifestHandler { | |
111 public: | |
112 OptionsPageHandler(); | |
113 virtual ~OptionsPageHandler(); | |
114 | |
115 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; | |
116 virtual bool Validate(const Extension* extension, | |
117 std::string* error, | |
118 std::vector<InstallWarning>* warnings) const OVERRIDE; | |
119 | |
120 private: | |
121 virtual const std::vector<std::string> Keys() const OVERRIDE; | |
122 | |
123 DISALLOW_COPY_AND_ASSIGN(OptionsPageHandler); | |
124 }; | |
125 | |
126 // Parses the "about_page" manifest key. | 106 // Parses the "about_page" manifest key. |
127 // TODO(sashab): Make this and any other similar handlers extend from the same | 107 // TODO(sashab): Make this and any other similar handlers extend from the same |
128 // abstract class, URLManifestHandler, which has pure virtual methods for | 108 // abstract class, URLManifestHandler, which has pure virtual methods for |
129 // detecting the required URL type (relative or absolute) and abstracts the | 109 // detecting the required URL type (relative or absolute) and abstracts the |
130 // URL parsing logic away. | 110 // URL parsing logic away. |
131 class AboutPageHandler : public ManifestHandler { | 111 class AboutPageHandler : public ManifestHandler { |
132 public: | 112 public: |
133 AboutPageHandler(); | 113 AboutPageHandler(); |
134 virtual ~AboutPageHandler(); | 114 virtual ~AboutPageHandler(); |
135 | 115 |
(...skipping 18 matching lines...) Expand all Loading... |
154 | 134 |
155 private: | 135 private: |
156 virtual const std::vector<std::string> Keys() const OVERRIDE; | 136 virtual const std::vector<std::string> Keys() const OVERRIDE; |
157 | 137 |
158 DISALLOW_COPY_AND_ASSIGN(URLOverridesHandler); | 138 DISALLOW_COPY_AND_ASSIGN(URLOverridesHandler); |
159 }; | 139 }; |
160 | 140 |
161 } // namespace extensions | 141 } // namespace extensions |
162 | 142 |
163 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ | 143 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ |
OLD | NEW |