| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ash/common/system/chromeos/network/vpn_list_view.h" | 5 #include "ash/common/system/chromeos/network/vpn_list_view.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // by shill. | 465 // by shill. |
| 466 for (const chromeos::NetworkState* const& network : networks) { | 466 for (const chromeos::NetworkState* const& network : networks) { |
| 467 if (key.MatchesNetwork(*network)) | 467 if (key.MatchesNetwork(*network)) |
| 468 AddNetwork(network); | 468 AddNetwork(network); |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 | 471 |
| 472 void VPNListView::AddProvidersAndNetworks( | 472 void VPNListView::AddProvidersAndNetworks( |
| 473 const chromeos::NetworkStateHandler::NetworkStateList& networks) { | 473 const chromeos::NetworkStateHandler::NetworkStateList& networks) { |
| 474 // Get the list of VPN providers enabled in the primary user's profile. | 474 // Get the list of VPN providers enabled in the primary user's profile. |
| 475 std::vector<VPNProvider> providers = WmShell::Get() | 475 std::vector<VPNProvider> providers = |
| 476 ->system_tray_delegate() | 476 WmShell::Get()->system_tray_delegate()->GetVPNDelegate()->vpn_providers(); |
| 477 ->GetVPNDelegate() | |
| 478 ->GetVPNProviders(); | |
| 479 | 477 |
| 480 // Add providers with at least one configured network along with their | 478 // Add providers with at least one configured network along with their |
| 481 // networks. Providers are added in the order of their highest priority | 479 // networks. Providers are added in the order of their highest priority |
| 482 // network. | 480 // network. |
| 483 for (const chromeos::NetworkState* const& network : networks) { | 481 for (const chromeos::NetworkState* const& network : networks) { |
| 484 for (auto provider = providers.begin(); provider != providers.end(); | 482 for (auto provider = providers.begin(); provider != providers.end(); |
| 485 ++provider) { | 483 ++provider) { |
| 486 if (!provider->key.MatchesNetwork(*network)) | 484 if (!provider->key.MatchesNetwork(*network)) |
| 487 continue; | 485 continue; |
| 488 AddProviderAndNetworks(provider->key, provider->name, networks); | 486 AddProviderAndNetworks(provider->key, provider->name, networks); |
| 489 providers.erase(provider); | 487 providers.erase(provider); |
| 490 break; | 488 break; |
| 491 } | 489 } |
| 492 } | 490 } |
| 493 | 491 |
| 494 // Add providers without any configured networks, in the order that the | 492 // Add providers without any configured networks, in the order that the |
| 495 // providers were returned by the extensions system. | 493 // providers were returned by the extensions system. |
| 496 for (const VPNProvider& provider : providers) | 494 for (const VPNProvider& provider : providers) |
| 497 AddProviderAndNetworks(provider.key, provider.name, networks); | 495 AddProviderAndNetworks(provider.key, provider.name, networks); |
| 498 } | 496 } |
| 499 | 497 |
| 500 } // namespace ash | 498 } // namespace ash |
| OLD | NEW |