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/system/network/vpn_list_view.h" | 5 #include "ash/system/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/ash_view_ids.h" | 11 #include "ash/ash_view_ids.h" |
12 #include "ash/resources/vector_icons/vector_icons.h" | 12 #include "ash/resources/vector_icons/vector_icons.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ash/shell_port.h" |
14 #include "ash/strings/grit/ash_strings.h" | 15 #include "ash/strings/grit/ash_strings.h" |
15 #include "ash/system/network/network_icon.h" | 16 #include "ash/system/network/network_icon.h" |
16 #include "ash/system/network/network_icon_animation.h" | 17 #include "ash/system/network/network_icon_animation.h" |
17 #include "ash/system/network/network_icon_animation_observer.h" | 18 #include "ash/system/network/network_icon_animation_observer.h" |
18 #include "ash/system/network/network_list_delegate.h" | 19 #include "ash/system/network/network_list_delegate.h" |
19 #include "ash/system/network/vpn_list.h" | 20 #include "ash/system/network/vpn_list.h" |
20 #include "ash/system/tray/hover_highlight_view.h" | 21 #include "ash/system/tray/hover_highlight_view.h" |
21 #include "ash/system/tray/system_menu_button.h" | 22 #include "ash/system/tray/system_menu_button.h" |
22 #include "ash/system/tray/system_tray_controller.h" | 23 #include "ash/system/tray/system_tray_controller.h" |
23 #include "ash/system/tray/throbber_view.h" | 24 #include "ash/system/tray/throbber_view.h" |
24 #include "ash/system/tray/tray_constants.h" | 25 #include "ash/system/tray/tray_constants.h" |
25 #include "ash/system/tray/tray_popup_utils.h" | 26 #include "ash/system/tray/tray_popup_utils.h" |
26 #include "ash/system/tray/tri_view.h" | 27 #include "ash/system/tray/tri_view.h" |
27 #include "ash/wm_shell.h" | |
28 #include "base/bind.h" | 28 #include "base/bind.h" |
29 #include "base/bind_helpers.h" | 29 #include "base/bind_helpers.h" |
30 #include "base/logging.h" | 30 #include "base/logging.h" |
31 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
32 #include "base/values.h" | 32 #include "base/values.h" |
33 #include "chromeos/network/network_connect.h" | 33 #include "chromeos/network/network_connect.h" |
34 #include "chromeos/network/network_handler.h" | 34 #include "chromeos/network/network_handler.h" |
35 #include "chromeos/network/network_state.h" | 35 #include "chromeos/network/network_state.h" |
36 #include "chromeos/network/network_type_pattern.h" | 36 #include "chromeos/network/network_type_pattern.h" |
37 #include "third_party/cros_system_api/dbus/service_constants.h" | 37 #include "third_party/cros_system_api/dbus/service_constants.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 void VPNListView::OnVPNProvidersChanged() { | 333 void VPNListView::OnVPNProvidersChanged() { |
334 Update(); | 334 Update(); |
335 } | 335 } |
336 | 336 |
337 void VPNListView::OnViewClicked(views::View* sender) { | 337 void VPNListView::OnViewClicked(views::View* sender) { |
338 const auto& provider_iter = provider_view_map_.find(sender); | 338 const auto& provider_iter = provider_view_map_.find(sender); |
339 if (provider_iter != provider_view_map_.end()) { | 339 if (provider_iter != provider_view_map_.end()) { |
340 // If the user clicks on a provider entry, request that the "add network" | 340 // If the user clicks on a provider entry, request that the "add network" |
341 // dialog for this provider be shown. | 341 // dialog for this provider be shown. |
342 const VPNProvider& provider = provider_iter->second; | 342 const VPNProvider& provider = provider_iter->second; |
343 WmShell* shell = WmShell::Get(); | |
344 if (provider.third_party) { | 343 if (provider.third_party) { |
345 shell->RecordUserMetricsAction( | 344 ShellPort::Get()->RecordUserMetricsAction( |
346 UMA_STATUS_AREA_VPN_ADD_THIRD_PARTY_CLICKED); | 345 UMA_STATUS_AREA_VPN_ADD_THIRD_PARTY_CLICKED); |
347 Shell::Get()->system_tray_controller()->ShowThirdPartyVpnCreate( | 346 Shell::Get()->system_tray_controller()->ShowThirdPartyVpnCreate( |
348 provider.extension_id); | 347 provider.extension_id); |
349 } else { | 348 } else { |
350 shell->RecordUserMetricsAction(UMA_STATUS_AREA_VPN_ADD_BUILT_IN_CLICKED); | 349 ShellPort::Get()->RecordUserMetricsAction( |
| 350 UMA_STATUS_AREA_VPN_ADD_BUILT_IN_CLICKED); |
351 Shell::Get()->system_tray_controller()->ShowNetworkCreate( | 351 Shell::Get()->system_tray_controller()->ShowNetworkCreate( |
352 shill::kTypeVPN); | 352 shill::kTypeVPN); |
353 } | 353 } |
354 return; | 354 return; |
355 } | 355 } |
356 | 356 |
357 // If the user clicked on a network entry, let the |delegate_| trigger a | 357 // If the user clicked on a network entry, let the |delegate_| trigger a |
358 // connection attempt (if the network is currently disconnected) or show a | 358 // connection attempt (if the network is currently disconnected) or show a |
359 // configuration dialog (if the network is currently connected or connecting). | 359 // configuration dialog (if the network is currently connected or connecting). |
360 delegate_->OnNetworkEntryClicked(sender); | 360 delegate_->OnNetworkEntryClicked(sender); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |