Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / extensions / common / manifest_handler_helpers.h
blob01fe6ccf55073fff426bc1f3b7896d0d23a1ad23
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.
5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLER_HELPERS_H_
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLER_HELPERS_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/string16.h"
13 class ExtensionIconSet;
15 namespace base {
16 class DictionaryValue;
19 namespace extensions {
20 namespace manifest_handler_helpers {
22 // Strips leading slashes from the file path. Returns true iff the final path is
23 // non empty.
24 bool NormalizeAndValidatePath(std::string* path);
26 // Loads icon paths defined in dictionary |icons_value| into ExtensionIconSet
27 // |icons|. |icons_value| is a dictionary value {icon size -> icon path}. Icons
28 // in |icons_value| whose size is not in |icon_sizes| will be ignored.
29 // Returns success. If load fails, |error| will be set.
30 bool LoadIconsFromDictionary(const base::DictionaryValue* icons_value,
31 const int* icon_sizes,
32 size_t num_icon_sizes,
33 ExtensionIconSet* icons,
34 base::string16* error);
36 } // namespace manifest_handler_helpers
37 } // namespace extensions
39 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLER_HELPERS_H_