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

Side by Side Diff: chromeos/network/onc/onc_merger.cc

Issue 660663003: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « chromeos/dbus/bluetooth_profile_service_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/network/onc/onc_merger.h" 5 #include "chromeos/network/onc/onc_merger.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // This field is part of the provided ONCSignature, thus it can be 375 // This field is part of the provided ONCSignature, thus it can be
376 // controlled by policy. 376 // controlled by policy.
377 std::string which_effective; 377 std::string which_effective;
378 scoped_ptr<base::Value> effective_value = 378 scoped_ptr<base::Value> effective_value =
379 MergeToEffective::MergeValues(key, values, &which_effective); 379 MergeToEffective::MergeValues(key, values, &which_effective);
380 380
381 if (IsIdentifierField(*signature_, key)) { 381 if (IsIdentifierField(*signature_, key)) {
382 // Don't augment the GUID but write the plain value. 382 // Don't augment the GUID but write the plain value.
383 if (!effective_value) { 383 if (!effective_value) {
384 LOG(ERROR) << "GUID field has no effective value"; 384 LOG(ERROR) << "GUID field has no effective value";
385 return make_scoped_ptr<base::Value>(NULL); 385 return nullptr;
386 } 386 }
387 387
388 // DCHECK that all provided GUIDs are identical. 388 // DCHECK that all provided GUIDs are identical.
389 DCHECK(AllPresentValuesEqual(values, *effective_value)); 389 DCHECK(AllPresentValuesEqual(values, *effective_value));
390 390
391 // Return the un-augmented GUID. 391 // Return the un-augmented GUID.
392 return effective_value.Pass(); 392 return effective_value.Pass();
393 } 393 }
394 394
395 scoped_ptr<base::DictionaryValue> augmented_value( 395 scoped_ptr<base::DictionaryValue> augmented_value(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 if (HasUserPolicy() && values.user_editable) { 432 if (HasUserPolicy() && values.user_editable) {
433 augmented_value->SetBooleanWithoutPathExpansion( 433 augmented_value->SetBooleanWithoutPathExpansion(
434 ::onc::kAugmentationUserEditable, true); 434 ::onc::kAugmentationUserEditable, true);
435 } 435 }
436 if (HasDevicePolicy() && values.device_editable) { 436 if (HasDevicePolicy() && values.device_editable) {
437 augmented_value->SetBooleanWithoutPathExpansion( 437 augmented_value->SetBooleanWithoutPathExpansion(
438 ::onc::kAugmentationDeviceEditable, true); 438 ::onc::kAugmentationDeviceEditable, true);
439 } 439 }
440 if (augmented_value->empty()) 440 if (augmented_value->empty())
441 augmented_value.reset(); 441 augmented_value.reset();
442 return augmented_value.PassAs<base::Value>(); 442 return augmented_value.Pass();
443 } 443 }
444 444
445 // MergeListOfDictionaries override. 445 // MergeListOfDictionaries override.
446 virtual DictionaryPtr MergeNestedDictionaries( 446 virtual DictionaryPtr MergeNestedDictionaries(
447 const std::string& key, 447 const std::string& key,
448 const DictPtrs &dicts) override { 448 const DictPtrs &dicts) override {
449 DictionaryPtr result; 449 DictionaryPtr result;
450 if (signature_) { 450 if (signature_) {
451 const OncValueSignature* enclosing_signature = signature_; 451 const OncValueSignature* enclosing_signature = signature_;
452 signature_ = NULL; 452 signature_ = NULL;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 const base::DictionaryValue* shared_settings, 489 const base::DictionaryValue* shared_settings,
490 const base::DictionaryValue* active_settings) { 490 const base::DictionaryValue* active_settings) {
491 MergeToAugmented merger; 491 MergeToAugmented merger;
492 return merger.MergeDictionaries( 492 return merger.MergeDictionaries(
493 signature, user_policy, device_policy, user_settings, shared_settings, 493 signature, user_policy, device_policy, user_settings, shared_settings,
494 active_settings); 494 active_settings);
495 } 495 }
496 496
497 } // namespace onc 497 } // namespace onc
498 } // namespace chromeos 498 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/bluetooth_profile_service_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698