| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/linked_app_icons.h" | 5 #include "chrome/common/extensions/manifest_handlers/linked_app_icons.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 const base::ListValue* icons_list = nullptr; | 63 const base::ListValue* icons_list = nullptr; |
| 64 if (extension->manifest()->Get(keys::kLinkedAppIcons, &icons_value)) { | 64 if (extension->manifest()->Get(keys::kLinkedAppIcons, &icons_value)) { |
| 65 if (!icons_value->GetAsList(&icons_list)) { | 65 if (!icons_value->GetAsList(&icons_list)) { |
| 66 *error = base::UTF8ToUTF16( | 66 *error = base::UTF8ToUTF16( |
| 67 extensions::manifest_errors::kInvalidLinkedAppIcons); | 67 extensions::manifest_errors::kInvalidLinkedAppIcons); |
| 68 return false; | 68 return false; |
| 69 } | 69 } |
| 70 | 70 |
| 71 for (const auto& icon_value : *icons_list) { | 71 for (const auto& icon_value : *icons_list) { |
| 72 const base::DictionaryValue* icon_dict = nullptr; | 72 const base::DictionaryValue* icon_dict = nullptr; |
| 73 if (!icon_value.GetAsDictionary(&icon_dict)) { | 73 if (!icon_value->GetAsDictionary(&icon_dict)) { |
| 74 *error = base::UTF8ToUTF16( | 74 *error = base::UTF8ToUTF16( |
| 75 extensions::manifest_errors::kInvalidLinkedAppIcon); | 75 extensions::manifest_errors::kInvalidLinkedAppIcon); |
| 76 return false; | 76 return false; |
| 77 } | 77 } |
| 78 | 78 |
| 79 std::string url_string; | 79 std::string url_string; |
| 80 if (!icon_dict->GetString(keys::kLinkedAppIconURL, &url_string)) { | 80 if (!icon_dict->GetString(keys::kLinkedAppIconURL, &url_string)) { |
| 81 *error = base::UTF8ToUTF16( | 81 *error = base::UTF8ToUTF16( |
| 82 extensions::manifest_errors::kInvalidLinkedAppIconURL); | 82 extensions::manifest_errors::kInvalidLinkedAppIconURL); |
| 83 return false; | 83 return false; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 104 extension->SetManifestData(keys::kLinkedAppIcons, | 104 extension->SetManifestData(keys::kLinkedAppIcons, |
| 105 std::move(linked_app_icons)); | 105 std::move(linked_app_icons)); |
| 106 return true; | 106 return true; |
| 107 } | 107 } |
| 108 | 108 |
| 109 const std::vector<std::string> LinkedAppIconsHandler::Keys() const { | 109 const std::vector<std::string> LinkedAppIconsHandler::Keys() const { |
| 110 return SingleKey(keys::kLinkedAppIcons); | 110 return SingleKey(keys::kLinkedAppIcons); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace extensions | 113 } // namespace extensions |
| OLD | NEW |