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