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

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 (comments) Created 3 years, 9 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
« no previous file with comments | « ash/common/system/chromeos/bluetooth/tray_bluetooth.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4fb46745033a8889e55f4da76cf99a49608b21e5..534466698259115e90f590fa481a2310a577b509 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);
+ }
protected:
// This is called before the toggle button is added to give subclasses an
@@ -117,6 +120,11 @@ class NetworkListViewMd::SectionHeaderRowView : public views::View,
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override {
DCHECK_EQ(toggle_, sender);
+ // In the event of frequent clicks, helps to prevent a toggle button state
+ // from becoming inconsistent with the async operation of enabling /
+ // disabling of mobile radio. The toggle will get re-enabled in the next
+ // call to NetworkListViewMd::Update().
+ toggle_->SetEnabled(false);
OnToggleToggled(toggle_->is_on());
}
@@ -209,9 +217,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"; }
@@ -641,7 +649,7 @@ int NetworkListViewMd::UpdateSectionHeaderRow(
*separator_view = nullptr;
}
- (*view)->SetEnabled(enabled);
+ (*view)->SetIsOn(enabled);
PlaceViewAtIndex(*view, child_index++);
return child_index;
}
« no previous file with comments | « ash/common/system/chromeos/bluetooth/tray_bluetooth.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698