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. 4 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_ 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_ 7 8 #include <set> 9 #include <string> 10 #include <vector> 11 12 #include "extensions/common/extension.h" 13 #include "extensions/common/manifest_handler.h" 14 15 namespace extensions { 16 17 struct FileHandlerInfo { 18 FileHandlerInfo(); 19 ~FileHandlerInfo(); 20 21 // The id of this handler. 22 std::string id; 23 24 // File extensions associated with this handler. 25 std::set<std::string> extensions; 26 27 // MIME types associated with this handler. 28 std::set<std::string> types; 29 }; 30 31 typedef std::vector<FileHandlerInfo> FileHandlersInfo; 32 33 struct FileHandlers : public Extension::ManifestData { 34 FileHandlers(); 35 virtual ~FileHandlers(); 36 37 FileHandlersInfo file_handlers; 38 39 static const FileHandlersInfo* GetFileHandlers(const Extension* extension); 40 }; 41 42 // Parses the "file_handlers" manifest key. 43 class FileHandlersParser : public ManifestHandler { 44 public: 45 FileHandlersParser(); 46 virtual ~FileHandlersParser(); 47 48 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; 49 50 private: 51 virtual const std::vector<std::string> Keys() const OVERRIDE; 52 53 DISALLOW_COPY_AND_ASSIGN(FileHandlersParser); 54 }; 55 56 } // namespace extensions 57 58 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_ 59