Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_API_PLUGINS_PLUGINS_HANDLER_H_ | 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_PLUGINS_HANDLER_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_API_PLUGINS_PLUGINS_HANDLER_H_ | 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_PLUGINS_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
| 13 #include "extensions/common/manifest_handler.h" | 13 #include "extensions/common/manifest_handler.h" |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 // An NPAPI plugin included in the extension. | 17 // An NPAPI plugin included in the extension. |
| 18 struct PluginInfo { | 18 struct PluginInfo { |
| 19 typedef std::vector<PluginInfo> PluginVector; | 19 typedef std::vector<PluginInfo> PluginVector; |
| 20 | 20 |
| 21 PluginInfo(const base::FilePath& plugin_path, bool plugin_is_public); | 21 PluginInfo(const base::FilePath& plugin_path, bool plugin_is_public); |
| 22 ~PluginInfo(); | 22 ~PluginInfo(); |
| 23 | 23 |
| 24 base::FilePath path; // Path to the plugin. | 24 base::FilePath path; // Path to the plugin. |
| 25 bool is_public; // False if only this extension can load this plugin. | 25 bool is_public; // False if only this extension can load this plugin. |
|
michaelpg
2017/03/30 22:49:01
git cl format ¯\_(ツ)_/¯
| |
| 26 | 26 |
| 27 // Return the plugins for a given |extensions|, or NULL if none exist. | 27 // Return the plugins for a given |extensions|, or NULL if none exist. |
| 28 static const PluginVector* GetPlugins(const Extension* extension); | 28 static const PluginVector* GetPlugins(const Extension* extension); |
| 29 | 29 |
| 30 // Return true if the given |extension| has plugins, and false otherwise. | 30 // Return true if the given |extension| has plugins, and false otherwise. |
| 31 static bool HasPlugins(const Extension* extension); | 31 static bool HasPlugins(const Extension* extension); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // Parses the "plugins" manifest key. | 34 // Parses the "plugins" manifest key. |
| 35 class PluginsHandler : public ManifestHandler { | 35 class PluginsHandler : public ManifestHandler { |
| 36 public: | 36 public: |
| 37 PluginsHandler(); | 37 PluginsHandler(); |
| 38 ~PluginsHandler() override; | 38 ~PluginsHandler() override; |
| 39 | 39 |
| 40 bool Parse(Extension* extension, base::string16* error) override; | 40 bool Parse(Extension* extension, base::string16* error) override; |
| 41 bool Validate(const Extension* extension, | 41 bool Validate(const Extension* extension, |
| 42 std::string* error, | 42 std::string* error, |
| 43 std::vector<InstallWarning>* warnings) const override; | 43 std::vector<InstallWarning>* warnings) const override; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 const std::vector<std::string> Keys() const override; | 46 const std::vector<std::string> Keys() const override; |
| 47 | 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(PluginsHandler); | 48 DISALLOW_COPY_AND_ASSIGN(PluginsHandler); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace extensions | 51 } // namespace extensions |
| 52 | 52 |
| 53 #endif // CHROME_COMMON_EXTENSIONS_API_PLUGINS_PLUGINS_HANDLER_H_ | 53 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_PLUGINS_HANDLER_H_ |
| OLD | NEW |