| Index: ash/common/system/chromeos/network/vpn_list_view.cc
|
| diff --git a/ash/common/system/chromeos/network/vpn_list_view.cc b/ash/common/system/chromeos/network/vpn_list_view.cc
|
| index 9831cfc997863877baf098c776b14ff74976d8db..c4410cf86ca02f3c98093ccafaf8ce554bbbf4af 100644
|
| --- a/ash/common/system/chromeos/network/vpn_list_view.cc
|
| +++ b/ash/common/system/chromeos/network/vpn_list_view.cc
|
| @@ -14,10 +14,10 @@
|
| #include "ash/common/system/chromeos/network/network_icon_animation.h"
|
| #include "ash/common/system/chromeos/network/network_icon_animation_observer.h"
|
| #include "ash/common/system/chromeos/network/network_list_delegate.h"
|
| -#include "ash/common/system/chromeos/network/vpn_list.h"
|
| +#include "ash/common/system/chromeos/network/vpn_delegate.h"
|
| #include "ash/common/system/tray/hover_highlight_view.h"
|
| #include "ash/common/system/tray/system_menu_button.h"
|
| -#include "ash/common/system/tray/system_tray_controller.h"
|
| +#include "ash/common/system/tray/system_tray_delegate.h"
|
| #include "ash/common/system/tray/tray_constants.h"
|
| #include "ash/common/system/tray/tray_popup_label_button.h"
|
| #include "ash/common/system/tray/tray_popup_utils.h"
|
| @@ -320,11 +320,18 @@
|
| } // namespace
|
|
|
| VPNListView::VPNListView(NetworkListDelegate* delegate) : delegate_(delegate) {
|
| - WmShell::Get()->vpn_list()->AddObserver(this);
|
| + WmShell::Get()->system_tray_delegate()->GetVPNDelegate()->AddObserver(this);
|
| }
|
|
|
| VPNListView::~VPNListView() {
|
| - WmShell::Get()->vpn_list()->RemoveObserver(this);
|
| + // We need the check as on shell destruction, the delegate is destroyed first.
|
| + SystemTrayDelegate* const system_tray_delegate =
|
| + WmShell::Get()->system_tray_delegate();
|
| + if (system_tray_delegate) {
|
| + VPNDelegate* const vpn_delegate = system_tray_delegate->GetVPNDelegate();
|
| + if (vpn_delegate)
|
| + vpn_delegate->RemoveObserver(this);
|
| + }
|
| }
|
|
|
| void VPNListView::Update() {
|
| @@ -426,16 +433,11 @@
|
| // If the user clicks on a provider entry, request that the "add network"
|
| // dialog for this provider be shown.
|
| const VPNProvider& provider = provider_iter->second;
|
| - WmShell* shell = WmShell::Get();
|
| - if (provider.third_party) {
|
| - shell->RecordUserMetricsAction(
|
| - UMA_STATUS_AREA_VPN_ADD_THIRD_PARTY_CLICKED);
|
| - shell->system_tray_controller()->ShowThirdPartyVpnCreate(
|
| - provider.extension_id);
|
| - } else {
|
| - shell->RecordUserMetricsAction(UMA_STATUS_AREA_VPN_ADD_BUILT_IN_CLICKED);
|
| - shell->system_tray_controller()->ShowNetworkCreate(shill::kTypeVPN);
|
| - }
|
| + WmShell::Get()->RecordUserMetricsAction(
|
| + provider.third_party ? UMA_STATUS_AREA_VPN_ADD_THIRD_PARTY_CLICKED
|
| + : UMA_STATUS_AREA_VPN_ADD_BUILT_IN_CLICKED);
|
| + WmShell::Get()->system_tray_delegate()->GetVPNDelegate()->ShowAddPage(
|
| + provider.extension_id);
|
| return;
|
| }
|
|
|
| @@ -491,7 +493,7 @@
|
| const chromeos::NetworkStateHandler::NetworkStateList& networks) {
|
| // Get the list of VPN providers enabled in the primary user's profile.
|
| std::vector<VPNProvider> providers =
|
| - WmShell::Get()->vpn_list()->vpn_providers();
|
| + WmShell::Get()->system_tray_delegate()->GetVPNDelegate()->vpn_providers();
|
|
|
| // Add providers with at least one configured network along with their
|
| // networks. Providers are added in the order of their highest priority
|
|
|