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

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

Issue 2099443002: Migrate simple ash Shell metrics users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win compile error. Created 4 years, 6 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
« no previous file with comments | « ash/system/chromeos/network/tray_vpn.cc ('k') | ash/system/chromeos/tray_caps_lock.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/system/chromeos/network/vpn_list_view.h" 5 #include "ash/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
11 #include "ash/common/system/tray/hover_highlight_view.h" 11 #include "ash/common/system/tray/hover_highlight_view.h"
12 #include "ash/common/system/tray/system_tray_delegate.h" 12 #include "ash/common/system/tray/system_tray_delegate.h"
13 #include "ash/common/system/tray/tray_constants.h" 13 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/common/system/tray/tray_popup_label_button.h" 14 #include "ash/common/system/tray/tray_popup_label_button.h"
15 #include "ash/common/wm_shell.h" 15 #include "ash/common/wm_shell.h"
16 #include "ash/metrics/user_metrics_recorder.h"
17 #include "ash/shell.h"
18 #include "ash/system/chromeos/network/vpn_delegate.h" 16 #include "ash/system/chromeos/network/vpn_delegate.h"
19 #include "base/bind.h" 17 #include "base/bind.h"
20 #include "base/bind_helpers.h" 18 #include "base/bind_helpers.h"
21 #include "base/logging.h" 19 #include "base/logging.h"
22 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
23 #include "base/values.h" 21 #include "base/values.h"
24 #include "chromeos/network/network_connection_handler.h" 22 #include "chromeos/network/network_connection_handler.h"
25 #include "chromeos/network/network_handler.h" 23 #include "chromeos/network/network_handler.h"
26 #include "chromeos/network/network_state.h" 24 #include "chromeos/network/network_state.h"
27 #include "chromeos/network/network_type_pattern.h" 25 #include "chromeos/network/network_type_pattern.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 141 }
144 142
145 void VPNListNetworkEntry::NetworkIconChanged() { 143 void VPNListNetworkEntry::NetworkIconChanged() {
146 UpdateFromNetworkState( 144 UpdateFromNetworkState(
147 chromeos::NetworkHandler::Get()->network_state_handler()->GetNetworkState( 145 chromeos::NetworkHandler::Get()->network_state_handler()->GetNetworkState(
148 service_path_)); 146 service_path_));
149 } 147 }
150 148
151 void VPNListNetworkEntry::ButtonPressed(views::Button* sender, 149 void VPNListNetworkEntry::ButtonPressed(views::Button* sender,
152 const ui::Event& event) { 150 const ui::Event& event) {
153 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 151 WmShell::Get()->RecordUserMetricsAction(
154 UMA_STATUS_AREA_VPN_DISCONNECT_CLICKED); 152 UMA_STATUS_AREA_VPN_DISCONNECT_CLICKED);
155 chromeos::NetworkHandler::Get() 153 chromeos::NetworkHandler::Get()
156 ->network_connection_handler() 154 ->network_connection_handler()
157 ->DisconnectNetwork(service_path_, base::Bind(&base::DoNothing), 155 ->DisconnectNetwork(service_path_, base::Bind(&base::DoNothing),
158 base::Bind(&IgnoreDisconnectError)); 156 base::Bind(&IgnoreDisconnectError));
159 } 157 }
160 158
161 VPNListNetworkEntry::DisconnectButton::DisconnectButton( 159 VPNListNetworkEntry::DisconnectButton::DisconnectButton(
162 VPNListNetworkEntry* parent) 160 VPNListNetworkEntry* parent)
163 : TrayPopupLabelButton( 161 : TrayPopupLabelButton(
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 void VPNListView::OnVPNProvidersChanged() { 336 void VPNListView::OnVPNProvidersChanged() {
339 Update(); 337 Update();
340 } 338 }
341 339
342 void VPNListView::OnViewClicked(views::View* sender) { 340 void VPNListView::OnViewClicked(views::View* sender) {
343 const auto& provider = provider_view_key_map_.find(sender); 341 const auto& provider = provider_view_key_map_.find(sender);
344 if (provider != provider_view_key_map_.end()) { 342 if (provider != provider_view_key_map_.end()) {
345 // If the user clicks on a provider entry, request that the "add network" 343 // If the user clicks on a provider entry, request that the "add network"
346 // dialog for this provider be shown. 344 // dialog for this provider be shown.
347 const VPNProvider::Key& key = provider->second; 345 const VPNProvider::Key& key = provider->second;
348 Shell::GetInstance()->metrics()->RecordUserMetricsAction( 346 WmShell::Get()->RecordUserMetricsAction(
349 key.third_party ? UMA_STATUS_AREA_VPN_ADD_THIRD_PARTY_CLICKED 347 key.third_party ? UMA_STATUS_AREA_VPN_ADD_THIRD_PARTY_CLICKED
350 : UMA_STATUS_AREA_VPN_ADD_BUILT_IN_CLICKED); 348 : UMA_STATUS_AREA_VPN_ADD_BUILT_IN_CLICKED);
351 WmShell::Get()->system_tray_delegate()->GetVPNDelegate()->ShowAddPage(key); 349 WmShell::Get()->system_tray_delegate()->GetVPNDelegate()->ShowAddPage(key);
352 return; 350 return;
353 } 351 }
354 352
355 // If the user clicked on a network entry, let the |delegate_| trigger a 353 // If the user clicked on a network entry, let the |delegate_| trigger a
356 // connection attempt (if the network is currently disconnected) or show a 354 // connection attempt (if the network is currently disconnected) or show a
357 // configuration dialog (if the network is currently connected or connecting). 355 // configuration dialog (if the network is currently connected or connecting).
358 delegate_->OnViewClicked(sender); 356 delegate_->OnViewClicked(sender);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 410 }
413 } 411 }
414 412
415 // Add providers without any configured networks, in the order that the 413 // Add providers without any configured networks, in the order that the
416 // providers were returned by the extensions system. 414 // providers were returned by the extensions system.
417 for (const VPNProvider& provider : providers) 415 for (const VPNProvider& provider : providers)
418 AddProviderAndNetworks(provider.key, provider.name, networks); 416 AddProviderAndNetworks(provider.key, provider.name, networks);
419 } 417 }
420 418
421 } // namespace ash 419 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/network/tray_vpn.cc ('k') | ash/system/chromeos/tray_caps_lock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698