| 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 "ash/system/bluetooth/tray_bluetooth.h" | 5 #include "ash/system/bluetooth/tray_bluetooth.h" |
| 6 | 6 |
| 7 #include "ash/resources/grit/ash_resources.h" | 7 #include "ash/resources/grit/ash_resources.h" |
| 8 #include "ash/resources/vector_icons/vector_icons.h" | 8 #include "ash/resources/vector_icons/vector_icons.h" |
| 9 #include "ash/session/session_state_delegate.h" | 9 #include "ash/session/session_state_delegate.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 475 |
| 476 DCHECK(!toggle_); | 476 DCHECK(!toggle_); |
| 477 DCHECK(!settings_); | 477 DCHECK(!settings_); |
| 478 | 478 |
| 479 tri_view()->SetContainerVisible(TriView::Container::END, true); | 479 tri_view()->SetContainerVisible(TriView::Container::END, true); |
| 480 | 480 |
| 481 toggle_ = | 481 toggle_ = |
| 482 TrayPopupUtils::CreateToggleButton(this, IDS_ASH_STATUS_TRAY_BLUETOOTH); | 482 TrayPopupUtils::CreateToggleButton(this, IDS_ASH_STATUS_TRAY_BLUETOOTH); |
| 483 tri_view()->AddView(TriView::Container::END, toggle_); | 483 tri_view()->AddView(TriView::Container::END, toggle_); |
| 484 | 484 |
| 485 settings_ = | 485 settings_ = CreateSettingsButton(IDS_ASH_STATUS_TRAY_BLUETOOTH_SETTINGS); |
| 486 CreateSettingsButton(login_, IDS_ASH_STATUS_TRAY_BLUETOOTH_SETTINGS); | |
| 487 tri_view()->AddView(TriView::Container::END, settings_); | 486 tri_view()->AddView(TriView::Container::END, settings_); |
| 488 } | 487 } |
| 489 | 488 |
| 490 void ShowSettings() { | 489 void ShowSettings() { |
| 491 if (TrayPopupUtils::CanOpenWebUISettings(login_)) { | 490 if (TrayPopupUtils::CanOpenWebUISettings()) { |
| 492 Shell::Get()->system_tray_controller()->ShowBluetoothSettings(); | 491 Shell::Get()->system_tray_controller()->ShowBluetoothSettings(); |
| 493 owner()->system_tray()->CloseSystemBubble(); | 492 owner()->system_tray()->CloseSystemBubble(); |
| 494 } | 493 } |
| 495 } | 494 } |
| 496 | 495 |
| 497 void ShowLoadingIndicator() { | 496 void ShowLoadingIndicator() { |
| 498 // Setting a value of -1 gives progress_bar an infinite-loading behavior. | 497 // Setting a value of -1 gives progress_bar an infinite-loading behavior. |
| 499 ShowProgress(-1, true); | 498 ShowProgress(-1, true); |
| 500 } | 499 } |
| 501 | 500 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 | 565 |
| 567 void FocusDeviceByAddress(const std::string& address) { | 566 void FocusDeviceByAddress(const std::string& address) { |
| 568 for (auto& view_and_address : device_map_) { | 567 for (auto& view_and_address : device_map_) { |
| 569 if (view_and_address.second == address) { | 568 if (view_and_address.second == address) { |
| 570 view_and_address.first->RequestFocus(); | 569 view_and_address.first->RequestFocus(); |
| 571 return; | 570 return; |
| 572 } | 571 } |
| 573 } | 572 } |
| 574 } | 573 } |
| 575 | 574 |
| 575 // TODO(jamescook): Don't cache this. |
| 576 LoginStatus login_; | 576 LoginStatus login_; |
| 577 | 577 |
| 578 std::map<views::View*, std::string> device_map_; | 578 std::map<views::View*, std::string> device_map_; |
| 579 | 579 |
| 580 BluetoothDeviceList connected_devices_; | 580 BluetoothDeviceList connected_devices_; |
| 581 BluetoothDeviceList connecting_devices_; | 581 BluetoothDeviceList connecting_devices_; |
| 582 BluetoothDeviceList paired_not_connected_devices_; | 582 BluetoothDeviceList paired_not_connected_devices_; |
| 583 BluetoothDeviceList discovered_not_paired_devices_; | 583 BluetoothDeviceList discovered_not_paired_devices_; |
| 584 | 584 |
| 585 views::ToggleButton* toggle_; | 585 views::ToggleButton* toggle_; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 detailed_->Update(); | 647 detailed_->Update(); |
| 648 } | 648 } |
| 649 | 649 |
| 650 void TrayBluetooth::OnBluetoothDiscoveringChanged() { | 650 void TrayBluetooth::OnBluetoothDiscoveringChanged() { |
| 651 if (!detailed_) | 651 if (!detailed_) |
| 652 return; | 652 return; |
| 653 detailed_->Update(); | 653 detailed_->Update(); |
| 654 } | 654 } |
| 655 | 655 |
| 656 } // namespace ash | 656 } // namespace ash |
| OLD | NEW |