| OLD | NEW |
| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 auto& item : *prohibited_list) { | 66 for (const auto& item : *prohibited_list) { |
| 67 std::string prohibited_technology; | 67 std::string prohibited_technology; |
| 68 bool item_is_string = item->GetAsString(&prohibited_technology); | 68 bool item_is_string = item.GetAsString(&prohibited_technology); |
| 69 DCHECK(item_is_string); | 69 DCHECK(item_is_string); |
| 70 std::string translated_tech = | 70 std::string translated_tech = |
| 71 network_util::TranslateONCTypeToShill(prohibited_technology); | 71 network_util::TranslateONCTypeToShill(prohibited_technology); |
| 72 if (!translated_tech.empty()) | 72 if (!translated_tech.empty()) |
| 73 prohibited_technologies_.push_back(translated_tech); | 73 prohibited_technologies_.push_back(translated_tech); |
| 74 } | 74 } |
| 75 EnforceProhibitedTechnologies(); | 75 EnforceProhibitedTechnologies(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void ProhibitedTechnologiesHandler::EnforceProhibitedTechnologies() { | 78 void ProhibitedTechnologiesHandler::EnforceProhibitedTechnologies() { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 104 } | 104 } |
| 105 | 105 |
| 106 std::vector<std::string> | 106 std::vector<std::string> |
| 107 ProhibitedTechnologiesHandler::GetCurrentlyProhibitedTechnologies() { | 107 ProhibitedTechnologiesHandler::GetCurrentlyProhibitedTechnologies() { |
| 108 if (user_logged_in_ && user_policy_applied_) | 108 if (user_logged_in_ && user_policy_applied_) |
| 109 return prohibited_technologies_; | 109 return prohibited_technologies_; |
| 110 return std::vector<std::string>(); | 110 return std::vector<std::string>(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace chromeos | 113 } // namespace chromeos |
| OLD | NEW |