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

Side by Side Diff: extensions/common/manifest_handlers/kiosk_mode_info.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, 6 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
« no previous file with comments | « extensions/common/features/base_feature_provider.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "extensions/common/manifest_handlers/kiosk_mode_info.h" 5 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 std::vector<std::string> ids; 107 std::vector<std::string> ids;
108 if (manifest->HasKey(keys::kKioskSecondaryApps)) { 108 if (manifest->HasKey(keys::kKioskSecondaryApps)) {
109 const base::Value* secondary_apps = nullptr; 109 const base::Value* secondary_apps = nullptr;
110 const base::ListValue* list = nullptr; 110 const base::ListValue* list = nullptr;
111 if (!manifest->Get(keys::kKioskSecondaryApps, &secondary_apps) || 111 if (!manifest->Get(keys::kKioskSecondaryApps, &secondary_apps) ||
112 !secondary_apps->GetAsList(&list)) { 112 !secondary_apps->GetAsList(&list)) {
113 *error = base::ASCIIToUTF16(manifest_errors::kInvalidKioskSecondaryApps); 113 *error = base::ASCIIToUTF16(manifest_errors::kInvalidKioskSecondaryApps);
114 return false; 114 return false;
115 } 115 }
116 116
117 for (const base::Value* value : *list) { 117 for (const auto& value : *list) {
118 std::unique_ptr<KioskSecondaryAppsType> app = 118 std::unique_ptr<KioskSecondaryAppsType> app =
119 KioskSecondaryAppsType::FromValue(*value, error); 119 KioskSecondaryAppsType::FromValue(*value, error);
120 if (!app) { 120 if (!app) {
121 *error = base::ASCIIToUTF16( 121 *error = base::ASCIIToUTF16(
122 manifest_errors::kInvalidKioskSecondaryAppsBadAppId); 122 manifest_errors::kInvalidKioskSecondaryAppsBadAppId);
123 return false; 123 return false;
124 } 124 }
125 ids.push_back(app->id); 125 ids.push_back(app->id);
126 } 126 }
127 } 127 }
(...skipping 14 matching lines...) Expand all
142 new KioskModeInfo(kiosk_status, ids, required_platform_version)); 142 new KioskModeInfo(kiosk_status, ids, required_platform_version));
143 143
144 return true; 144 return true;
145 } 145 }
146 146
147 const std::vector<std::string> KioskModeHandler::Keys() const { 147 const std::vector<std::string> KioskModeHandler::Keys() const {
148 return supported_keys_; 148 return supported_keys_;
149 } 149 }
150 150
151 } // namespace extensions 151 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/features/base_feature_provider.cc ('k') | extensions/renderer/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698