OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/network_state_list_detailed_view.h" | 5 #include "ash/system/network/network_state_list_detailed_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
11 #include "ash/public/cpp/shell_window_ids.h" | 11 #include "ash/public/cpp/shell_window_ids.h" |
12 #include "ash/resources/vector_icons/vector_icons.h" | 12 #include "ash/resources/vector_icons/vector_icons.h" |
13 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/shell_port.h" |
15 #include "ash/strings/grit/ash_strings.h" | 16 #include "ash/strings/grit/ash_strings.h" |
16 #include "ash/system/network/network_icon.h" | 17 #include "ash/system/network/network_icon.h" |
17 #include "ash/system/network/network_icon_animation.h" | 18 #include "ash/system/network/network_icon_animation.h" |
18 #include "ash/system/network/network_info.h" | 19 #include "ash/system/network/network_info.h" |
19 #include "ash/system/network/network_list.h" | 20 #include "ash/system/network/network_list.h" |
20 #include "ash/system/network/network_list_view_base.h" | 21 #include "ash/system/network/network_list_view_base.h" |
21 #include "ash/system/network/tray_network_state_observer.h" | 22 #include "ash/system/network/tray_network_state_observer.h" |
22 #include "ash/system/network/vpn_list_view.h" | 23 #include "ash/system/network/vpn_list_view.h" |
23 #include "ash/system/networking_config_delegate.h" | 24 #include "ash/system/networking_config_delegate.h" |
24 #include "ash/system/tray/fixed_sized_image_view.h" | 25 #include "ash/system/tray/fixed_sized_image_view.h" |
25 #include "ash/system/tray/hover_highlight_view.h" | 26 #include "ash/system/tray/hover_highlight_view.h" |
26 #include "ash/system/tray/system_menu_button.h" | 27 #include "ash/system/tray/system_menu_button.h" |
27 #include "ash/system/tray/system_tray.h" | 28 #include "ash/system/tray/system_tray.h" |
28 #include "ash/system/tray/system_tray_controller.h" | 29 #include "ash/system/tray/system_tray_controller.h" |
29 #include "ash/system/tray/system_tray_delegate.h" | 30 #include "ash/system/tray/system_tray_delegate.h" |
30 #include "ash/system/tray/throbber_view.h" | 31 #include "ash/system/tray/throbber_view.h" |
31 #include "ash/system/tray/tray_constants.h" | 32 #include "ash/system/tray/tray_constants.h" |
32 #include "ash/system/tray/tray_details_view.h" | 33 #include "ash/system/tray/tray_details_view.h" |
33 #include "ash/system/tray/tray_popup_header_button.h" | 34 #include "ash/system/tray/tray_popup_header_button.h" |
34 #include "ash/system/tray/tri_view.h" | 35 #include "ash/system/tray/tri_view.h" |
35 #include "ash/wm_shell.h" | |
36 #include "ash/wm_window.h" | 36 #include "ash/wm_window.h" |
37 #include "base/command_line.h" | 37 #include "base/command_line.h" |
38 #include "base/strings/string_number_conversions.h" | 38 #include "base/strings/string_number_conversions.h" |
39 #include "base/strings/utf_string_conversions.h" | 39 #include "base/strings/utf_string_conversions.h" |
40 #include "base/threading/thread_task_runner_handle.h" | 40 #include "base/threading/thread_task_runner_handle.h" |
41 #include "base/time/time.h" | 41 #include "base/time/time.h" |
42 #include "chromeos/chromeos_switches.h" | 42 #include "chromeos/chromeos_switches.h" |
43 #include "chromeos/login/login_state.h" | 43 #include "chromeos/login/login_state.h" |
44 #include "chromeos/network/device_state.h" | 44 #include "chromeos/network/device_state.h" |
45 #include "chromeos/network/managed_network_configuration_handler.h" | 45 #include "chromeos/network/managed_network_configuration_handler.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 return; | 296 return; |
297 | 297 |
298 std::string guid; | 298 std::string guid; |
299 if (!network_list_view_->IsNetworkEntry(view, &guid)) | 299 if (!network_list_view_->IsNetworkEntry(view, &guid)) |
300 return; | 300 return; |
301 | 301 |
302 const NetworkState* network = | 302 const NetworkState* network = |
303 NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid( | 303 NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid( |
304 guid); | 304 guid); |
305 if (!network || network->IsConnectedState() || network->IsConnectingState()) { | 305 if (!network || network->IsConnectedState() || network->IsConnectingState()) { |
306 WmShell::Get()->RecordUserMetricsAction( | 306 ShellPort::Get()->RecordUserMetricsAction( |
307 list_type_ == LIST_TYPE_VPN | 307 list_type_ == LIST_TYPE_VPN |
308 ? UMA_STATUS_AREA_SHOW_VPN_CONNECTION_DETAILS | 308 ? UMA_STATUS_AREA_SHOW_VPN_CONNECTION_DETAILS |
309 : UMA_STATUS_AREA_SHOW_NETWORK_CONNECTION_DETAILS); | 309 : UMA_STATUS_AREA_SHOW_NETWORK_CONNECTION_DETAILS); |
310 Shell::Get()->system_tray_controller()->ShowNetworkSettings( | 310 Shell::Get()->system_tray_controller()->ShowNetworkSettings( |
311 network ? network->guid() : std::string()); | 311 network ? network->guid() : std::string()); |
312 } else { | 312 } else { |
313 WmShell::Get()->RecordUserMetricsAction( | 313 ShellPort::Get()->RecordUserMetricsAction( |
314 list_type_ == LIST_TYPE_VPN | 314 list_type_ == LIST_TYPE_VPN |
315 ? UMA_STATUS_AREA_CONNECT_TO_VPN | 315 ? UMA_STATUS_AREA_CONNECT_TO_VPN |
316 : UMA_STATUS_AREA_CONNECT_TO_CONFIGURED_NETWORK); | 316 : UMA_STATUS_AREA_CONNECT_TO_CONFIGURED_NETWORK); |
317 chromeos::NetworkConnect::Get()->ConnectToNetworkId(network->guid()); | 317 chromeos::NetworkConnect::Get()->ConnectToNetworkId(network->guid()); |
318 } | 318 } |
319 } | 319 } |
320 | 320 |
321 void NetworkStateListDetailedView::CreateExtraTitleRowButtons() { | 321 void NetworkStateListDetailedView::CreateExtraTitleRowButtons() { |
322 if (login_ == LoginStatus::LOCKED) | 322 if (login_ == LoginStatus::LOCKED) |
323 return; | 323 return; |
(...skipping 22 matching lines...) Expand all Loading... |
346 tri_view()->AddView(TriView::Container::END, settings_button_); | 346 tri_view()->AddView(TriView::Container::END, settings_button_); |
347 } else { | 347 } else { |
348 proxy_settings_button_ = new SystemMenuButton( | 348 proxy_settings_button_ = new SystemMenuButton( |
349 this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuSettingsIcon, | 349 this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuSettingsIcon, |
350 IDS_ASH_STATUS_TRAY_NETWORK_PROXY_SETTINGS); | 350 IDS_ASH_STATUS_TRAY_NETWORK_PROXY_SETTINGS); |
351 tri_view()->AddView(TriView::Container::END, proxy_settings_button_); | 351 tri_view()->AddView(TriView::Container::END, proxy_settings_button_); |
352 } | 352 } |
353 } | 353 } |
354 | 354 |
355 void NetworkStateListDetailedView::ShowSettings() { | 355 void NetworkStateListDetailedView::ShowSettings() { |
356 WmShell::Get()->RecordUserMetricsAction( | 356 ShellPort::Get()->RecordUserMetricsAction( |
357 list_type_ == LIST_TYPE_VPN ? UMA_STATUS_AREA_VPN_SETTINGS_OPENED | 357 list_type_ == LIST_TYPE_VPN ? UMA_STATUS_AREA_VPN_SETTINGS_OPENED |
358 : UMA_STATUS_AREA_NETWORK_SETTINGS_OPENED); | 358 : UMA_STATUS_AREA_NETWORK_SETTINGS_OPENED); |
359 Shell::Get()->system_tray_controller()->ShowNetworkSettings(std::string()); | 359 Shell::Get()->system_tray_controller()->ShowNetworkSettings(std::string()); |
360 } | 360 } |
361 | 361 |
362 void NetworkStateListDetailedView::UpdateNetworkList() { | 362 void NetworkStateListDetailedView::UpdateNetworkList() { |
363 network_list_view_->Update(); | 363 network_list_view_->Update(); |
364 } | 364 } |
365 | 365 |
366 void NetworkStateListDetailedView::UpdateHeaderButtons() { | 366 void NetworkStateListDetailedView::UpdateHeaderButtons() { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 536 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
537 label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0)); | 537 label->SetEnabledColor(SkColorSetARGB(192, 0, 0, 0)); |
538 return label; | 538 return label; |
539 } | 539 } |
540 | 540 |
541 void NetworkStateListDetailedView::OnNetworkEntryClicked(views::View* sender) { | 541 void NetworkStateListDetailedView::OnNetworkEntryClicked(views::View* sender) { |
542 HandleViewClicked(sender); | 542 HandleViewClicked(sender); |
543 } | 543 } |
544 | 544 |
545 void NetworkStateListDetailedView::OnOtherWifiClicked() { | 545 void NetworkStateListDetailedView::OnOtherWifiClicked() { |
546 WmShell::Get()->RecordUserMetricsAction( | 546 ShellPort::Get()->RecordUserMetricsAction( |
547 UMA_STATUS_AREA_NETWORK_JOIN_OTHER_CLICKED); | 547 UMA_STATUS_AREA_NETWORK_JOIN_OTHER_CLICKED); |
548 Shell::Get()->system_tray_controller()->ShowNetworkCreate(shill::kTypeWifi); | 548 Shell::Get()->system_tray_controller()->ShowNetworkCreate(shill::kTypeWifi); |
549 } | 549 } |
550 | 550 |
551 void NetworkStateListDetailedView::RelayoutScrollList() { | 551 void NetworkStateListDetailedView::RelayoutScrollList() { |
552 scroller()->Layout(); | 552 scroller()->Layout(); |
553 } | 553 } |
554 | 554 |
555 } // namespace tray | 555 } // namespace tray |
556 } // namespace ash | 556 } // namespace ash |
OLD | NEW |