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

Side by Side Diff: chromeos/network/network_state.cc

Issue 984863005: Add ash::VPNDelegate and Chrome OS implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a VPNProvider::Key abstraction. Created 5 years, 9 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 (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/network_state.h" 5 #include "chromeos/network/network_state.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chromeos/network/network_profile_handler.h" 10 #include "chromeos/network/network_profile_handler.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (proxy_config_dict) { 158 if (proxy_config_dict) {
159 // Warning: The DictionaryValue returned from 159 // Warning: The DictionaryValue returned from
160 // ReadDictionaryFromJson/JSONParser is an optimized derived class that 160 // ReadDictionaryFromJson/JSONParser is an optimized derived class that
161 // doesn't allow releasing ownership of nested values. A Swap in the wrong 161 // doesn't allow releasing ownership of nested values. A Swap in the wrong
162 // order leads to memory access errors. 162 // order leads to memory access errors.
163 proxy_config_.MergeDictionary(proxy_config_dict.get()); 163 proxy_config_.MergeDictionary(proxy_config_dict.get());
164 } else { 164 } else {
165 NET_LOG(ERROR) << "Failed to parse " << path() << "." << key; 165 NET_LOG(ERROR) << "Failed to parse " << path() << "." << key;
166 } 166 }
167 return true; 167 return true;
168 } else if (key == shill::kProviderProperty) {
169 const base::DictionaryValue* dict;
170 std::string provider_type;
171 if (!value.GetAsDictionary(&dict) ||
172 !dict->GetStringWithoutPathExpansion(shill::kTypeProperty,
173 &provider_type)) {
174 return false;
175 }
176
177 if (provider_type != shill::kProviderThirdPartyVpn) {
178 // If the network uses the built-in OpenVPN and L2TP support, set the
179 // provider extension ID to an empty string.
180 vpn_provider_extension_id_.clear();
181 return true;
182 }
183
184 // If the network uses a third-party VPN provider, copy over the provider's
185 // extension ID, which is held in |shill::kHostProperty|.
186 return dict->GetStringWithoutPathExpansion(shill::kHostProperty,
187 &vpn_provider_extension_id_);
168 } 188 }
169 return false; 189 return false;
170 } 190 }
171 191
172 bool NetworkState::InitialPropertiesReceived( 192 bool NetworkState::InitialPropertiesReceived(
173 const base::DictionaryValue& properties) { 193 const base::DictionaryValue& properties) {
174 NET_LOG(EVENT) << "InitialPropertiesReceived: " << path() << ": " << name() 194 NET_LOG(EVENT) << "InitialPropertiesReceived: " << path() << ": " << name()
175 << " State: " << connection_state_ << " Visible: " << visible_; 195 << " State: " << connection_state_ << " Visible: " << visible_;
176 if (!properties.HasKey(shill::kTypeProperty)) { 196 if (!properties.HasKey(shill::kTypeProperty)) {
177 NET_LOG(ERROR) << "NetworkState has no type: " 197 NET_LOG(ERROR) << "NetworkState has no type: "
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 return IsCaptivePortalState(shill_properties, false /* log */); 397 return IsCaptivePortalState(shill_properties, false /* log */);
378 } 398 }
379 399
380 // static 400 // static
381 bool NetworkState::ErrorIsValid(const std::string& error) { 401 bool NetworkState::ErrorIsValid(const std::string& error) {
382 // Shill uses "Unknown" to indicate an unset or cleared error state. 402 // Shill uses "Unknown" to indicate an unset or cleared error state.
383 return !error.empty() && error != kErrorUnknown; 403 return !error.empty() && error != kErrorUnknown;
384 } 404 }
385 405
386 } // namespace chromeos 406 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698