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

Unified Diff: ash/common/system/chromeos/network/network_list_md.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/network/network_list_md.cc
diff --git a/ash/common/system/chromeos/network/network_list_md.cc b/ash/common/system/chromeos/network/network_list_md.cc
index b91d6eacff82af46f21fafee6422c4b42749d584..e7e7ca74850d1aaa09ecc46d76108c3b8c015562 100644
--- a/ash/common/system/chromeos/network/network_list_md.cc
+++ b/ash/common/system/chromeos/network/network_list_md.cc
@@ -94,7 +94,10 @@ class NetworkListViewMd::SectionHeaderRowView : public views::View,
AddToggleButton(enabled);
}
- virtual void SetEnabled(bool enabled) { toggle_->SetIsOn(enabled, true); }
+ virtual void SetIsOn(bool enabled) {
+ toggle_->SetEnabled(true);
+ toggle_->SetIsOn(enabled, true);
tdanderson 2017/02/28 16:30:03 For Bluetooth you pass in false for the animation
varkha 2017/03/08 01:45:35 Done (no it was not intentional although I don't k
+ }
protected:
// This is called before the toggle button is added to give subclasses an
@@ -117,6 +120,9 @@ class NetworkListViewMd::SectionHeaderRowView : public views::View,
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override {
DCHECK_EQ(toggle_, sender);
+ // Disable the toggle to prevent bouncing. It will get re-enabled when
+ // NetworkListViewMd::Update() gets called.
+ toggle_->SetEnabled(false);
OnToggleToggled(toggle_->is_on());
}
@@ -191,9 +197,9 @@ class WifiHeaderRowView : public NetworkListViewMd::SectionHeaderRowView {
~WifiHeaderRowView() override {}
- void SetEnabled(bool enabled) override {
+ void SetIsOn(bool enabled) override {
join_->SetEnabled(enabled);
- SectionHeaderRowView::SetEnabled(enabled);
+ SectionHeaderRowView::SetIsOn(enabled);
}
const char* GetClassName() const override { return "WifiHeaderRowView"; }
@@ -593,7 +599,7 @@ int NetworkListViewMd::UpdateSectionHeaderRow(
*separator_view = nullptr;
}
- (*view)->SetEnabled(enabled);
+ (*view)->SetIsOn(enabled);
PlaceViewAtIndex(*view, child_index++);
return child_index;
}

Powered by Google App Engine
This is Rietveld 408576698