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

Side by Side 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 unified diff | Download patch
OLDNEW
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 "ash/common/system/chromeos/bluetooth/tray_bluetooth.h" 5 #include "ash/common/system/chromeos/bluetooth/tray_bluetooth.h"
6 6
7 #include "ash/common/session/session_state_delegate.h" 7 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/system/tray/hover_highlight_view.h" 8 #include "ash/common/system/tray/hover_highlight_view.h"
9 #include "ash/common/system/tray/system_tray.h" 9 #include "ash/common/system/tray/system_tray.h"
10 #include "ash/common/system/tray/system_tray_delegate.h" 10 #include "ash/common/system/tray/system_tray_delegate.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 new_connected_devices); 259 new_connected_devices);
260 RemoveObsoleteBluetoothDevicesFromList(&paired_not_connected_devices_, 260 RemoveObsoleteBluetoothDevicesFromList(&paired_not_connected_devices_,
261 new_paired_not_connected_devices); 261 new_paired_not_connected_devices);
262 RemoveObsoleteBluetoothDevicesFromList(&discovered_not_paired_devices_, 262 RemoveObsoleteBluetoothDevicesFromList(&discovered_not_paired_devices_,
263 new_discovered_not_paired_devices); 263 new_discovered_not_paired_devices);
264 } 264 }
265 265
266 void UpdateHeaderEntry() { 266 void UpdateHeaderEntry() {
267 bool is_bluetooth_enabled = 267 bool is_bluetooth_enabled =
268 WmShell::Get()->system_tray_delegate()->GetBluetoothEnabled(); 268 WmShell::Get()->system_tray_delegate()->GetBluetoothEnabled();
269 if (toggle_) 269 if (!toggle_)
270 toggle_->SetIsOn(is_bluetooth_enabled, false); 270 return;
271 toggle_->SetEnabled(true);
272 toggle_->SetIsOn(is_bluetooth_enabled, false);
271 } 273 }
272 274
273 void UpdateDeviceScrollList() { 275 void UpdateDeviceScrollList() {
274 device_map_.clear(); 276 device_map_.clear();
275 scroll_content()->RemoveAllChildViews(true); 277 scroll_content()->RemoveAllChildViews(true);
276 278
277 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); 279 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
278 bool bluetooth_enabled = delegate->GetBluetoothEnabled(); 280 bool bluetooth_enabled = delegate->GetBluetoothEnabled();
279 bool bluetooth_available = delegate->GetBluetoothAvailable(); 281 bool bluetooth_available = delegate->GetBluetoothAvailable();
280 282
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 const std::string device_id = find->second; 445 const std::string device_id = find->second;
444 if (FoundDevice(device_id, connecting_devices_, nullptr, nullptr)) 446 if (FoundDevice(device_id, connecting_devices_, nullptr, nullptr))
445 return; 447 return;
446 448
447 UpdateClickedDevice(device_id, view); 449 UpdateClickedDevice(device_id, view);
448 delegate->ConnectToBluetoothDevice(device_id); 450 delegate->ConnectToBluetoothDevice(device_id);
449 } 451 }
450 452
451 void HandleButtonPressed(views::Button* sender, 453 void HandleButtonPressed(views::Button* sender,
452 const ui::Event& event) override { 454 const ui::Event& event) override {
453 if (sender == toggle_) 455 if (sender == toggle_) {
456 // 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).
457 // BluetoothDetailedView::Update() gets called.
458 toggle_->SetEnabled(false);
454 WmShell::Get()->system_tray_delegate()->ToggleBluetooth(); 459 WmShell::Get()->system_tray_delegate()->ToggleBluetooth();
455 else if (sender == settings_) 460 } else if (sender == settings_) {
456 ShowSettings(); 461 ShowSettings();
457 else 462 } else {
458 NOTREACHED(); 463 NOTREACHED();
464 }
459 } 465 }
460 466
461 void CreateExtraTitleRowButtons() override { 467 void CreateExtraTitleRowButtons() override {
462 if (login_ == LoginStatus::LOCKED) 468 if (login_ == LoginStatus::LOCKED)
463 return; 469 return;
464 470
465 DCHECK(!toggle_); 471 DCHECK(!toggle_);
466 DCHECK(!settings_); 472 DCHECK(!settings_);
467 473
468 tri_view()->SetContainerVisible(TriView::Container::END, true); 474 tri_view()->SetContainerVisible(TriView::Container::END, true);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 detailed_->Update(); 624 detailed_->Update();
619 } 625 }
620 626
621 void TrayBluetooth::OnBluetoothDiscoveringChanged() { 627 void TrayBluetooth::OnBluetoothDiscoveringChanged() {
622 if (!detailed_) 628 if (!detailed_)
623 return; 629 return;
624 detailed_->Update(); 630 detailed_->Update();
625 } 631 }
626 632
627 } // namespace ash 633 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698