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 "chrome/browser/chromeos/system/ash_system_tray_delegate.h" | 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/system/audio/audio_observer.h" | 9 #include "ash/system/audio/audio_observer.h" |
10 #include "ash/system/bluetooth/bluetooth_observer.h" | 10 #include "ash/system/bluetooth/bluetooth_observer.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 using gdata::GDataSystemServiceFactory; | 79 using gdata::GDataSystemServiceFactory; |
80 | 80 |
81 namespace chromeos { | 81 namespace chromeos { |
82 | 82 |
83 namespace { | 83 namespace { |
84 | 84 |
85 // Time delay for rechecking gdata operation when we suspect that there will | 85 // Time delay for rechecking gdata operation when we suspect that there will |
86 // be no upcoming activity notifications that need to be pushed to UI. | 86 // be no upcoming activity notifications that need to be pushed to UI. |
87 const int kGDataOperationRecheckDelayMs = 5000; | 87 const int kGDataOperationRecheckDelayMs = 5000; |
88 | 88 |
89 bool ShouldShowNetworkIconInTray(const Network* network) { | |
90 if (!network) | |
91 return true; | |
92 return !network->connected() || network->type() != TYPE_ETHERNET; | |
93 } | |
94 | |
95 ash::NetworkIconInfo CreateNetworkIconInfo(const Network* network, | 89 ash::NetworkIconInfo CreateNetworkIconInfo(const Network* network, |
96 NetworkMenuIcon* network_icon, | |
97 NetworkMenu* network_menu) { | 90 NetworkMenu* network_menu) { |
98 ash::NetworkIconInfo info; | 91 ash::NetworkIconInfo info; |
99 info.name = UTF8ToUTF16(network->name()); | 92 info.name = UTF8ToUTF16(network->name()); |
100 info.image = network_icon->GetImage(network, NetworkMenuIcon::COLOR_DARK); | 93 info.image = NetworkMenuIcon::GetImage(network, NetworkMenuIcon::COLOR_DARK); |
101 info.service_path = network->service_path(); | 94 info.service_path = network->service_path(); |
102 info.highlight = network->connected() || network->connecting(); | 95 info.highlight = network->connected() || network->connecting(); |
103 info.tray_icon_visible = ShouldShowNetworkIconInTray(network); | |
104 return info; | 96 return info; |
105 } | 97 } |
106 | 98 |
107 void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime, | 99 void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime, |
108 const input_method::InputMethodUtil& util, | 100 const input_method::InputMethodUtil& util, |
109 ash::IMEInfo* info) { | 101 ash::IMEInfo* info) { |
110 info->id = ime.id(); | 102 info->id = ime.id(); |
111 info->name = util.GetInputMethodLongName(ime); | 103 info->name = util.GetInputMethodLongName(ime); |
112 info->short_name = util.GetInputMethodShortName(ime); | 104 info->short_name = util.GetInputMethodShortName(ime); |
113 info->third_party = ime.third_party(); | 105 info->third_party = ime.third_party(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( | 163 ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( |
172 new base::WeakPtrFactory<SystemTrayDelegate>(this))), | 164 new base::WeakPtrFactory<SystemTrayDelegate>(this))), |
173 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( | 165 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( |
174 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 166 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
175 network_icon_dark_(ALLOW_THIS_IN_INITIALIZER_LIST( | 167 network_icon_dark_(ALLOW_THIS_IN_INITIALIZER_LIST( |
176 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 168 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
177 network_menu_(ALLOW_THIS_IN_INITIALIZER_LIST(new NetworkMenu(this))), | 169 network_menu_(ALLOW_THIS_IN_INITIALIZER_LIST(new NetworkMenu(this))), |
178 clock_type_(base::k24HourClock), | 170 clock_type_(base::k24HourClock), |
179 search_key_mapped_to_(input_method::kSearchKey), | 171 search_key_mapped_to_(input_method::kSearchKey), |
180 screen_locked_(false), | 172 screen_locked_(false), |
181 state_(STATE_UNKNOWN), | 173 connected_network_state_(STATE_UNKNOWN), |
182 connected_network_(NULL), | |
183 data_promo_notification_(new DataPromoNotification()) { | 174 data_promo_notification_(new DataPromoNotification()) { |
184 AudioHandler::GetInstance()->AddVolumeObserver(this); | 175 AudioHandler::GetInstance()->AddVolumeObserver(this); |
185 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); | 176 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); |
186 DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate( | 177 DBusThreadManager::Get()->GetPowerManagerClient()->RequestStatusUpdate( |
187 PowerManagerClient::UPDATE_INITIAL); | 178 PowerManagerClient::UPDATE_INITIAL); |
188 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); | 179 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); |
189 | 180 |
190 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 181 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
191 crosnet->AddNetworkManagerObserver(this); | 182 crosnet->AddNetworkManagerObserver(this); |
192 OnNetworkManagerChanged(crosnet); | 183 OnNetworkManagerChanged(crosnet); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 return; | 488 return; |
498 | 489 |
499 *list = GetDriveStatusList( | 490 *list = GetDriveStatusList( |
500 system_service->docs_service()->operation_registry()-> | 491 system_service->docs_service()->operation_registry()-> |
501 GetProgressStatusList()); | 492 GetProgressStatusList()); |
502 } | 493 } |
503 | 494 |
504 | 495 |
505 virtual void GetMostRelevantNetworkIcon(ash::NetworkIconInfo* info, | 496 virtual void GetMostRelevantNetworkIcon(ash::NetworkIconInfo* info, |
506 bool dark) OVERRIDE { | 497 bool dark) OVERRIDE { |
507 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 498 NetworkMenuIcon* icon = |
508 info->image = !dark ? network_icon_->GetIconAndText(&info->description) : | 499 dark ? network_icon_dark_.get() : network_icon_.get(); |
509 network_icon_dark_->GetIconAndText(&info->description); | 500 info->image = icon->GetIconAndText(&info->description); |
510 info->tray_icon_visible = | 501 info->tray_icon_visible = icon->ShouldShowIconInTray(); |
511 ShouldShowNetworkIconInTray(crosnet->connected_network()); | |
512 } | 502 } |
513 | 503 |
514 virtual void GetAvailableNetworks( | 504 virtual void GetAvailableNetworks( |
515 std::vector<ash::NetworkIconInfo>* list) OVERRIDE { | 505 std::vector<ash::NetworkIconInfo>* list) OVERRIDE { |
516 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 506 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
517 | 507 |
518 int connected_index = 0; | 508 std::set<const Network*> added; |
| 509 |
| 510 // Add the active network first. |
| 511 |
| 512 if (crosnet->active_network()) { |
| 513 AddNetworkToList(list, &added, crosnet->active_network()); |
| 514 } |
| 515 |
| 516 // Add connected/connecting network(s) second, by type. |
| 517 |
| 518 if (crosnet->virtual_network() |
| 519 && crosnet->virtual_network()->connecting_or_connected()) { |
| 520 AddNetworkToList(list, &added, crosnet->virtual_network()); |
| 521 } |
| 522 if (crosnet->ethernet_network() && |
| 523 crosnet->ethernet_network()->connecting_or_connected()) { |
| 524 AddNetworkToList(list, &added, crosnet->ethernet_network()); |
| 525 } |
| 526 if (crosnet->cellular_network() |
| 527 && crosnet->cellular_network()->connecting_or_connected()) { |
| 528 AddNetworkToList(list, &added, crosnet->cellular_network()); |
| 529 } |
| 530 if (crosnet->wimax_network() |
| 531 && crosnet->wimax_network()->connecting_or_connected()) { |
| 532 AddNetworkToList(list, &added, crosnet->wimax_network()); |
| 533 } |
| 534 if (crosnet->wifi_network() |
| 535 && crosnet->wifi_network()->connecting_or_connected()) { |
| 536 AddNetworkToList(list, &added, crosnet->wifi_network()); |
| 537 } |
| 538 |
| 539 // Add remaining networks by type. |
519 | 540 |
520 // Ethernet. | 541 // Ethernet. |
521 if (crosnet->ethernet_available() && crosnet->ethernet_enabled()) { | 542 if (crosnet->ethernet_available() && crosnet->ethernet_enabled()) { |
522 const EthernetNetwork* ethernet_network = crosnet->ethernet_network(); | 543 const EthernetNetwork* ethernet_network = crosnet->ethernet_network(); |
523 if (ethernet_network) { | 544 if (ethernet_network) |
524 ash::NetworkIconInfo info = CreateNetworkIconInfo(ethernet_network, | 545 AddNetworkToList(list, &added, ethernet_network); |
525 network_icon_.get(), | |
526 network_menu_.get()); | |
527 if (info.name.empty()) | |
528 info.name = | |
529 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); | |
530 if (crosnet->ethernet_connecting()) { | |
531 info.description = l10n_util::GetStringFUTF16( | |
532 IDS_STATUSBAR_NETWORK_DEVICE_STATUS, | |
533 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET), | |
534 l10n_util::GetStringUTF16( | |
535 IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING)); | |
536 } | |
537 list->push_back(info); | |
538 if (ethernet_network->connected() || ethernet_network->connecting()) | |
539 ++connected_index; | |
540 } | |
541 } | 546 } |
542 | 547 |
543 ash::user::LoginStatus login_status = GetUserLoginStatus(); | |
544 | |
545 // VPN (only if logged in). | 548 // VPN (only if logged in). |
546 if (login_status != ash::user::LOGGED_IN_NONE && | 549 if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE && |
547 (crosnet->connected_network() || | 550 (crosnet->connected_network() || |
548 crosnet->virtual_network_connected())) { | 551 crosnet->virtual_network_connected())) { |
549 const VirtualNetworkVector& vpns = crosnet->virtual_networks(); | 552 const VirtualNetworkVector& vpns = crosnet->virtual_networks(); |
550 for (size_t i = 0; i < vpns.size(); ++i) { | 553 for (size_t i = 0; i < vpns.size(); ++i) |
551 ash::NetworkIconInfo info = CreateNetworkIconInfo(vpns[i], | 554 AddNetworkToList(list, &added, vpns[i]); |
552 network_icon_.get(), network_menu_.get()); | |
553 if (vpns[i]->connected() || vpns[i]->connecting()) | |
554 list->insert(list->begin() + connected_index++, info); | |
555 else | |
556 list->push_back(info); | |
557 } | |
558 } | 555 } |
559 | 556 |
560 // Cellular. | 557 // Cellular. |
561 if (crosnet->cellular_available() && crosnet->cellular_enabled()) { | 558 if (crosnet->cellular_available() && crosnet->cellular_enabled()) { |
562 const CellularNetworkVector& cell = crosnet->cellular_networks(); | 559 const CellularNetworkVector& cell = crosnet->cellular_networks(); |
563 for (size_t i = 0; i < cell.size(); ++i) { | 560 for (size_t i = 0; i < cell.size(); ++i) |
564 ash::NetworkIconInfo info = CreateNetworkIconInfo(cell[i], | 561 AddNetworkToList(list, &added, cell[i]); |
565 network_icon_.get(), network_menu_.get()); | |
566 ActivationState state = cell[i]->activation_state(); | |
567 if (state == ACTIVATION_STATE_NOT_ACTIVATED || | |
568 state == ACTIVATION_STATE_PARTIALLY_ACTIVATED) { | |
569 // If a cellular network needs to be activated, | |
570 // then do not show it in the lock screen. | |
571 if (login_status == ash::user::LOGGED_IN_LOCKED) | |
572 continue; | |
573 | |
574 info.description = l10n_util::GetStringFUTF16( | |
575 IDS_STATUSBAR_NETWORK_DEVICE_ACTIVATE, | |
576 info.name); | |
577 } else if (state == ACTIVATION_STATE_ACTIVATING) { | |
578 info.description = l10n_util::GetStringFUTF16( | |
579 IDS_STATUSBAR_NETWORK_DEVICE_STATUS, | |
580 info.name, l10n_util::GetStringUTF16( | |
581 IDS_STATUSBAR_NETWORK_DEVICE_ACTIVATING)); | |
582 } else if (cell[i]->connecting()) { | |
583 info.description = l10n_util::GetStringFUTF16( | |
584 IDS_STATUSBAR_NETWORK_DEVICE_STATUS, | |
585 info.name, l10n_util::GetStringUTF16( | |
586 IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING)); | |
587 } | |
588 | |
589 if (cell[i]->connected() || cell[i]->connecting()) | |
590 list->insert(list->begin() + connected_index++, info); | |
591 else | |
592 list->push_back(info); | |
593 } | |
594 } | 562 } |
595 | 563 |
596 // Wimax. | 564 // Wimax. |
597 if (crosnet->wimax_available() && crosnet->wimax_enabled()) { | 565 if (crosnet->wimax_available() && crosnet->wimax_enabled()) { |
598 const WimaxNetworkVector& wimax = crosnet->wimax_networks(); | 566 const WimaxNetworkVector& wimax = crosnet->wimax_networks(); |
599 for (size_t i = 0; i < wimax.size(); ++i) { | 567 for (size_t i = 0; i < wimax.size(); ++i) |
600 ash::NetworkIconInfo info = CreateNetworkIconInfo(wimax[i], | 568 AddNetworkToList(list, &added, wimax[i]); |
601 network_icon_.get(), network_menu_.get()); | |
602 if (wimax[i]->connecting()) { | |
603 info.description = l10n_util::GetStringFUTF16( | |
604 IDS_STATUSBAR_NETWORK_DEVICE_STATUS, | |
605 info.name, | |
606 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING)); | |
607 } | |
608 if (wimax[i]->connecting() || wimax[i]->connected()) | |
609 list->insert(list->begin() + connected_index++, info); | |
610 else | |
611 list->push_back(info); | |
612 } | |
613 } | 569 } |
614 | 570 |
615 // Wifi. | 571 // Wifi. |
616 if (crosnet->wifi_available() && crosnet->wifi_enabled()) { | 572 if (crosnet->wifi_available() && crosnet->wifi_enabled()) { |
617 const WifiNetworkVector& wifi = crosnet->wifi_networks(); | 573 const WifiNetworkVector& wifi = crosnet->wifi_networks(); |
618 for (size_t i = 0; i < wifi.size(); ++i) { | 574 for (size_t i = 0; i < wifi.size(); ++i) |
619 ash::NetworkIconInfo info = CreateNetworkIconInfo(wifi[i], | 575 AddNetworkToList(list, &added, wifi[i]); |
620 network_icon_.get(), network_menu_.get()); | |
621 if (wifi[i]->connecting()) { | |
622 info.description = l10n_util::GetStringFUTF16( | |
623 IDS_STATUSBAR_NETWORK_DEVICE_STATUS, | |
624 info.name, | |
625 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING)); | |
626 } | |
627 if (wifi[i]->connecting() || wifi[i]->connected()) | |
628 list->insert(list->begin() + connected_index++, info); | |
629 else | |
630 list->push_back(info); | |
631 } | |
632 } | 576 } |
633 } | 577 } |
634 | 578 |
635 virtual void GetNetworkAddresses(std::string* ip_address, | 579 virtual void GetNetworkAddresses(std::string* ip_address, |
636 std::string* ethernet_mac_address, | 580 std::string* ethernet_mac_address, |
637 std::string* wifi_mac_address) OVERRIDE { | 581 std::string* wifi_mac_address) OVERRIDE { |
638 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 582 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
639 if (crosnet->Connected()) | 583 if (crosnet->Connected()) |
640 *ip_address = crosnet->IPAddress(); | 584 *ip_address = crosnet->IPAddress(); |
641 else | 585 else |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 observer->Refresh(); | 762 observer->Refresh(); |
819 } | 763 } |
820 | 764 |
821 void NotifyRefreshNetwork() { | 765 void NotifyRefreshNetwork() { |
822 ash::NetworkObserver* observer = tray_->network_observer(); | 766 ash::NetworkObserver* observer = tray_->network_observer(); |
823 chromeos::NetworkLibrary* crosnet = | 767 chromeos::NetworkLibrary* crosnet = |
824 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 768 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
825 if (observer) { | 769 if (observer) { |
826 ash::NetworkIconInfo info; | 770 ash::NetworkIconInfo info; |
827 info.image = network_icon_->GetIconAndText(&info.description); | 771 info.image = network_icon_->GetIconAndText(&info.description); |
828 info.tray_icon_visible = | 772 info.tray_icon_visible = network_icon_->ShouldShowIconInTray(); |
829 ShouldShowNetworkIconInTray(crosnet->connected_network()); | |
830 observer->OnNetworkRefresh(info); | 773 observer->OnNetworkRefresh(info); |
831 } | 774 } |
832 | 775 |
833 // Determine whether or not we need to update the icon. | 776 // Update Accessibility. |
834 const Network* connected_network = crosnet->connected_network(); | 777 |
| 778 std::string connected_network_path; |
| 779 ConnectionState connected_network_state(STATE_UNKNOWN); |
| 780 if (crosnet->connected_network()) { |
| 781 connected_network_path = crosnet->connected_network()->service_path(); |
| 782 connected_network_state = crosnet->connected_network()->state(); |
| 783 } |
835 if (accessibility::IsSpokenFeedbackEnabled()) { | 784 if (accessibility::IsSpokenFeedbackEnabled()) { |
836 bool speak = false; | 785 bool speak = false; |
837 if (connected_network_ != connected_network) { | 786 if ((connected_network_path_ != connected_network_path) || |
| 787 (Network::IsConnectedState(connected_network_state_) && |
| 788 !Network::IsConnectedState(connected_network_state)) || |
| 789 (Network::IsConnectingState(connected_network_state_) && |
| 790 !Network::IsConnectingState(connected_network_state)) || |
| 791 (Network::IsDisconnectedState(connected_network_state_) && |
| 792 !Network::IsDisconnectedState(connected_network_state))) { |
838 speak = true; | 793 speak = true; |
839 } else if (connected_network) { | |
840 if ((Network::IsConnectedState(state_) && | |
841 !connected_network->connected()) || | |
842 (Network::IsConnectingState(state_) && | |
843 !connected_network->connecting()) || | |
844 (Network::IsDisconnectedState(state_) && | |
845 !connected_network->disconnected())) { | |
846 speak = true; | |
847 } | |
848 } | 794 } |
849 | 795 |
850 if (speak) { | 796 if (speak) |
851 AccessibilitySpeak(connected_network); | 797 AccessibilitySpeak(crosnet->connected_network()); |
852 } | |
853 } | 798 } |
854 | 799 |
855 connected_network_ = connected_network; | 800 connected_network_path_ = connected_network_path_; |
856 if (connected_network) { | 801 connected_network_state_ = connected_network_state; |
857 state_ = connected_network->state(); | |
858 } else { | |
859 state_ = STATE_UNKNOWN; | |
860 } | |
861 } | 802 } |
862 | 803 |
863 void NotifyRefreshBluetooth() { | 804 void NotifyRefreshBluetooth() { |
864 ash::BluetoothObserver* observer = tray_->bluetooth_observer(); | 805 ash::BluetoothObserver* observer = tray_->bluetooth_observer(); |
865 if (observer) | 806 if (observer) |
866 observer->OnBluetoothRefresh(); | 807 observer->OnBluetoothRefresh(); |
867 } | 808 } |
868 | 809 |
869 void NotifyRefreshIME(bool show_message) { | 810 void NotifyRefreshIME(bool show_message) { |
870 ash::IMEObserver* observer = tray_->ime_observer(); | 811 ash::IMEObserver* observer = tray_->ime_observer(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 IDS_STATUSBAR_NETWORK_CONNECTING_TOOLTIP, | 866 IDS_STATUSBAR_NETWORK_CONNECTING_TOOLTIP, |
926 UTF8ToUTF16(connecting_network->name())); | 867 UTF8ToUTF16(connecting_network->name())); |
927 } | 868 } |
928 } else if (Network::IsDisconnectedState(network->state())) { | 869 } else if (Network::IsDisconnectedState(network->state())) { |
929 connection_string = l10n_util::GetStringUTF8( | 870 connection_string = l10n_util::GetStringUTF8( |
930 IDS_STATUSBAR_NETWORK_NO_NETWORK_TOOLTIP); | 871 IDS_STATUSBAR_NETWORK_NO_NETWORK_TOOLTIP); |
931 } | 872 } |
932 accessibility::Speak(connection_string.c_str()); | 873 accessibility::Speak(connection_string.c_str()); |
933 } | 874 } |
934 | 875 |
| 876 void AddNetworkToList(std::vector<ash::NetworkIconInfo>* list, |
| 877 std::set<const Network*>* added, |
| 878 const Network* network) { |
| 879 // Only add networks to the list once. |
| 880 if (added->find(network) != added->end()) |
| 881 return; |
| 882 |
| 883 ash::NetworkIconInfo info = CreateNetworkIconInfo(network, |
| 884 network_menu_.get()); |
| 885 switch (network->type()) { |
| 886 case TYPE_ETHERNET: |
| 887 if (info.name.empty()) { |
| 888 info.name = |
| 889 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); |
| 890 } |
| 891 break; |
| 892 case TYPE_CELLULAR: { |
| 893 const CellularNetwork* cellular = |
| 894 static_cast<const CellularNetwork*>(network); |
| 895 ActivationState state = cellular->activation_state(); |
| 896 if (state == ACTIVATION_STATE_NOT_ACTIVATED || |
| 897 state == ACTIVATION_STATE_PARTIALLY_ACTIVATED) { |
| 898 // If a cellular network needs to be activated, |
| 899 // then do not show it in the lock screen. |
| 900 if (GetUserLoginStatus() == ash::user::LOGGED_IN_LOCKED) |
| 901 return; |
| 902 |
| 903 info.description = l10n_util::GetStringFUTF16( |
| 904 IDS_STATUSBAR_NETWORK_DEVICE_ACTIVATE, |
| 905 info.name); |
| 906 } else if (state == ACTIVATION_STATE_ACTIVATING) { |
| 907 info.description = l10n_util::GetStringFUTF16( |
| 908 IDS_STATUSBAR_NETWORK_DEVICE_STATUS, |
| 909 info.name, l10n_util::GetStringUTF16( |
| 910 IDS_STATUSBAR_NETWORK_DEVICE_ACTIVATING)); |
| 911 } else if (network->connecting()) { |
| 912 info.description = l10n_util::GetStringFUTF16( |
| 913 IDS_STATUSBAR_NETWORK_DEVICE_STATUS, |
| 914 info.name, l10n_util::GetStringUTF16( |
| 915 IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING)); |
| 916 } |
| 917 break; |
| 918 } |
| 919 case TYPE_VPN: |
| 920 case TYPE_WIFI: |
| 921 case TYPE_WIMAX: |
| 922 case TYPE_BLUETOOTH: |
| 923 case TYPE_UNKNOWN: |
| 924 break; |
| 925 } |
| 926 if (network->connecting()) { |
| 927 info.description = l10n_util::GetStringFUTF16( |
| 928 IDS_STATUSBAR_NETWORK_DEVICE_STATUS, |
| 929 info.name, |
| 930 l10n_util::GetStringUTF16( |
| 931 IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING)); |
| 932 } |
| 933 added->insert(network); |
| 934 list->push_back(info); |
| 935 } |
| 936 |
935 // Overridden from AudioHandler::VolumeObserver. | 937 // Overridden from AudioHandler::VolumeObserver. |
936 virtual void OnVolumeChanged() OVERRIDE { | 938 virtual void OnVolumeChanged() OVERRIDE { |
937 float level = AudioHandler::GetInstance()->GetVolumePercent() / 100.f; | 939 float level = AudioHandler::GetInstance()->GetVolumePercent() / 100.f; |
938 tray_->audio_observer()->OnVolumeChanged(level); | 940 tray_->audio_observer()->OnVolumeChanged(level); |
939 } | 941 } |
940 | 942 |
941 // Overridden from AudioHandler::VolumeObserver. | 943 // Overridden from AudioHandler::VolumeObserver. |
942 virtual void OnMuteToggled() OVERRIDE { | 944 virtual void OnMuteToggled() OVERRIDE { |
943 tray_->audio_observer()->OnMuteToggled(); | 945 tray_->audio_observer()->OnMuteToggled(); |
944 } | 946 } |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 scoped_ptr<NetworkMenuIcon> network_icon_dark_; | 1234 scoped_ptr<NetworkMenuIcon> network_icon_dark_; |
1233 scoped_ptr<NetworkMenu> network_menu_; | 1235 scoped_ptr<NetworkMenu> network_menu_; |
1234 content::NotificationRegistrar registrar_; | 1236 content::NotificationRegistrar registrar_; |
1235 scoped_ptr<PrefChangeRegistrar> pref_registrar_; | 1237 scoped_ptr<PrefChangeRegistrar> pref_registrar_; |
1236 std::string cellular_device_path_; | 1238 std::string cellular_device_path_; |
1237 std::string active_network_path_; | 1239 std::string active_network_path_; |
1238 PowerSupplyStatus power_supply_status_; | 1240 PowerSupplyStatus power_supply_status_; |
1239 base::HourClockType clock_type_; | 1241 base::HourClockType clock_type_; |
1240 int search_key_mapped_to_; | 1242 int search_key_mapped_to_; |
1241 bool screen_locked_; | 1243 bool screen_locked_; |
1242 ConnectionState state_; | 1244 ConnectionState connected_network_state_; |
1243 const Network* connected_network_; | 1245 std::string connected_network_path_; |
1244 | 1246 |
1245 scoped_refptr<BluetoothAdapter> bluetooth_adapter_; | 1247 scoped_refptr<BluetoothAdapter> bluetooth_adapter_; |
1246 | 1248 |
1247 BooleanPrefMember accessibility_enabled_; | 1249 BooleanPrefMember accessibility_enabled_; |
1248 | 1250 |
1249 scoped_ptr<DataPromoNotification> data_promo_notification_; | 1251 scoped_ptr<DataPromoNotification> data_promo_notification_; |
1250 | 1252 |
1251 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1253 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1252 }; | 1254 }; |
1253 | 1255 |
1254 } // namespace | 1256 } // namespace |
1255 | 1257 |
1256 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { | 1258 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { |
1257 return new chromeos::SystemTrayDelegate(tray); | 1259 return new chromeos::SystemTrayDelegate(tray); |
1258 } | 1260 } |
1259 | 1261 |
1260 } // namespace chromeos | 1262 } // namespace chromeos |
OLD | NEW |