Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/common/extensions/manifest_url_handler.h

Issue 11726002: Move the parsing of 'update_url' & 'options_page' URLs out of Extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url_parse
Patch Set: fixed HomepageURLManifestTest.GetHomepageURL Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
11 #include "chrome/common/extensions/manifest_handler.h" 11 #include "chrome/common/extensions/manifest_handler.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 // A structure to hold various URLs like devtools_page, homepage_url, etc 15 // A structure to hold various URLs like devtools_page, homepage_url, etc
16 // that may be specified in the manifest of an extension. 16 // that may be specified in the manifest of an extension.
17 struct ManifestURL : public Extension::ManifestData { 17 struct ManifestURL : public Extension::ManifestData {
18 GURL url_; 18 GURL url_;
19 19
20 // Returns the DevTools Page for this extension. 20 // Returns the DevTools Page for this extension.
21 static const GURL& GetDevToolsPage(const Extension* extension); 21 static const GURL& GetDevToolsPage(const Extension* extension);
22 22
23 // Returns the Homepage URL for this extension. 23 // Returns the Homepage URL for this extension.
24 // If homepage_url was not specified in the manifest, 24 // If homepage_url was not specified in the manifest,
25 // this returns the Google Gallery URL. For third-party extensions, 25 // this returns the Google Gallery URL. For third-party extensions,
26 // this returns a blank GURL. 26 // this returns a blank GURL.
27 static const GURL GetHomepageURL(const Extension* extension); 27 static const GURL GetHomepageURL(const Extension* extension);
28
29 // Returns the Update URL for this extension.
30 static const GURL& GetUpdateURL(const Extension* extension);
31
32 // Returns the Options Page for this extension.
33 static const GURL& GetOptionsPage(const Extension* extension);
28 }; 34 };
29 35
30 // A structure to hold the chrome URL overrides that may be specified 36 // A structure to hold the chrome URL overrides that may be specified
31 // in the manifest of an extension. 37 // in the manifest of an extension.
32 struct URLOverrides : public Extension::ManifestData { 38 struct URLOverrides : public Extension::ManifestData {
33 typedef std::map<const std::string, GURL> URLOverrideMap; 39 typedef std::map<const std::string, GURL> URLOverrideMap;
34 40
35 // Define out of line constructor/destructor to please Clang. 41 // Define out of line constructor/destructor to please Clang.
36 URLOverrides(); 42 URLOverrides();
37 virtual ~URLOverrides(); 43 virtual ~URLOverrides();
(...skipping 21 matching lines...) Expand all
59 class HomepageURLHandler : public ManifestHandler { 65 class HomepageURLHandler : public ManifestHandler {
60 public: 66 public:
61 HomepageURLHandler(); 67 HomepageURLHandler();
62 virtual ~HomepageURLHandler(); 68 virtual ~HomepageURLHandler();
63 69
64 virtual bool Parse(const base::Value* value, 70 virtual bool Parse(const base::Value* value,
65 Extension* extension, 71 Extension* extension,
66 string16* error) OVERRIDE; 72 string16* error) OVERRIDE;
67 }; 73 };
68 74
75 // Parses the "update_url" manifest key.
76 class UpdateURLHandler : public ManifestHandler {
77 public:
78 UpdateURLHandler();
79 virtual ~UpdateURLHandler();
80
81 virtual bool Parse(const base::Value* value,
82 Extension* extension,
83 string16* error) OVERRIDE;
84 };
85
86 // Parses the "options_page" manifest key.
87 class OptionsPageHandler : public ManifestHandler {
88 public:
89 OptionsPageHandler();
90 virtual ~OptionsPageHandler();
91
92 virtual bool Parse(const base::Value* value,
93 Extension* extension,
94 string16* error) OVERRIDE;
95 };
96
69 // Parses the "chrome_url_overrides" manifest key. 97 // Parses the "chrome_url_overrides" manifest key.
70 class URLOverridesHandler : public ManifestHandler { 98 class URLOverridesHandler : public ManifestHandler {
71 public: 99 public:
72 URLOverridesHandler(); 100 URLOverridesHandler();
73 virtual ~URLOverridesHandler(); 101 virtual ~URLOverridesHandler();
74 102
75 virtual bool Parse(const base::Value* value, 103 virtual bool Parse(const base::Value* value,
76 Extension* extension, 104 Extension* extension,
77 string16* error) OVERRIDE; 105 string16* error) OVERRIDE;
78 }; 106 };
79 107
80 } // namespace extensions 108 } // namespace extensions
81 109
82 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ 110 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698