Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / common / manifest_handlers / file_handler_info.h
blob02012fe150e0a58fdbcd7de2d4e914a3d26f8ba3
1 // Copyright 2014 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_FILE_HANDLER_INFO_H_
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "extensions/common/extension.h"
13 #include "extensions/common/manifest_handler.h"
15 namespace extensions {
17 struct FileHandlerInfo {
18 FileHandlerInfo();
19 ~FileHandlerInfo();
21 // The id of this handler.
22 std::string id;
24 // File extensions associated with this handler.
25 std::set<std::string> extensions;
27 // MIME types associated with this handler.
28 std::set<std::string> types;
31 typedef std::vector<FileHandlerInfo> FileHandlersInfo;
33 struct FileHandlers : public Extension::ManifestData {
34 FileHandlers();
35 ~FileHandlers() override;
37 FileHandlersInfo file_handlers;
39 static const FileHandlersInfo* GetFileHandlers(const Extension* extension);
42 // Parses the "file_handlers" manifest key.
43 class FileHandlersParser : public ManifestHandler {
44 public:
45 FileHandlersParser();
46 ~FileHandlersParser() override;
48 bool Parse(Extension* extension, base::string16* error) override;
50 private:
51 const std::vector<std::string> Keys() const override;
53 DISALLOW_COPY_AND_ASSIGN(FileHandlersParser);
56 } // namespace extensions
58 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_