1 // Copyright 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.
5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_SHARED_MODULE_INFO_H_
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_SHARED_MODULE_INFO_H_
11 #include "base/values.h"
12 #include "extensions/common/extension.h"
13 #include "extensions/common/manifest_handler.h"
15 namespace extensions
{
17 class SharedModuleInfo
: public Extension::ManifestData
{
20 virtual ~SharedModuleInfo();
22 bool Parse(const Extension
* extension
, string16
* error
);
25 std::string extension_id
;
26 std::string minimum_version
;
30 static void ParseImportedPath(const std::string
& path
,
31 std::string
* import_id
,
32 std::string
* import_relative_path
);
33 static bool IsImportedPath(const std::string
& path
);
35 // Functions relating to exporting resources.
36 static bool IsSharedModule(const Extension
* extension
);
37 static bool IsExportAllowed(const Extension
* extension
,
38 const std::string
& relative_path
);
40 // Functions relating to importing resources.
41 static bool ImportsExtensionById(const Extension
* extension
,
42 const std::string
& other_id
);
43 static bool ImportsModules(const Extension
* extension
);
44 static const std::vector
<ImportInfo
>& GetImports(const Extension
* extension
);
47 // This extension exports the following resources to other extensions.
48 URLPatternSet exported_set_
;
50 // Optional list of module imports of other extensions.
51 std::vector
<ImportInfo
> imports_
;
54 // Parses all import/export keys in the manifest.
55 class SharedModuleHandler
: public ManifestHandler
{
57 SharedModuleHandler();
58 virtual ~SharedModuleHandler();
60 virtual bool Parse(Extension
* extension
, string16
* error
) OVERRIDE
;
61 virtual bool Validate(const Extension
* extension
,
63 std::vector
<InstallWarning
>* warnings
) const OVERRIDE
;
66 virtual const std::vector
<std::string
> Keys() const OVERRIDE
;
69 } // namespace extensions
71 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_SHARED_MODULE_INFO_H_