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" |
11 #include "ash/system/brightness/brightness_observer.h" | 11 #include "ash/system/brightness/brightness_observer.h" |
12 #include "ash/system/chromeos/network/network_observer.h" | 12 #include "ash/system/chromeos/network/network_observer.h" |
13 #include "ash/system/date/clock_observer.h" | 13 #include "ash/system/date/clock_observer.h" |
14 #include "ash/system/drive/drive_observer.h" | 14 #include "ash/system/drive/drive_observer.h" |
15 #include "ash/system/ime/ime_observer.h" | 15 #include "ash/system/ime/ime_observer.h" |
16 #include "ash/system/logout_button/logout_button_observer.h" | 16 #include "ash/system/logout_button/logout_button_observer.h" |
17 #include "ash/system/power/power_status_observer.h" | 17 #include "ash/system/power/power_status_observer.h" |
18 #include "ash/system/tray/system_tray.h" | 18 #include "ash/system/tray/system_tray.h" |
19 #include "ash/system/tray/system_tray_delegate.h" | 19 #include "ash/system/tray/system_tray_delegate.h" |
| 20 #include "ash/system/tray/system_tray_notifier.h" |
20 #include "ash/system/tray_accessibility.h" | 21 #include "ash/system/tray_accessibility.h" |
21 #include "ash/system/tray_caps_lock.h" | 22 #include "ash/system/tray_caps_lock.h" |
22 #include "ash/system/user/update_observer.h" | 23 #include "ash/system/user/update_observer.h" |
23 #include "ash/system/user/user_observer.h" | 24 #include "ash/system/user/user_observer.h" |
24 #include "ash/volume_control_delegate.h" | 25 #include "ash/volume_control_delegate.h" |
25 #include "ash/wm/session_state_controller.h" | 26 #include "ash/wm/session_state_controller.h" |
26 #include "base/bind_helpers.h" | 27 #include "base/bind_helpers.h" |
27 #include "base/callback.h" | 28 #include "base/callback.h" |
28 #include "base/chromeos/chromeos_version.h" | 29 #include "base/chromeos/chromeos_version.h" |
29 #include "base/logging.h" | 30 #include "base/logging.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( | 170 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( |
170 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 171 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
171 network_icon_dark_(ALLOW_THIS_IN_INITIALIZER_LIST( | 172 network_icon_dark_(ALLOW_THIS_IN_INITIALIZER_LIST( |
172 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), | 173 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), |
173 network_menu_(ALLOW_THIS_IN_INITIALIZER_LIST(new NetworkMenu(this))), | 174 network_menu_(ALLOW_THIS_IN_INITIALIZER_LIST(new NetworkMenu(this))), |
174 clock_type_(base::k24HourClock), | 175 clock_type_(base::k24HourClock), |
175 search_key_mapped_to_(input_method::kSearchKey), | 176 search_key_mapped_to_(input_method::kSearchKey), |
176 screen_locked_(false), | 177 screen_locked_(false), |
177 connected_network_state_(STATE_UNKNOWN), | 178 connected_network_state_(STATE_UNKNOWN), |
178 data_promo_notification_(new DataPromoNotification()), | 179 data_promo_notification_(new DataPromoNotification()), |
179 volume_control_delegate_(ALLOW_THIS_IN_INITIALIZER_LIST( | 180 volume_control_delegate_(new VolumeController()) { |
180 new VolumeController)) { | |
181 // Register notifications on construction so that events such as | 181 // Register notifications on construction so that events such as |
182 // PROFILE_CREATED do not get missed if they happen before Initialize(). | 182 // PROFILE_CREATED do not get missed if they happen before Initialize(). |
183 registrar_.Add(this, | 183 registrar_.Add(this, |
184 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, | 184 chrome::NOTIFICATION_UPGRADE_RECOMMENDED, |
185 content::NotificationService::AllSources()); | 185 content::NotificationService::AllSources()); |
186 registrar_.Add(this, | 186 registrar_.Add(this, |
187 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, | 187 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
188 content::NotificationService::AllSources()); | 188 content::NotificationService::AllSources()); |
189 if (GetUserLoginStatus() == ash::user::LOGGED_IN_NONE) { | 189 if (GetUserLoginStatus() == ash::user::LOGGED_IN_NONE) { |
190 registrar_.Add(this, | 190 registrar_.Add(this, |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 618 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
619 chrome::kBluetoothAddDeviceSubPage); | 619 chrome::kBluetoothAddDeviceSubPage); |
620 } | 620 } |
621 | 621 |
622 virtual void ToggleAirplaneMode() OVERRIDE { | 622 virtual void ToggleAirplaneMode() OVERRIDE { |
623 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 623 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
624 crosnet->EnableOfflineMode(!crosnet->offline_mode()); | 624 crosnet->EnableOfflineMode(!crosnet->offline_mode()); |
625 } | 625 } |
626 | 626 |
627 virtual void ToggleWifi() OVERRIDE { | 627 virtual void ToggleWifi() OVERRIDE { |
628 GetSystemTray()->network_observer()->OnWillToggleWifi(); | 628 GetSystemTrayNotifier()->NotifyWillToggleWifi(); |
629 network_menu_->ToggleWifi(); | 629 network_menu_->ToggleWifi(); |
630 } | 630 } |
631 | 631 |
632 virtual void ToggleMobile() OVERRIDE { | 632 virtual void ToggleMobile() OVERRIDE { |
633 network_menu_->ToggleMobile(); | 633 network_menu_->ToggleMobile(); |
634 } | 634 } |
635 | 635 |
636 virtual void ToggleBluetooth() OVERRIDE { | 636 virtual void ToggleBluetooth() OVERRIDE { |
637 bluetooth_adapter_->SetPowered(!bluetooth_adapter_->IsPowered(), | 637 bluetooth_adapter_->SetPowered(!bluetooth_adapter_->IsPowered(), |
638 base::Bind(&base::DoNothing), | 638 base::Bind(&base::DoNothing), |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 virtual void SetVolumeControlDelegate( | 732 virtual void SetVolumeControlDelegate( |
733 scoped_ptr<ash::VolumeControlDelegate> delegate) OVERRIDE { | 733 scoped_ptr<ash::VolumeControlDelegate> delegate) OVERRIDE { |
734 volume_control_delegate_.swap(delegate); | 734 volume_control_delegate_.swap(delegate); |
735 } | 735 } |
736 | 736 |
737 private: | 737 private: |
738 ash::SystemTray* GetSystemTray() { | 738 ash::SystemTray* GetSystemTray() { |
739 return ash::Shell::GetInstance()->system_tray(); | 739 return ash::Shell::GetInstance()->system_tray(); |
740 } | 740 } |
741 | 741 |
| 742 ash::SystemTrayNotifier* GetSystemTrayNotifier() { |
| 743 return ash::Shell::GetInstance()->system_tray_notifier(); |
| 744 } |
| 745 |
742 // Returns the last active browser. If there is no such browser, creates a new | 746 // Returns the last active browser. If there is no such browser, creates a new |
743 // browser window with an empty tab and returns it. | 747 // browser window with an empty tab and returns it. |
744 Browser* GetAppropriateBrowser() { | 748 Browser* GetAppropriateBrowser() { |
745 return browser::FindOrCreateTabbedBrowser( | 749 return browser::FindOrCreateTabbedBrowser( |
746 ProfileManager::GetDefaultProfileOrOffTheRecord(), | 750 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
747 chrome::HOST_DESKTOP_TYPE_ASH); | 751 chrome::HOST_DESKTOP_TYPE_ASH); |
748 } | 752 } |
749 | 753 |
750 void SetProfile(Profile* profile) { | 754 void SetProfile(Profile* profile) { |
751 PrefService* prefs = profile->GetPrefs(); | 755 PrefService* prefs = profile->GetPrefs(); |
(...skipping 12 matching lines...) Expand all Loading... |
764 DriveSystemService* system_service = FindDriveSystemService(); | 768 DriveSystemService* system_service = FindDriveSystemService(); |
765 if (!system_service) | 769 if (!system_service) |
766 return; | 770 return; |
767 | 771 |
768 system_service->drive_service()->AddObserver(this); | 772 system_service->drive_service()->AddObserver(this); |
769 } | 773 } |
770 | 774 |
771 void UpdateClockType(PrefServiceBase* service) { | 775 void UpdateClockType(PrefServiceBase* service) { |
772 clock_type_ = service->GetBoolean(prefs::kUse24HourClock) ? | 776 clock_type_ = service->GetBoolean(prefs::kUse24HourClock) ? |
773 base::k24HourClock : base::k12HourClock; | 777 base::k24HourClock : base::k12HourClock; |
774 ash::ClockObserver* observer = GetSystemTray()->clock_observer(); | 778 GetSystemTrayNotifier()->NotifyDateFormatChanged(); |
775 if (observer) | |
776 observer->OnDateFormatChanged(); | |
777 } | 779 } |
778 | 780 |
779 void UpdateShowLogoutButtonInTray(PrefServiceBase* service) { | 781 void UpdateShowLogoutButtonInTray(PrefServiceBase* service) { |
780 ash::LogoutButtonObserver* observer = | 782 GetSystemTrayNotifier()->NotifyShowLoginButtonChanged( |
781 GetSystemTray()->logout_button_observer(); | 783 service->GetBoolean(prefs::kShowLogoutButtonInTray)); |
782 if (observer) { | |
783 observer->OnShowLogoutButtonInTrayChanged( | |
784 service->GetBoolean(prefs::kShowLogoutButtonInTray)); | |
785 } | |
786 } | |
787 | |
788 void NotifyRefreshClock() { | |
789 ash::ClockObserver* observer = GetSystemTray()->clock_observer(); | |
790 if (observer) | |
791 observer->Refresh(); | |
792 } | 784 } |
793 | 785 |
794 void NotifyRefreshNetwork() { | 786 void NotifyRefreshNetwork() { |
795 ash::NetworkObserver* observer = GetSystemTray()->network_observer(); | |
796 chromeos::NetworkLibrary* crosnet = | 787 chromeos::NetworkLibrary* crosnet = |
797 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 788 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
798 if (observer) { | 789 ash::NetworkIconInfo info; |
799 ash::NetworkIconInfo info; | 790 info.image = network_icon_->GetIconAndText(&info.description); |
800 info.image = network_icon_->GetIconAndText(&info.description); | 791 info.tray_icon_visible = network_icon_->ShouldShowIconInTray(); |
801 info.tray_icon_visible = network_icon_->ShouldShowIconInTray(); | 792 GetSystemTrayNotifier()->NotifyRefreshNetwork(info); |
802 observer->OnNetworkRefresh(info); | 793 GetSystemTrayNotifier()->NotifyVpnRefreshNetwork(info); |
803 } | |
804 | |
805 ash::NetworkObserver* vpn_observer = GetSystemTray()->vpn_observer(); | |
806 if (vpn_observer) { | |
807 ash::NetworkIconInfo info; | |
808 info.image = network_icon_->GetIconAndText(&info.description); | |
809 info.tray_icon_visible = network_icon_->ShouldShowIconInTray(); | |
810 vpn_observer->OnNetworkRefresh(info); | |
811 } | |
812 | 794 |
813 // Update Accessibility. | 795 // Update Accessibility. |
814 | 796 |
815 std::string connected_network_path; | 797 std::string connected_network_path; |
816 ConnectionState connected_network_state(STATE_UNKNOWN); | 798 ConnectionState connected_network_state(STATE_UNKNOWN); |
817 if (crosnet->connected_network()) { | 799 if (crosnet->connected_network()) { |
818 connected_network_path = crosnet->connected_network()->service_path(); | 800 connected_network_path = crosnet->connected_network()->service_path(); |
819 connected_network_state = crosnet->connected_network()->state(); | 801 connected_network_state = crosnet->connected_network()->state(); |
820 } | 802 } |
821 if (accessibility::IsSpokenFeedbackEnabled()) { | 803 if (accessibility::IsSpokenFeedbackEnabled()) { |
822 bool speak = false; | 804 bool speak = false; |
823 if ((connected_network_path_ != connected_network_path) || | 805 if ((connected_network_path_ != connected_network_path) || |
824 (Network::IsConnectedState(connected_network_state_) && | 806 (Network::IsConnectedState(connected_network_state_) && |
825 !Network::IsConnectedState(connected_network_state)) || | 807 !Network::IsConnectedState(connected_network_state)) || |
826 (Network::IsConnectingState(connected_network_state_) && | 808 (Network::IsConnectingState(connected_network_state_) && |
827 !Network::IsConnectingState(connected_network_state)) || | 809 !Network::IsConnectingState(connected_network_state)) || |
828 (Network::IsDisconnectedState(connected_network_state_) && | 810 (Network::IsDisconnectedState(connected_network_state_) && |
829 !Network::IsDisconnectedState(connected_network_state))) { | 811 !Network::IsDisconnectedState(connected_network_state))) { |
830 speak = true; | 812 speak = true; |
831 } | 813 } |
832 | 814 |
833 if (speak) | 815 if (speak) |
834 AccessibilitySpeak(crosnet->connected_network()); | 816 AccessibilitySpeak(crosnet->connected_network()); |
835 } | 817 } |
836 | 818 |
837 connected_network_path_ = connected_network_path_; | 819 connected_network_path_ = connected_network_path_; |
838 connected_network_state_ = connected_network_state; | 820 connected_network_state_ = connected_network_state; |
839 } | 821 } |
840 | 822 |
841 void NotifyRefreshBluetooth() { | |
842 ash::BluetoothObserver* observer = GetSystemTray()->bluetooth_observer(); | |
843 if (observer) | |
844 observer->OnBluetoothRefresh(); | |
845 } | |
846 | |
847 void NotifyBluetoothDiscoveringChanged() { | |
848 ash::BluetoothObserver* observer = GetSystemTray()->bluetooth_observer(); | |
849 if (observer) | |
850 observer->OnBluetoothDiscoveringChanged(); | |
851 } | |
852 | |
853 void NotifyRefreshIME(bool show_message) { | |
854 ash::IMEObserver* observer = GetSystemTray()->ime_observer(); | |
855 if (observer) | |
856 observer->OnIMERefresh(show_message); | |
857 } | |
858 | |
859 void NotifyRefreshDrive(ash::DriveOperationStatusList& list) { | |
860 ash::DriveObserver* observer = GetSystemTray()->drive_observer(); | |
861 if (observer) | |
862 observer->OnDriveRefresh(list); | |
863 } | |
864 | |
865 void RefreshNetworkObserver(NetworkLibrary* crosnet) { | 823 void RefreshNetworkObserver(NetworkLibrary* crosnet) { |
866 const Network* network = crosnet->active_network(); | 824 const Network* network = crosnet->active_network(); |
867 std::string new_path = network ? network->service_path() : std::string(); | 825 std::string new_path = network ? network->service_path() : std::string(); |
868 if (active_network_path_ != new_path) { | 826 if (active_network_path_ != new_path) { |
869 if (!active_network_path_.empty()) | 827 if (!active_network_path_.empty()) |
870 crosnet->RemoveNetworkObserver(active_network_path_, this); | 828 crosnet->RemoveNetworkObserver(active_network_path_, this); |
871 if (!new_path.empty()) | 829 if (!new_path.empty()) |
872 crosnet->AddNetworkObserver(new_path, this); | 830 crosnet->AddNetworkObserver(new_path, this); |
873 active_network_path_ = new_path; | 831 active_network_path_ = new_path; |
874 } | 832 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 l10n_util::GetStringUTF16( | 934 l10n_util::GetStringUTF16( |
977 IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING)); | 935 IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING)); |
978 } | 936 } |
979 added->insert(network); | 937 added->insert(network); |
980 list->push_back(info); | 938 list->push_back(info); |
981 } | 939 } |
982 | 940 |
983 // Overridden from AudioHandler::VolumeObserver. | 941 // Overridden from AudioHandler::VolumeObserver. |
984 virtual void OnVolumeChanged() OVERRIDE { | 942 virtual void OnVolumeChanged() OVERRIDE { |
985 float level = AudioHandler::GetInstance()->GetVolumePercent() / 100.f; | 943 float level = AudioHandler::GetInstance()->GetVolumePercent() / 100.f; |
986 GetSystemTray()->audio_observer()->OnVolumeChanged(level); | 944 GetSystemTrayNotifier()->NotifyVolumeChanged(level); |
987 } | 945 } |
988 | 946 |
989 // Overridden from AudioHandler::VolumeObserver. | 947 // Overridden from AudioHandler::VolumeObserver. |
990 virtual void OnMuteToggled() OVERRIDE { | 948 virtual void OnMuteToggled() OVERRIDE { |
991 GetSystemTray()->audio_observer()->OnMuteToggled(); | 949 GetSystemTrayNotifier()->NotifyMuteToggled(); |
992 } | 950 } |
993 | 951 |
994 // Overridden from PowerManagerClient::Observer. | 952 // Overridden from PowerManagerClient::Observer. |
995 virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE { | 953 virtual void BrightnessChanged(int level, bool user_initiated) OVERRIDE { |
996 GetSystemTray()->brightness_observer()-> | 954 double leveld = static_cast<double>(level); |
997 OnBrightnessChanged(static_cast<double>(level), user_initiated); | 955 GetSystemTrayNotifier()->NotifyBrightnessChanged(leveld, user_initiated); |
998 } | 956 } |
999 | 957 |
1000 virtual void PowerChanged(const PowerSupplyStatus& power_status) OVERRIDE { | 958 virtual void PowerChanged(const PowerSupplyStatus& power_status) OVERRIDE { |
1001 power_supply_status_ = power_status; | 959 power_supply_status_ = power_status; |
1002 FOR_EACH_OBSERVER(ash::PowerStatusObserver, | 960 GetSystemTrayNotifier()->NotifyPowerStatusChanged(power_status); |
1003 GetSystemTray()->power_status_observers(), | |
1004 OnPowerStatusChanged(power_status)); | |
1005 } | 961 } |
1006 | 962 |
1007 virtual void SystemResumed() OVERRIDE { | 963 virtual void SystemResumed() OVERRIDE { |
1008 NotifyRefreshClock(); | 964 GetSystemTrayNotifier()->NotifyRefreshClock(); |
1009 } | 965 } |
1010 | 966 |
1011 // Overridden from SessionManagerClient::Observer. | 967 // Overridden from SessionManagerClient::Observer. |
1012 virtual void LockScreen() OVERRIDE { | 968 virtual void LockScreen() OVERRIDE { |
1013 screen_locked_ = true; | 969 screen_locked_ = true; |
1014 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( | 970 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( |
1015 GetUserLoginStatus()); | 971 GetUserLoginStatus()); |
1016 } | 972 } |
1017 | 973 |
1018 virtual void UnlockScreen() OVERRIDE { | 974 virtual void UnlockScreen() OVERRIDE { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 | 1043 |
1088 case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: | 1044 case UpgradeDetector::UPGRADE_ANNOYANCE_ELEVATED: |
1089 severity = ash::UpdateObserver::UPDATE_LOW_GREEN; | 1045 severity = ash::UpdateObserver::UPDATE_LOW_GREEN; |
1090 break; | 1046 break; |
1091 | 1047 |
1092 case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: | 1048 case UpgradeDetector::UPGRADE_ANNOYANCE_LOW: |
1093 default: | 1049 default: |
1094 severity = ash::UpdateObserver::UPDATE_NORMAL; | 1050 severity = ash::UpdateObserver::UPDATE_NORMAL; |
1095 break; | 1051 break; |
1096 } | 1052 } |
1097 ash::UpdateObserver* observer = GetSystemTray()->update_observer(); | 1053 GetSystemTrayNotifier()->NotifyUpdateRecommended(severity); |
1098 if (observer) | |
1099 observer->OnUpdateRecommended(severity); | |
1100 break; | 1054 break; |
1101 } | 1055 } |
1102 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { | 1056 case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: { |
1103 // This notification is also sent on login screen when user avatar | 1057 // This notification is also sent on login screen when user avatar |
1104 // is loaded from file. | 1058 // is loaded from file. |
1105 if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) { | 1059 if (GetUserLoginStatus() != ash::user::LOGGED_IN_NONE) { |
1106 ash::UserObserver* observer = GetSystemTray()->user_observer(); | 1060 GetSystemTrayNotifier()->NotifyUserUpdate(); |
1107 if (observer) | |
1108 observer->OnUserUpdate(); | |
1109 } | 1061 } |
1110 break; | 1062 break; |
1111 } | 1063 } |
1112 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: { | 1064 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: { |
1113 // GData system service exists by the time if enabled. | 1065 // GData system service exists by the time if enabled. |
1114 ObserveGDataUpdates(); | 1066 ObserveGDataUpdates(); |
1115 break; | 1067 break; |
1116 } | 1068 } |
1117 case chrome::NOTIFICATION_PROFILE_CREATED: { | 1069 case chrome::NOTIFICATION_PROFILE_CREATED: { |
1118 SetProfile(content::Source<Profile>(source).ptr()); | 1070 SetProfile(content::Source<Profile>(source).ptr()); |
(...skipping 14 matching lines...) Expand all Loading... |
1133 } | 1085 } |
1134 | 1086 |
1135 virtual void OnPreferenceChanged(PrefServiceBase* service, | 1087 virtual void OnPreferenceChanged(PrefServiceBase* service, |
1136 const std::string& pref) OVERRIDE { | 1088 const std::string& pref) OVERRIDE { |
1137 if (pref == prefs::kUse24HourClock) { | 1089 if (pref == prefs::kUse24HourClock) { |
1138 UpdateClockType(service); | 1090 UpdateClockType(service); |
1139 } else if (pref == prefs::kLanguageRemapSearchKeyTo) { | 1091 } else if (pref == prefs::kLanguageRemapSearchKeyTo) { |
1140 search_key_mapped_to_ = | 1092 search_key_mapped_to_ = |
1141 service->GetInteger(prefs::kLanguageRemapSearchKeyTo); | 1093 service->GetInteger(prefs::kLanguageRemapSearchKeyTo); |
1142 } else if (pref == prefs::kSpokenFeedbackEnabled) { | 1094 } else if (pref == prefs::kSpokenFeedbackEnabled) { |
1143 ash::AccessibilityObserver* observer = | 1095 GetSystemTrayNotifier()->NotifyAccessibilityModeChanged( |
1144 GetSystemTray()->accessibility_observer(); | 1096 service->GetBoolean(prefs::kSpokenFeedbackEnabled)); |
1145 if (observer) { | |
1146 observer->OnAccessibilityModeChanged( | |
1147 service->GetBoolean(prefs::kSpokenFeedbackEnabled)); | |
1148 } | |
1149 } else if (pref == prefs::kShowLogoutButtonInTray) { | 1097 } else if (pref == prefs::kShowLogoutButtonInTray) { |
1150 UpdateShowLogoutButtonInTray(service); | 1098 UpdateShowLogoutButtonInTray(service); |
1151 } else { | 1099 } else { |
1152 NOTREACHED(); | 1100 NOTREACHED(); |
1153 } | 1101 } |
1154 } | 1102 } |
1155 | 1103 |
1156 // Overridden from InputMethodManager::Observer. | 1104 // Overridden from InputMethodManager::Observer. |
1157 virtual void InputMethodChanged( | 1105 virtual void InputMethodChanged( |
1158 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { | 1106 input_method::InputMethodManager* manager, bool show_message) OVERRIDE { |
1159 NotifyRefreshIME(show_message); | 1107 GetSystemTrayNotifier()->NotifyRefreshIME(show_message); |
1160 } | 1108 } |
1161 | 1109 |
1162 virtual void InputMethodPropertyChanged( | 1110 virtual void InputMethodPropertyChanged( |
1163 input_method::InputMethodManager* manager) OVERRIDE { | 1111 input_method::InputMethodManager* manager) OVERRIDE { |
1164 NotifyRefreshIME(false); | 1112 GetSystemTrayNotifier()->NotifyRefreshIME(false); |
1165 } | 1113 } |
1166 | 1114 |
1167 // google_apis::DriveServiceObserver overrides. | 1115 // google_apis::DriveServiceObserver overrides. |
1168 virtual void OnProgressUpdate( | 1116 virtual void OnProgressUpdate( |
1169 const google_apis::OperationProgressStatusList& list) OVERRIDE { | 1117 const google_apis::OperationProgressStatusList& list) OVERRIDE { |
1170 std::vector<ash::DriveOperationStatus> ui_list = GetDriveStatusList(list); | 1118 std::vector<ash::DriveOperationStatus> ui_list = GetDriveStatusList(list); |
1171 NotifyRefreshDrive(ui_list); | 1119 GetSystemTrayNotifier()->NotifyRefreshDrive(ui_list); |
1172 | 1120 |
1173 // If we have something to report right now (i.e. completion status only), | 1121 // If we have something to report right now (i.e. completion status only), |
1174 // we need to delayed re-check the status in few seconds to ensure we | 1122 // we need to delayed re-check the status in few seconds to ensure we |
1175 // raise events that will let us properly clear the uber tray state. | 1123 // raise events that will let us properly clear the uber tray state. |
1176 if (list.size() > 0) { | 1124 if (list.size() > 0) { |
1177 bool has_in_progress_items = false; | 1125 bool has_in_progress_items = false; |
1178 for (google_apis::OperationProgressStatusList::const_iterator it = | 1126 for (google_apis::OperationProgressStatusList::const_iterator it = |
1179 list.begin(); | 1127 list.begin(); |
1180 it != list.end(); ++it) { | 1128 it != list.end(); ++it) { |
1181 if (it->transfer_state == google_apis::OPERATION_STARTED || | 1129 if (it->transfer_state == google_apis::OPERATION_STARTED || |
(...skipping 28 matching lines...) Expand all Loading... |
1210 OnProgressUpdate(system_service->drive_service()->GetProgressStatusList()); | 1158 OnProgressUpdate(system_service->drive_service()->GetProgressStatusList()); |
1211 } | 1159 } |
1212 | 1160 |
1213 DriveSystemService* FindDriveSystemService() { | 1161 DriveSystemService* FindDriveSystemService() { |
1214 Profile* profile = ProfileManager::GetDefaultProfile(); | 1162 Profile* profile = ProfileManager::GetDefaultProfile(); |
1215 return DriveSystemServiceFactory::FindForProfile(profile); | 1163 return DriveSystemServiceFactory::FindForProfile(profile); |
1216 } | 1164 } |
1217 | 1165 |
1218 // Overridden from system::TimezoneSettings::Observer. | 1166 // Overridden from system::TimezoneSettings::Observer. |
1219 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { | 1167 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { |
1220 NotifyRefreshClock(); | 1168 GetSystemTrayNotifier()->NotifyRefreshClock(); |
1221 } | 1169 } |
1222 | 1170 |
1223 // Overridden from BluetoothAdapter::Observer. | 1171 // Overridden from BluetoothAdapter::Observer. |
1224 virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter, | 1172 virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter, |
1225 bool present) OVERRIDE { | 1173 bool present) OVERRIDE { |
1226 NotifyRefreshBluetooth(); | 1174 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); |
1227 } | 1175 } |
1228 | 1176 |
1229 virtual void AdapterPoweredChanged(device::BluetoothAdapter* adapter, | 1177 virtual void AdapterPoweredChanged(device::BluetoothAdapter* adapter, |
1230 bool powered) OVERRIDE { | 1178 bool powered) OVERRIDE { |
1231 NotifyRefreshBluetooth(); | 1179 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); |
1232 } | 1180 } |
1233 | 1181 |
1234 virtual void AdapterDiscoveringChanged(device::BluetoothAdapter* adapter, | 1182 virtual void AdapterDiscoveringChanged(device::BluetoothAdapter* adapter, |
1235 bool discovering) OVERRIDE { | 1183 bool discovering) OVERRIDE { |
1236 NotifyBluetoothDiscoveringChanged(); | 1184 GetSystemTrayNotifier()->NotifyBluetoothDiscoveringChanged(); |
1237 } | 1185 } |
1238 | 1186 |
1239 virtual void DeviceAdded(device::BluetoothAdapter* adapter, | 1187 virtual void DeviceAdded(device::BluetoothAdapter* adapter, |
1240 device::BluetoothDevice* device) OVERRIDE { | 1188 device::BluetoothDevice* device) OVERRIDE { |
1241 NotifyRefreshBluetooth(); | 1189 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); |
1242 } | 1190 } |
1243 | 1191 |
1244 virtual void DeviceChanged(device::BluetoothAdapter* adapter, | 1192 virtual void DeviceChanged(device::BluetoothAdapter* adapter, |
1245 device::BluetoothDevice* device) OVERRIDE { | 1193 device::BluetoothDevice* device) OVERRIDE { |
1246 NotifyRefreshBluetooth(); | 1194 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); |
1247 } | 1195 } |
1248 | 1196 |
1249 virtual void DeviceRemoved(device::BluetoothAdapter* adapter, | 1197 virtual void DeviceRemoved(device::BluetoothAdapter* adapter, |
1250 device::BluetoothDevice* device) OVERRIDE { | 1198 device::BluetoothDevice* device) OVERRIDE { |
1251 NotifyRefreshBluetooth(); | 1199 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); |
1252 } | 1200 } |
1253 | 1201 |
1254 // Overridden from SystemKeyEventListener::CapsLockObserver. | 1202 // Overridden from SystemKeyEventListener::CapsLockObserver. |
1255 virtual void OnCapsLockChange(bool enabled) OVERRIDE { | 1203 virtual void OnCapsLockChange(bool enabled) OVERRIDE { |
1256 bool search_mapped_to_caps_lock = false; | 1204 bool search_mapped_to_caps_lock = false; |
1257 if (!base::chromeos::IsRunningOnChromeOS() || | 1205 if (!base::chromeos::IsRunningOnChromeOS() || |
1258 search_key_mapped_to_ == input_method::kCapsLockKey) | 1206 search_key_mapped_to_ == input_method::kCapsLockKey) |
1259 search_mapped_to_caps_lock = true; | 1207 search_mapped_to_caps_lock = true; |
1260 | 1208 GetSystemTrayNotifier()->NotifyCapsLockChanged( |
1261 ash::CapsLockObserver* observer = GetSystemTray()->caps_lock_observer(); | 1209 enabled, search_mapped_to_caps_lock); |
1262 if (observer) | |
1263 observer->OnCapsLockChanged(enabled, search_mapped_to_caps_lock); | |
1264 } | 1210 } |
1265 | 1211 |
1266 // Overridden from ash::NetworkTrayDelegate | 1212 // Overridden from ash::NetworkTrayDelegate |
1267 virtual void NotificationLinkClicked(size_t index) OVERRIDE { | 1213 virtual void NotificationLinkClicked(size_t index) OVERRIDE { |
1268 // If we have deal info URL defined that means that there're | 1214 // If we have deal info URL defined that means that there're |
1269 // 2 links in bubble. Let the user close it manually then thus giving | 1215 // 2 links in bubble. Let the user close it manually then thus giving |
1270 // ability to navigate to second link. | 1216 // ability to navigate to second link. |
1271 // mobile_data_bubble_ will be set to NULL in BubbleClosing callback. | 1217 // mobile_data_bubble_ will be set to NULL in BubbleClosing callback. |
1272 std::string deal_info_url = data_promo_notification_->deal_info_url(); | 1218 std::string deal_info_url = data_promo_notification_->deal_info_url(); |
1273 std::string deal_topup_url = data_promo_notification_->deal_topup_url(); | 1219 std::string deal_topup_url = data_promo_notification_->deal_topup_url(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1272 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1327 }; | 1273 }; |
1328 | 1274 |
1329 } // namespace | 1275 } // namespace |
1330 | 1276 |
1331 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1277 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1332 return new chromeos::SystemTrayDelegate(); | 1278 return new chromeos::SystemTrayDelegate(); |
1333 } | 1279 } |
1334 | 1280 |
1335 } // namespace chromeos | 1281 } // namespace chromeos |
OLD | NEW |