| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "extensions/common/manifest_handlers/icons_handler.h" | 5 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 | 23 |
| 24 namespace keys = manifest_keys; | 24 namespace keys = manifest_keys; |
| 25 | 25 |
| 26 static base::LazyInstance<ExtensionIconSet>::DestructorAtExit g_empty_icon_set = | 26 static base::LazyInstance<ExtensionIconSet>::DestructorAtExit g_empty_icon_set = |
| 27 LAZY_INSTANCE_INITIALIZER; | 27 LAZY_INSTANCE_INITIALIZER; |
| 28 | 28 |
| 29 // static | 29 // static |
| 30 const ExtensionIconSet& IconsInfo::GetIcons(const Extension* extension) { | 30 const ExtensionIconSet& IconsInfo::GetIcons(const Extension* extension) { |
| 31 DCHECK(extension); |
| 31 IconsInfo* info = static_cast<IconsInfo*>( | 32 IconsInfo* info = static_cast<IconsInfo*>( |
| 32 extension->GetManifestData(keys::kIcons)); | 33 extension->GetManifestData(keys::kIcons)); |
| 33 return info ? info->icons : g_empty_icon_set.Get(); | 34 return info ? info->icons : g_empty_icon_set.Get(); |
| 34 } | 35 } |
| 35 | 36 |
| 36 // static | 37 // static |
| 37 ExtensionResource IconsInfo::GetIconResource( | 38 ExtensionResource IconsInfo::GetIconResource( |
| 38 const Extension* extension, | 39 const Extension* extension, |
| 39 int size, | 40 int size, |
| 40 ExtensionIconSet::MatchType match_type) { | 41 ExtensionIconSet::MatchType match_type) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 extension, | 81 extension, |
| 81 IDS_EXTENSION_LOAD_ICON_FAILED, | 82 IDS_EXTENSION_LOAD_ICON_FAILED, |
| 82 error); | 83 error); |
| 83 } | 84 } |
| 84 | 85 |
| 85 const std::vector<std::string> IconsHandler::Keys() const { | 86 const std::vector<std::string> IconsHandler::Keys() const { |
| 86 return SingleKey(keys::kIcons); | 87 return SingleKey(keys::kIcons); |
| 87 } | 88 } |
| 88 | 89 |
| 89 } // namespace extensions | 90 } // namespace extensions |
| OLD | NEW |