rockot@chromium.org | aadde59 | 2014-04-08 18:48:52 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
rockot@chromium.org | aadde59 | 2014-04-08 18:48:52 | [diff] [blame] | 5 | #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLER_HELPERS_H_ |
| 6 | #define EXTENSIONS_COMMON_MANIFEST_HANDLER_HELPERS_H_ |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 7 | |
dcheng | 7c2ca35 | 2016-04-22 21:15:36 | [diff] [blame] | 8 | #include <memory> |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 9 | #include <string> |
David Bertoni | 1df6c53 | 2019-01-16 03:28:48 | [diff] [blame] | 10 | #include <vector> |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 11 | |
avi@chromium.org | d2e754f | 2013-06-11 01:41:47 | [diff] [blame] | 12 | #include "base/strings/string16.h" |
David Bertoni | 1df6c53 | 2019-01-16 03:28:48 | [diff] [blame] | 13 | #include "base/strings/string_piece.h" |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 14 | |
rdevlin.cronin@chromium.org | 4e78693 | 2013-03-25 19:21:04 | [diff] [blame] | 15 | class ExtensionIconSet; |
| 16 | |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 17 | namespace base { |
David Bertoni | 1df6c53 | 2019-01-16 03:28:48 | [diff] [blame] | 18 | class Value; |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 19 | } |
| 20 | |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 21 | namespace extensions { |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 22 | namespace manifest_handler_helpers { |
| 23 | |
David Bertoni | 1df6c53 | 2019-01-16 03:28:48 | [diff] [blame] | 24 | // Tokenize a dictionary path. |
| 25 | std::vector<base::StringPiece> TokenizeDictionaryPath(base::StringPiece path); |
| 26 | |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 27 | // Strips leading slashes from the file path. Returns true iff the final path is |
David Bertoni | 1df6c53 | 2019-01-16 03:28:48 | [diff] [blame] | 28 | // not empty. |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 29 | bool NormalizeAndValidatePath(std::string* path); |
David Bertoni | 1df6c53 | 2019-01-16 03:28:48 | [diff] [blame] | 30 | bool NormalizeAndValidatePath(const std::string& path, |
| 31 | std::string* normalized_path); |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 32 | |
| 33 | // Loads icon paths defined in dictionary |icons_value| into ExtensionIconSet |
estade | fd2986d | 2015-12-08 01:14:44 | [diff] [blame] | 34 | // |icons|. |icons_value| is a dictionary value {icon size -> icon path}. |
estade | 612db46 | 2016-01-05 22:14:32 | [diff] [blame] | 35 | // Returns success. If load fails, |error| will be set. |
David Bertoni | 1df6c53 | 2019-01-16 03:28:48 | [diff] [blame] | 36 | bool LoadIconsFromDictionary(const base::Value* icons_value, |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 37 | ExtensionIconSet* icons, |
Jan Wilken Dörrie | 85285b0 | 2021-03-11 23:38:47 | [diff] [blame^] | 38 | std::u16string* error); |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 39 | |
rdevlin.cronin@chromium.org | 23b3c0a | 2013-01-16 23:36:36 | [diff] [blame] | 40 | } // namespace manifest_handler_helpers |
| 41 | } // namespace extensions |
| 42 | |
rockot@chromium.org | aadde59 | 2014-04-08 18:48:52 | [diff] [blame] | 43 | #endif // EXTENSIONS_COMMON_MANIFEST_HANDLER_HELPERS_H_ |