| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_ | 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_ |
| 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_ | 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 std::string id; | 24 std::string id; |
| 25 | 25 |
| 26 // File extensions associated with this handler. | 26 // File extensions associated with this handler. |
| 27 std::set<std::string> extensions; | 27 std::set<std::string> extensions; |
| 28 | 28 |
| 29 // MIME types associated with this handler. | 29 // MIME types associated with this handler. |
| 30 std::set<std::string> types; | 30 std::set<std::string> types; |
| 31 | 31 |
| 32 // True if the handler can manage directories. | 32 // True if the handler can manage directories. |
| 33 bool include_directories; | 33 bool include_directories; |
| 34 |
| 35 // A verb describing the intent of the handler. |
| 36 std::string verb; |
| 34 }; | 37 }; |
| 35 | 38 |
| 36 typedef std::vector<FileHandlerInfo> FileHandlersInfo; | 39 typedef std::vector<FileHandlerInfo> FileHandlersInfo; |
| 37 | 40 |
| 38 struct FileHandlers : public Extension::ManifestData { | 41 struct FileHandlers : public Extension::ManifestData { |
| 39 FileHandlers(); | 42 FileHandlers(); |
| 40 ~FileHandlers() override; | 43 ~FileHandlers() override; |
| 41 | 44 |
| 42 FileHandlersInfo file_handlers; | 45 FileHandlersInfo file_handlers; |
| 43 | 46 |
| 44 static const FileHandlersInfo* GetFileHandlers(const Extension* extension); | 47 static const FileHandlersInfo* GetFileHandlers(const Extension* extension); |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 // Parses the "file_handlers" manifest key. | 50 // Parses the "file_handlers" manifest key. |
| 48 class FileHandlersParser : public ManifestHandler { | 51 class FileHandlersParser : public ManifestHandler { |
| 49 public: | 52 public: |
| 50 FileHandlersParser(); | 53 FileHandlersParser(); |
| 51 ~FileHandlersParser() override; | 54 ~FileHandlersParser() override; |
| 52 | 55 |
| 53 bool Parse(Extension* extension, base::string16* error) override; | 56 bool Parse(Extension* extension, base::string16* error) override; |
| 54 | 57 |
| 55 private: | 58 private: |
| 56 const std::vector<std::string> Keys() const override; | 59 const std::vector<std::string> Keys() const override; |
| 57 | 60 |
| 58 DISALLOW_COPY_AND_ASSIGN(FileHandlersParser); | 61 DISALLOW_COPY_AND_ASSIGN(FileHandlersParser); |
| 59 }; | 62 }; |
| 60 | 63 |
| 64 namespace file_handler_verbs { |
| 65 |
| 66 // Supported verbs for file handlers. |
| 67 extern const char kOpenWith[]; |
| 68 extern const char kAddTo[]; |
| 69 extern const char kPackWith[]; |
| 70 extern const char kShareWith[]; |
| 71 |
| 72 } // namespace file_handler_verbs |
| 73 |
| 61 } // namespace extensions | 74 } // namespace extensions |
| 62 | 75 |
| 63 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_ | 76 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_FILE_HANDLER_INFO_H_ |
| OLD | NEW |