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

Side by Side Diff: chrome/browser/component_updater/supervised_user_whitelist_installer.cc

Issue 2336863003: Change more base::ListValue methods to use std::unique_ptr. (Closed)
Patch Set: . Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/component_updater/supervised_user_whitelist_installer.h " 5 #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h "
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 pref_dict->SetWithoutPathExpansion(crx_id, whitelist_dict); 535 pref_dict->SetWithoutPathExpansion(crx_id, whitelist_dict);
536 } 536 }
537 537
538 if (!client_id.empty()) { 538 if (!client_id.empty()) {
539 base::ListValue* clients = nullptr; 539 base::ListValue* clients = nullptr;
540 if (!whitelist_dict->GetList(kClients, &clients)) { 540 if (!whitelist_dict->GetList(kClients, &clients)) {
541 DCHECK(newly_added); 541 DCHECK(newly_added);
542 clients = new base::ListValue; 542 clients = new base::ListValue;
543 whitelist_dict->Set(kClients, clients); 543 whitelist_dict->Set(kClients, clients);
544 } 544 }
545 bool success = 545 bool success = clients->AppendIfNotPresent(
546 clients->AppendIfNotPresent(new base::StringValue(client_id)); 546 base::MakeUnique<base::StringValue>(client_id));
547 DCHECK(success); 547 DCHECK(success);
548 } 548 }
549 549
550 if (!newly_added) { 550 if (!newly_added) {
551 // Sanity-check that the stored name is equal to the name passed in. 551 // Sanity-check that the stored name is equal to the name passed in.
552 // In release builds this is a no-op. 552 // In release builds this is a no-op.
553 std::string stored_name; 553 std::string stored_name;
554 DCHECK(whitelist_dict->GetString(kName, &stored_name)); 554 DCHECK(whitelist_dict->GetString(kName, &stored_name));
555 DCHECK_EQ(stored_name, name); 555 DCHECK_EQ(stored_name, name);
556 return; 556 return;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 640
641 // static 641 // static
642 void SupervisedUserWhitelistInstaller::TriggerComponentUpdate( 642 void SupervisedUserWhitelistInstaller::TriggerComponentUpdate(
643 OnDemandUpdater* updater, 643 OnDemandUpdater* updater,
644 const std::string& crx_id) { 644 const std::string& crx_id) {
645 // TODO(sorin): use a callback to check the result (crbug.com/639189). 645 // TODO(sorin): use a callback to check the result (crbug.com/639189).
646 updater->OnDemandUpdate(crx_id, ComponentUpdateService::CompletionCallback()); 646 updater->OnDemandUpdate(crx_id, ComponentUpdateService::CompletionCallback());
647 } 647 }
648 648
649 } // namespace component_updater 649 } // namespace component_updater
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/affiliation_test_helper.cc ('k') | chrome/browser/extensions/extension_management_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698