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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
682 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 682 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
683 chrome::kBluetoothAddDeviceSubPage); | 683 chrome::kBluetoothAddDeviceSubPage); |
684 } | 684 } |
685 | 685 |
686 virtual void ToggleAirplaneMode() OVERRIDE { | 686 virtual void ToggleAirplaneMode() OVERRIDE { |
687 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 687 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
688 crosnet->EnableOfflineMode(!crosnet->offline_mode()); | 688 crosnet->EnableOfflineMode(!crosnet->offline_mode()); |
689 } | 689 } |
690 | 690 |
691 virtual void ToggleWifi() OVERRIDE { | 691 virtual void ToggleWifi() OVERRIDE { |
692 bool old_wifi_enabled = GetWifiEnabled(); | |
692 network_menu_->ToggleWifi(); | 693 network_menu_->ToggleWifi(); |
694 // Use the old state to get the new state because Wi-Fi state is toggled | |
695 // asynchronously. | |
696 tray_->network_observer()->OnWifiToggled(!old_wifi_enabled); | |
Daniel Erat
2012/08/02 14:26:45
Is there any danger of this getting out of sync?
mazda
2012/08/02 17:14:30
TrayNetwork calls GetWifiEnabled, but it's called
Daniel Erat
2012/08/02 17:15:40
Sure, that sounds great to me. Thanks!
mazda
2012/08/02 19:49:16
Renamed OnWifiToggled to OnWillToggleWifi.
| |
693 } | 697 } |
694 | 698 |
695 virtual void ToggleMobile() OVERRIDE { | 699 virtual void ToggleMobile() OVERRIDE { |
696 network_menu_->ToggleMobile(); | 700 network_menu_->ToggleMobile(); |
697 } | 701 } |
698 | 702 |
699 virtual void ToggleBluetooth() OVERRIDE { | 703 virtual void ToggleBluetooth() OVERRIDE { |
700 bluetooth_adapter_->SetPowered(!bluetooth_adapter_->IsPowered(), | 704 bluetooth_adapter_->SetPowered(!bluetooth_adapter_->IsPowered(), |
701 base::Bind(&base::DoNothing), | 705 base::Bind(&base::DoNothing), |
702 base::Bind(&BluetoothPowerFailure)); | 706 base::Bind(&BluetoothPowerFailure)); |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1258 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1262 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1259 }; | 1263 }; |
1260 | 1264 |
1261 } // namespace | 1265 } // namespace |
1262 | 1266 |
1263 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { | 1267 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { |
1264 return new chromeos::SystemTrayDelegate(tray); | 1268 return new chromeos::SystemTrayDelegate(tray); |
1265 } | 1269 } |
1266 | 1270 |
1267 } // namespace chromeos | 1271 } // namespace chromeos |
OLD | NEW |