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

Side by Side Diff: chromeos/network/prohibited_technologies_handler.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
« no previous file with comments | « chromeos/network/onc/onc_validator.cc ('k') | chromeos/network/shill_property_handler.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 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 "chromeos/network/prohibited_technologies_handler.h" 5 #include "chromeos/network/prohibited_technologies_handler.h"
6 6
7 #include "chromeos/network/managed_network_configuration_handler.h" 7 #include "chromeos/network/managed_network_configuration_handler.h"
8 #include "chromeos/network/network_state_handler.h" 8 #include "chromeos/network/network_state_handler.h"
9 #include "chromeos/network/network_util.h" 9 #include "chromeos/network/network_util.h"
10 #include "third_party/cros_system_api/dbus/service_constants.h" 10 #include "third_party/cros_system_api/dbus/service_constants.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return; 56 return;
57 user_policy_applied_ = true; 57 user_policy_applied_ = true;
58 EnforceProhibitedTechnologies(); 58 EnforceProhibitedTechnologies();
59 } 59 }
60 60
61 void ProhibitedTechnologiesHandler::SetProhibitedTechnologies( 61 void ProhibitedTechnologiesHandler::SetProhibitedTechnologies(
62 const base::ListValue* prohibited_list) { 62 const base::ListValue* prohibited_list) {
63 // Build up prohibited network type list and save it for furthur use when 63 // Build up prohibited network type list and save it for furthur use when
64 // enforced 64 // enforced
65 prohibited_technologies_.clear(); 65 prohibited_technologies_.clear();
66 for (const base::Value* item : *prohibited_list) { 66 for (const auto& item : *prohibited_list) {
67 std::string prohibited_technology; 67 std::string prohibited_technology;
68 item->GetAsString(&prohibited_technology); 68 bool item_is_string = item->GetAsString(&prohibited_technology);
69 DCHECK(item_is_string);
69 std::string translated_tech = 70 std::string translated_tech =
70 network_util::TranslateONCTypeToShill(prohibited_technology); 71 network_util::TranslateONCTypeToShill(prohibited_technology);
71 if (!translated_tech.empty()) 72 if (!translated_tech.empty())
72 prohibited_technologies_.push_back(translated_tech); 73 prohibited_technologies_.push_back(translated_tech);
73 } 74 }
74 EnforceProhibitedTechnologies(); 75 EnforceProhibitedTechnologies();
75 } 76 }
76 77
77 void ProhibitedTechnologiesHandler::EnforceProhibitedTechnologies() { 78 void ProhibitedTechnologiesHandler::EnforceProhibitedTechnologies() {
78 if (user_logged_in_ && user_policy_applied_) { 79 if (user_logged_in_ && user_policy_applied_) {
(...skipping 24 matching lines...) Expand all
103 } 104 }
104 105
105 std::vector<std::string> 106 std::vector<std::string>
106 ProhibitedTechnologiesHandler::GetCurrentlyProhibitedTechnologies() { 107 ProhibitedTechnologiesHandler::GetCurrentlyProhibitedTechnologies() {
107 if (user_logged_in_ && user_policy_applied_) 108 if (user_logged_in_ && user_policy_applied_)
108 return prohibited_technologies_; 109 return prohibited_technologies_;
109 return std::vector<std::string>(); 110 return std::vector<std::string>();
110 } 111 }
111 112
112 } // namespace chromeos 113 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_validator.cc ('k') | chromeos/network/shill_property_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698