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

Side by Side Diff: chrome/browser/chromeos/arc/arc_policy_bridge.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: Fix various builds. 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/browser/chromeos/arc/arc_policy_bridge.h" 5 #include "chrome/browser/chromeos/arc/arc_policy_bridge.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (!chromeos::onc::ParseAndValidateOncForImport( 122 if (!chromeos::onc::ParseAndValidateOncForImport(
123 onc_blob, onc::ONCSource::ONC_SOURCE_USER_POLICY, 123 onc_blob, onc::ONCSource::ONC_SOURCE_USER_POLICY,
124 "" /* no passphrase */, &unused_network_configs, 124 "" /* no passphrase */, &unused_network_configs,
125 &unused_global_network_config, &certificates)) { 125 &unused_global_network_config, &certificates)) {
126 LOG(ERROR) << "Value of onc policy has invalid format =" << onc_blob; 126 LOG(ERROR) << "Value of onc policy has invalid format =" << onc_blob;
127 } 127 }
128 } 128 }
129 129
130 std::unique_ptr<base::ListValue> ca_certs( 130 std::unique_ptr<base::ListValue> ca_certs(
131 base::WrapUnique(new base::ListValue())); 131 base::WrapUnique(new base::ListValue()));
132 for (const auto entry : certificates) { 132 for (const auto& entry : certificates) {
133 const base::DictionaryValue* certificate = nullptr; 133 const base::DictionaryValue* certificate = nullptr;
134 if (!entry->GetAsDictionary(&certificate)) { 134 if (!entry->GetAsDictionary(&certificate)) {
135 DLOG(FATAL) << "Value of a certificate entry is not a dictionary " 135 DLOG(FATAL) << "Value of a certificate entry is not a dictionary "
136 << "value."; 136 << "value.";
137 continue; 137 continue;
138 } 138 }
139 139
140 std::string cert_type; 140 std::string cert_type;
141 certificate->GetStringWithoutPathExpansion(::onc::certificate::kType, 141 certificate->GetStringWithoutPathExpansion(::onc::certificate::kType,
142 &cert_type); 142 &cert_type);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 user_manager::UserManager::Get()->GetPrimaryUser(); 305 user_manager::UserManager::Get()->GetPrimaryUser();
306 Profile* const profile = 306 Profile* const profile =
307 chromeos::ProfileHelper::Get()->GetProfileByUser(primary_user); 307 chromeos::ProfileHelper::Get()->GetProfileByUser(primary_user);
308 auto profile_policy_connector = 308 auto profile_policy_connector =
309 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile); 309 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile);
310 policy_service_ = profile_policy_connector->policy_service(); 310 policy_service_ = profile_policy_connector->policy_service();
311 is_managed_ = profile_policy_connector->IsManaged(); 311 is_managed_ = profile_policy_connector->IsManaged();
312 } 312 }
313 313
314 } // namespace arc 314 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698