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

Side by Side Diff: ash/common/system/chromeos/network/vpn_list_view.cc

Issue 2775973002: Promotes more accessors from WmShell to Shell (Closed)
Patch Set: feedback Created 3 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 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 image, text, 238 image, text,
239 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTING)); 239 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTING));
240 ThrobberView* throbber = new ThrobberView; 240 ThrobberView* throbber = new ThrobberView;
241 throbber->Start(); 241 throbber->Start();
242 AddRightView(throbber); 242 AddRightView(throbber);
243 } 243 }
244 244
245 } // namespace 245 } // namespace
246 246
247 VPNListView::VPNListView(NetworkListDelegate* delegate) : delegate_(delegate) { 247 VPNListView::VPNListView(NetworkListDelegate* delegate) : delegate_(delegate) {
248 WmShell::Get()->vpn_list()->AddObserver(this); 248 Shell::Get()->vpn_list()->AddObserver(this);
249 } 249 }
250 250
251 VPNListView::~VPNListView() { 251 VPNListView::~VPNListView() {
252 WmShell::Get()->vpn_list()->RemoveObserver(this); 252 Shell::Get()->vpn_list()->RemoveObserver(this);
253 } 253 }
254 254
255 void VPNListView::Update() { 255 void VPNListView::Update() {
256 // Before updating the list, determine whether the user was hovering over one 256 // Before updating the list, determine whether the user was hovering over one
257 // of the VPN provider or network entries. 257 // of the VPN provider or network entries.
258 std::unique_ptr<VPNProvider> hovered_provider; 258 std::unique_ptr<VPNProvider> hovered_provider;
259 std::string hovered_network_guid; 259 std::string hovered_network_guid;
260 for (const std::pair<const views::View* const, VPNProvider>& provider : 260 for (const std::pair<const views::View* const, VPNProvider>& provider :
261 provider_view_map_) { 261 provider_view_map_) {
262 if (static_cast<const HoverHighlightView*>(provider.first)->hover()) { 262 if (static_cast<const HoverHighlightView*>(provider.first)->hover()) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 for (const chromeos::NetworkState* const& network : networks) { 390 for (const chromeos::NetworkState* const& network : networks) {
391 if (VpnProviderMatchesNetwork(vpn_provider, *network)) 391 if (VpnProviderMatchesNetwork(vpn_provider, *network))
392 AddNetwork(network); 392 AddNetwork(network);
393 } 393 }
394 } 394 }
395 395
396 void VPNListView::AddProvidersAndNetworks( 396 void VPNListView::AddProvidersAndNetworks(
397 const chromeos::NetworkStateHandler::NetworkStateList& networks) { 397 const chromeos::NetworkStateHandler::NetworkStateList& networks) {
398 // Get the list of VPN providers enabled in the primary user's profile. 398 // Get the list of VPN providers enabled in the primary user's profile.
399 std::vector<VPNProvider> providers = 399 std::vector<VPNProvider> providers =
400 WmShell::Get()->vpn_list()->vpn_providers(); 400 Shell::Get()->vpn_list()->vpn_providers();
401 401
402 // Add providers with at least one configured network along with their 402 // Add providers with at least one configured network along with their
403 // networks. Providers are added in the order of their highest priority 403 // networks. Providers are added in the order of their highest priority
404 // network. 404 // network.
405 for (const chromeos::NetworkState* const& network : networks) { 405 for (const chromeos::NetworkState* const& network : networks) {
406 for (auto provider = providers.begin(); provider != providers.end(); 406 for (auto provider = providers.begin(); provider != providers.end();
407 ++provider) { 407 ++provider) {
408 if (!VpnProviderMatchesNetwork(*provider, *network)) 408 if (!VpnProviderMatchesNetwork(*provider, *network))
409 continue; 409 continue;
410 AddProviderAndNetworks(*provider, networks); 410 AddProviderAndNetworks(*provider, networks);
411 providers.erase(provider); 411 providers.erase(provider);
412 break; 412 break;
413 } 413 }
414 } 414 }
415 415
416 // Add providers without any configured networks, in the order that the 416 // Add providers without any configured networks, in the order that the
417 // providers were returned by the extensions system. 417 // providers were returned by the extensions system.
418 for (const VPNProvider& provider : providers) 418 for (const VPNProvider& provider : providers)
419 AddProviderAndNetworks(provider, networks); 419 AddProviderAndNetworks(provider, networks);
420 } 420 }
421 421
422 } // namespace ash 422 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/network/tray_vpn.cc ('k') | ash/common/system/chromeos/screen_security/screen_capture_tray_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698