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 // The title of this handler. 25 std::string title; 26 27 // File extensions associated with this handler. 28 std::set<std::string> extensions; 29 30 // MIME types associated with this handler. 31 std::set<std::string> types; 32 }; 33 34 typedef std::vector<FileHandlerInfo> FileHandlersInfo; 35 36 struct FileHandlers : public Extension::ManifestData { 37 FileHandlers(); 38 virtual ~FileHandlers(); 39 40 FileHandlersInfo file_handlers; 41 42 static const FileHandlersInfo* GetFileHandlers(const Extension* extension); 43 }; 44 45 // Parses the "file_handlers" manifest key. 46 class FileHandlersParser : public ManifestHandler { 47 public: 48 FileHandlersParser(); 49 virtual ~FileHandlersParser(); 50 51 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; 52 53 private: 54 virtual const std::vector<std::string> Keys() const OVERRIDE; 55 56 DISALLOW_COPY_AND_ASSIGN(FileHandlersParser); 57 }; 58 59 } // namespace extensions 60 61 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_ 62