| 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> |
| 8 |
| 7 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/values.h" | 11 #include "base/values.h" |
| 10 #include "extensions/common/manifest.h" | 12 #include "extensions/common/manifest.h" |
| 11 #include "extensions/common/manifest_constants.h" | 13 #include "extensions/common/manifest_constants.h" |
| 12 | 14 |
| 13 namespace extensions { | 15 namespace extensions { |
| 14 | 16 |
| 15 namespace keys = manifest_keys; | 17 namespace keys = manifest_keys; |
| 16 namespace errors = manifest_errors; | 18 namespace errors = manifest_errors; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 return GetInfo(extension); | 50 return GetInfo(extension); |
| 49 } | 51 } |
| 50 | 52 |
| 51 LinkedAppIconsHandler::LinkedAppIconsHandler() { | 53 LinkedAppIconsHandler::LinkedAppIconsHandler() { |
| 52 } | 54 } |
| 53 | 55 |
| 54 LinkedAppIconsHandler::~LinkedAppIconsHandler() { | 56 LinkedAppIconsHandler::~LinkedAppIconsHandler() { |
| 55 } | 57 } |
| 56 | 58 |
| 57 bool LinkedAppIconsHandler::Parse(Extension* extension, base::string16* error) { | 59 bool LinkedAppIconsHandler::Parse(Extension* extension, base::string16* error) { |
| 58 scoped_ptr<LinkedAppIcons> linked_app_icons(new LinkedAppIcons); | 60 std::unique_ptr<LinkedAppIcons> linked_app_icons(new LinkedAppIcons); |
| 59 | 61 |
| 60 const base::Value* icons_value = nullptr; | 62 const base::Value* icons_value = nullptr; |
| 61 const base::ListValue* icons_list = nullptr; | 63 const base::ListValue* icons_list = nullptr; |
| 62 if (extension->manifest()->Get(keys::kLinkedAppIcons, &icons_value)) { | 64 if (extension->manifest()->Get(keys::kLinkedAppIcons, &icons_value)) { |
| 63 if (!icons_value->GetAsList(&icons_list)) { | 65 if (!icons_value->GetAsList(&icons_list)) { |
| 64 *error = base::UTF8ToUTF16( | 66 *error = base::UTF8ToUTF16( |
| 65 extensions::manifest_errors::kInvalidLinkedAppIcons); | 67 extensions::manifest_errors::kInvalidLinkedAppIcons); |
| 66 return false; | 68 return false; |
| 67 } | 69 } |
| 68 | 70 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 103 |
| 102 extension->SetManifestData(keys::kLinkedAppIcons, linked_app_icons.release()); | 104 extension->SetManifestData(keys::kLinkedAppIcons, linked_app_icons.release()); |
| 103 return true; | 105 return true; |
| 104 } | 106 } |
| 105 | 107 |
| 106 const std::vector<std::string> LinkedAppIconsHandler::Keys() const { | 108 const std::vector<std::string> LinkedAppIconsHandler::Keys() const { |
| 107 return SingleKey(keys::kLinkedAppIcons); | 109 return SingleKey(keys::kLinkedAppIcons); |
| 108 } | 110 } |
| 109 | 111 |
| 110 } // namespace extensions | 112 } // namespace extensions |
| OLD | NEW |