OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 5 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
14 #include "chrome/common/extensions/extension_file_util.h" | 14 #include "chrome/common/extensions/extension_file_util.h" |
15 #include "chrome/common/extensions/extension_manifest_constants.h" | |
16 #include "chrome/common/extensions/manifest_handler_helpers.h" | 15 #include "chrome/common/extensions/manifest_handler_helpers.h" |
| 16 #include "extensions/common/manifest_constants.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
19 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
21 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
22 | 22 |
23 namespace extensions { | 23 namespace extensions { |
24 | 24 |
25 namespace keys = manifest_keys; | 25 namespace keys = manifest_keys; |
26 | 26 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 IconsHandler::IconsHandler() { | 69 IconsHandler::IconsHandler() { |
70 } | 70 } |
71 | 71 |
72 IconsHandler::~IconsHandler() { | 72 IconsHandler::~IconsHandler() { |
73 } | 73 } |
74 | 74 |
75 bool IconsHandler::Parse(Extension* extension, string16* error) { | 75 bool IconsHandler::Parse(Extension* extension, string16* error) { |
76 scoped_ptr<IconsInfo> icons_info(new IconsInfo); | 76 scoped_ptr<IconsInfo> icons_info(new IconsInfo); |
77 const base::DictionaryValue* icons_dict = NULL; | 77 const base::DictionaryValue* icons_dict = NULL; |
78 if (!extension->manifest()->GetDictionary(keys::kIcons, &icons_dict)) { | 78 if (!extension->manifest()->GetDictionary(keys::kIcons, &icons_dict)) { |
79 *error = ASCIIToUTF16(extension_manifest_errors::kInvalidIcons); | 79 *error = ASCIIToUTF16(manifest_errors::kInvalidIcons); |
80 return false; | 80 return false; |
81 } | 81 } |
82 | 82 |
83 if (!manifest_handler_helpers::LoadIconsFromDictionary( | 83 if (!manifest_handler_helpers::LoadIconsFromDictionary( |
84 icons_dict, | 84 icons_dict, |
85 extension_misc::kExtensionIconSizes, | 85 extension_misc::kExtensionIconSizes, |
86 extension_misc::kNumExtensionIconSizes, | 86 extension_misc::kNumExtensionIconSizes, |
87 &icons_info->icons, | 87 &icons_info->icons, |
88 error)) { | 88 error)) { |
89 return false; | 89 return false; |
(...skipping 11 matching lines...) Expand all Loading... |
101 extension, | 101 extension, |
102 IDS_EXTENSION_LOAD_ICON_FAILED, | 102 IDS_EXTENSION_LOAD_ICON_FAILED, |
103 error); | 103 error); |
104 } | 104 } |
105 | 105 |
106 const std::vector<std::string> IconsHandler::Keys() const { | 106 const std::vector<std::string> IconsHandler::Keys() const { |
107 return SingleKey(keys::kIcons); | 107 return SingleKey(keys::kIcons); |
108 } | 108 } |
109 | 109 |
110 } // namespace extensions | 110 } // namespace extensions |
OLD | NEW |