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

Side by Side Diff: chrome/common/extensions/manifest_handlers/shared_module_info.h

Issue 13971005: Basic multi-module support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Factor out shared module into its own handler Created 7 years, 8 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_SHARED_MODULE_INFO_H_
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_SHARED_MODULE_INFO_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/values.h"
12 #include "chrome/common/extensions/extension.h"
13 #include "chrome/common/extensions/manifest_handler.h"
14
15 namespace extensions {
16
17 class SharedModuleInfo : public Extension::ManifestData {
18 public:
19 SharedModuleInfo();
20 virtual ~SharedModuleInfo();
21
22 bool Parse(const Extension* extension, string16* error);
23
24 struct ImportInfo {
25 std::string extension_id;
26 std::string minimum_version;
27 };
28
29 static void ParseImportedPath(const std::string& path,
30 std::string* import_id,
31 std::string* import_relative_path);
32 static bool IsImportedPath(const std::string& path);
33
34 static bool IsSharedModule(const Extension* extension);
35 static bool IsExportAllowed(const Extension* extension,
36 const std::string& relative_path);
37 static bool ImportsExtensionById(const Extension* extension,
38 const std::string& other_id);
39 static bool ImportsModules(const Extension* extension);
40 static const std::vector<ImportInfo>& GetImports(const Extension* extension);
41
42 private:
43 // This extension exports the following resources to other extensions.
44 URLPatternSet exported_set_;
45
46 // Optional list of module imports of other extensions.
47 std::vector<ImportInfo> imports_;
48 };
49
50 // Parses all import/export keys in the manifest.
51 class SharedModuleHandler : public ManifestHandler {
52 public:
53 SharedModuleHandler();
54 virtual ~SharedModuleHandler();
55
56 virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
57 virtual bool Validate(const Extension* extension,
58 std::string* error,
59 std::vector<InstallWarning>* warnings) const OVERRIDE;
60
61 private:
62 virtual const std::vector<std::string> Keys() const OVERRIDE;
63 };
64
65 } // namespace extensions
66
67 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_SHARED_MODULE_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698