| 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" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 std::string path = GetIcons(extension).Get(size, match_type); | 66 std::string path = GetIcons(extension).Get(size, match_type); |
| 67 return path.empty() ? GURL() : extension->GetResourceURL(path); | 67 return path.empty() ? GURL() : extension->GetResourceURL(path); |
| 68 } | 68 } |
| 69 | 69 |
| 70 IconsHandler::IconsHandler() { | 70 IconsHandler::IconsHandler() { |
| 71 } | 71 } |
| 72 | 72 |
| 73 IconsHandler::~IconsHandler() { | 73 IconsHandler::~IconsHandler() { |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool IconsHandler::Parse(Extension* extension, string16* error) { | 76 bool IconsHandler::Parse(Extension* extension, base::string16* error) { |
| 77 scoped_ptr<IconsInfo> icons_info(new IconsInfo); | 77 scoped_ptr<IconsInfo> icons_info(new IconsInfo); |
| 78 const base::DictionaryValue* icons_dict = NULL; | 78 const base::DictionaryValue* icons_dict = NULL; |
| 79 if (!extension->manifest()->GetDictionary(keys::kIcons, &icons_dict)) { | 79 if (!extension->manifest()->GetDictionary(keys::kIcons, &icons_dict)) { |
| 80 *error = ASCIIToUTF16(manifest_errors::kInvalidIcons); | 80 *error = ASCIIToUTF16(manifest_errors::kInvalidIcons); |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 | 83 |
| 84 if (!manifest_handler_helpers::LoadIconsFromDictionary( | 84 if (!manifest_handler_helpers::LoadIconsFromDictionary( |
| 85 icons_dict, | 85 icons_dict, |
| 86 extension_misc::kExtensionIconSizes, | 86 extension_misc::kExtensionIconSizes, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 102 extension, | 102 extension, |
| 103 IDS_EXTENSION_LOAD_ICON_FAILED, | 103 IDS_EXTENSION_LOAD_ICON_FAILED, |
| 104 error); | 104 error); |
| 105 } | 105 } |
| 106 | 106 |
| 107 const std::vector<std::string> IconsHandler::Keys() const { | 107 const std::vector<std::string> IconsHandler::Keys() const { |
| 108 return SingleKey(keys::kIcons); | 108 return SingleKey(keys::kIcons); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace extensions | 111 } // namespace extensions |
| OLD | NEW |