Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: chrome/common/extensions/manifest_handlers/linked_app_icons.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 const base::Value* icons_value = nullptr; 62 const base::Value* icons_value = nullptr;
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 base::Value* 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(
(...skipping 21 matching lines...) Expand all
103 103
104 extension->SetManifestData(keys::kLinkedAppIcons, linked_app_icons.release()); 104 extension->SetManifestData(keys::kLinkedAppIcons, linked_app_icons.release());
105 return true; 105 return true;
106 } 106 }
107 107
108 const std::vector<std::string> LinkedAppIconsHandler::Keys() const { 108 const std::vector<std::string> LinkedAppIconsHandler::Keys() const {
109 return SingleKey(keys::kLinkedAppIcons); 109 return SingleKey(keys::kLinkedAppIcons);
110 } 110 }
111 111
112 } // namespace extensions 112 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698