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.
5 #ifndef CHROME_COMMON_EXTENSIONS_API_PLUGINS_PLUGINS_HANDLER_H_
6 #define CHROME_COMMON_EXTENSIONS_API_PLUGINS_PLUGINS_HANDLER_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "extensions/common/extension.h"
12 #include "extensions/common/manifest_handler.h"
14 namespace extensions
{
16 // An NPAPI plugin included in the extension.
18 typedef std::vector
<PluginInfo
> PluginVector
;
20 PluginInfo(const base::FilePath
& plugin_path
, bool plugin_is_public
);
23 base::FilePath path
; // Path to the plugin.
24 bool is_public
; // False if only this extension can load this plugin.
26 // Return the plugins for a given |extensions|, or NULL if none exist.
27 static const PluginVector
* GetPlugins(const Extension
* extension
);
29 // Return true if the given |extension| has plugins, and false otherwise.
30 static bool HasPlugins(const Extension
* extension
);
33 // Parses the "plugins" manifest key.
34 class PluginsHandler
: public ManifestHandler
{
37 ~PluginsHandler() override
;
39 bool Parse(Extension
* extension
, base::string16
* error
) override
;
40 bool Validate(const Extension
* extension
,
42 std::vector
<InstallWarning
>* warnings
) const override
;
45 const std::vector
<std::string
> Keys() const override
;
47 DISALLOW_COPY_AND_ASSIGN(PluginsHandler
);
50 } // namespace extensions
52 #endif // CHROME_COMMON_EXTENSIONS_API_PLUGINS_PLUGINS_HANDLER_H_