Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: ash/common/system/chromeos/bluetooth/tray_bluetooth.cc

Issue 2702493002: [ash-md] Disables the Wi-Fi and Cellular toggles until the state changes (Closed)
Patch Set: [ash-md] Disables the Wi-Fi and Cellular toggles until the state changes (rebase) Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/common/system/chromeos/bluetooth/tray_bluetooth.cc
diff --git a/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc b/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc
index a6a6c5e287a83ede7a2e41aefbffb223d0853f1a..03ad9b749022127cc1d56083b69e73de7a854589 100644
--- a/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc
+++ b/ash/common/system/chromeos/bluetooth/tray_bluetooth.cc
@@ -266,8 +266,10 @@ class BluetoothDetailedView : public TrayDetailsView {
void UpdateHeaderEntry() {
bool is_bluetooth_enabled =
WmShell::Get()->system_tray_delegate()->GetBluetoothEnabled();
- if (toggle_)
- toggle_->SetIsOn(is_bluetooth_enabled, false);
+ if (!toggle_)
+ return;
+ toggle_->SetEnabled(true);
+ toggle_->SetIsOn(is_bluetooth_enabled, false);
}
void UpdateDeviceScrollList() {
@@ -450,12 +452,16 @@ class BluetoothDetailedView : public TrayDetailsView {
void HandleButtonPressed(views::Button* sender,
const ui::Event& event) override {
- if (sender == toggle_)
+ if (sender == toggle_) {
+ // Disable the toggle to prevent bouncing. It will get re-enabled when
tdanderson 2017/02/28 16:30:03 nit: Perhaps be a bit more specific with what is m
varkha 2017/03/08 01:45:35 Done (in network_list_md.cc).
+ // BluetoothDetailedView::Update() gets called.
+ toggle_->SetEnabled(false);
WmShell::Get()->system_tray_delegate()->ToggleBluetooth();
- else if (sender == settings_)
+ } else if (sender == settings_) {
ShowSettings();
- else
+ } else {
NOTREACHED();
+ }
}
void CreateExtraTitleRowButtons() override {

Powered by Google App Engine
This is Rietveld 408576698