| 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/common/system/chromeos/bluetooth/tray_bluetooth.h" | 5 #include "ash/common/system/chromeos/bluetooth/tray_bluetooth.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" | 9 #include "ash/common/system/tray/fixed_sized_scroll_view.h" |
| 10 #include "ash/common/system/tray/hover_highlight_view.h" | 10 #include "ash/common/system/tray/hover_highlight_view.h" |
| 11 #include "ash/common/system/tray/system_tray.h" | 11 #include "ash/common/system/tray/system_tray.h" |
| 12 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
| 13 #include "ash/common/system/tray/system_tray_notifier.h" | 13 #include "ash/common/system/tray/system_tray_notifier.h" |
| 14 #include "ash/common/system/tray/throbber_view.h" | 14 #include "ash/common/system/tray/throbber_view.h" |
| 15 #include "ash/common/system/tray/tray_constants.h" | 15 #include "ash/common/system/tray/tray_constants.h" |
| 16 #include "ash/common/system/tray/tray_details_view.h" | 16 #include "ash/common/system/tray/tray_details_view.h" |
| 17 #include "ash/common/system/tray/tray_item_more.h" | 17 #include "ash/common/system/tray/tray_item_more.h" |
| 18 #include "ash/common/system/tray/tray_popup_header_button.h" | 18 #include "ash/common/system/tray/tray_popup_header_button.h" |
| 19 #include "ash/common/system/tray/tray_popup_item_style.h" | 19 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 20 #include "ash/common/system/tray/tray_popup_utils.h" | 20 #include "ash/common/system/tray/tray_popup_utils.h" |
| 21 #include "ash/common/system/tray/tri_view.h" |
| 21 #include "ash/common/wm_shell.h" | 22 #include "ash/common/wm_shell.h" |
| 22 #include "ash/resources/vector_icons/vector_icons.h" | 23 #include "ash/resources/vector_icons/vector_icons.h" |
| 23 #include "device/bluetooth/bluetooth_common.h" | 24 #include "device/bluetooth/bluetooth_common.h" |
| 24 #include "grit/ash_resources.h" | 25 #include "grit/ash_resources.h" |
| 25 #include "grit/ash_strings.h" | 26 #include "grit/ash_strings.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/gfx/color_palette.h" | 29 #include "ui/gfx/color_palette.h" |
| 29 #include "ui/gfx/image/image.h" | 30 #include "ui/gfx/image/image.h" |
| 30 #include "ui/gfx/paint_vector_icon.h" | 31 #include "ui/gfx/paint_vector_icon.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 delegate->ToggleBluetooth(); | 527 delegate->ToggleBluetooth(); |
| 527 else | 528 else |
| 528 NOTREACHED(); | 529 NOTREACHED(); |
| 529 } | 530 } |
| 530 | 531 |
| 531 void CreateExtraTitleRowButtons() override { | 532 void CreateExtraTitleRowButtons() override { |
| 532 if (login_ == LoginStatus::LOCKED) | 533 if (login_ == LoginStatus::LOCKED) |
| 533 return; | 534 return; |
| 534 | 535 |
| 535 if (UseMd()) { | 536 if (UseMd()) { |
| 536 toggle_ = title_row()->AddToggleButton(this); | 537 DCHECK(!toggle_); |
| 537 settings_ = title_row()->AddSettingsButton(this, login_); | 538 DCHECK(!settings_); |
| 539 |
| 540 tri_view()->SetContainerVisible(TriView::Container::END, true); |
| 541 |
| 542 // TODO(tdanderson): Move common toggle-creation logic to TrayPopupUtils. |
| 543 // See crbug.com/614453. |
| 544 toggle_ = new views::ToggleButton(this); |
| 545 toggle_->SetFocusForPlatform(); |
| 546 toggle_->SetAccessibleName( |
| 547 ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
| 548 IDS_ASH_STATUS_TRAY_BLUETOOTH)); |
| 549 tri_view()->AddView(TriView::Container::END, toggle_); |
| 550 |
| 551 settings_ = CreateSettingsButton(login_); |
| 552 tri_view()->AddView(TriView::Container::END, settings_); |
| 538 return; | 553 return; |
| 539 } | 554 } |
| 540 | 555 |
| 541 throbber_ = new ThrobberView; | 556 throbber_ = new ThrobberView; |
| 542 throbber_->SetTooltipText( | 557 throbber_->SetTooltipText( |
| 543 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING)); | 558 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING)); |
| 544 title_row()->AddViewToRowNonMd(throbber_, false); | 559 title_row()->AddViewToRowNonMd(throbber_, false); |
| 545 | 560 |
| 546 // Do not allow toggling bluetooth in the lock screen. | 561 // Do not allow toggling bluetooth in the lock screen. |
| 547 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); | 562 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 detailed_->Update(); | 743 detailed_->Update(); |
| 729 } | 744 } |
| 730 | 745 |
| 731 void TrayBluetooth::OnBluetoothDiscoveringChanged() { | 746 void TrayBluetooth::OnBluetoothDiscoveringChanged() { |
| 732 if (!detailed_) | 747 if (!detailed_) |
| 733 return; | 748 return; |
| 734 detailed_->Update(); | 749 detailed_->Update(); |
| 735 } | 750 } |
| 736 | 751 |
| 737 } // namespace ash | 752 } // namespace ash |
| OLD | NEW |