manifest_handler_helpers.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLER_HELPERS_H_
  5. #define EXTENSIONS_COMMON_MANIFEST_HANDLER_HELPERS_H_
  6. #include <memory>
  7. #include <string>
  8. #include <vector>
  9. #include "base/strings/string_piece.h"
  10. class ExtensionIconSet;
  11. namespace base {
  12. class Value;
  13. }
  14. namespace extensions {
  15. namespace manifest_handler_helpers {
  16. // Tokenize a dictionary path.
  17. std::vector<base::StringPiece> TokenizeDictionaryPath(base::StringPiece path);
  18. // Strips leading slashes from the file path. Returns true iff the final path is
  19. // not empty.
  20. bool NormalizeAndValidatePath(std::string* path);
  21. bool NormalizeAndValidatePath(const std::string& path,
  22. std::string* normalized_path);
  23. // Loads icon paths defined in dictionary |icons_value| into ExtensionIconSet
  24. // |icons|. |icons_value| is a dictionary value {icon size -> icon path}.
  25. // Returns success. If load fails, |error| will be set.
  26. bool LoadIconsFromDictionary(const base::Value* icons_value,
  27. ExtensionIconSet* icons,
  28. std::u16string* error);
  29. } // namespace manifest_handler_helpers
  30. } // namespace extensions
  31. #endif // EXTENSIONS_COMMON_MANIFEST_HANDLER_HELPERS_H_