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

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

Issue 11660016: Move the parsing of "chrome_url_overrides" out of Extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments addressed 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 }; 28 };
29 29
30 // A structure to hold the chrome URL overrides that may be specified
31 // in the manifest of an extension.
32 struct URLOverrides : public Extension::ManifestData {
33
Yoyo Zhou 2013/01/05 00:46:11 extraneous newline
Joe Thomas 2013/01/05 02:33:45 Removed
34 typedef std::map<const std::string, GURL> URLOverrideMap;
35
36 // Define out of line constructor/destructor to please Clang.
37 URLOverrides();
38 virtual ~URLOverrides();
39
40 static const URLOverrideMap*
41 GetChromeURLOverrides(const Extension* extension);
42
43 // A map of chrome:// hostnames (newtab, downloads, etc.) to Extension URLs
44 // which override the handling of those URLs. (see ExtensionOverrideUI).
45 URLOverrideMap chrome_url_overrides_;
46 };
47
30 // Parses the "devtools_page" manifest key. 48 // Parses the "devtools_page" manifest key.
31 class DevToolsPageHandler : public ManifestHandler { 49 class DevToolsPageHandler : public ManifestHandler {
32 public: 50 public:
33 DevToolsPageHandler(); 51 DevToolsPageHandler();
34 virtual ~DevToolsPageHandler(); 52 virtual ~DevToolsPageHandler();
35 53
36 virtual bool Parse(const base::Value* value, 54 virtual bool Parse(const base::Value* value,
37 Extension* extension, 55 Extension* extension,
38 string16* error) OVERRIDE; 56 string16* error) OVERRIDE;
39 }; 57 };
40 58
41 // Parses the "homepage_url" manifest key. 59 // Parses the "homepage_url" manifest key.
42 class HomepageURLHandler : public ManifestHandler { 60 class HomepageURLHandler : public ManifestHandler {
43 public: 61 public:
44 HomepageURLHandler(); 62 HomepageURLHandler();
45 virtual ~HomepageURLHandler(); 63 virtual ~HomepageURLHandler();
46 64
47 virtual bool Parse(const base::Value* value, 65 virtual bool Parse(const base::Value* value,
48 Extension* extension, 66 Extension* extension,
49 string16* error) OVERRIDE; 67 string16* error) OVERRIDE;
50 }; 68 };
51 69
70 // Parses the "chrome_url_overrides" manifest key.
71 class URLOverridesHandler : public ManifestHandler {
72 public:
73 URLOverridesHandler();
74 virtual ~URLOverridesHandler();
75
76 virtual bool Parse(const base::Value* value,
77 Extension* extension,
78 string16* error) OVERRIDE;
79 };
80
52 } // namespace extensions 81 } // namespace extensions
53 82
54 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_ 83 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_URL_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698