| 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_menu_toggle_button.h" |
| 11 #include "ash/common/system/tray/system_tray.h" | 12 #include "ash/common/system/tray/system_tray.h" |
| 12 #include "ash/common/system/tray/system_tray_delegate.h" | 13 #include "ash/common/system/tray/system_tray_delegate.h" |
| 13 #include "ash/common/system/tray/system_tray_notifier.h" | 14 #include "ash/common/system/tray/system_tray_notifier.h" |
| 14 #include "ash/common/system/tray/throbber_view.h" | 15 #include "ash/common/system/tray/throbber_view.h" |
| 15 #include "ash/common/system/tray/tray_constants.h" | 16 #include "ash/common/system/tray/tray_constants.h" |
| 16 #include "ash/common/system/tray/tray_details_view.h" | 17 #include "ash/common/system/tray/tray_details_view.h" |
| 17 #include "ash/common/system/tray/tray_item_more.h" | 18 #include "ash/common/system/tray/tray_item_more.h" |
| 18 #include "ash/common/system/tray/tray_popup_header_button.h" | 19 #include "ash/common/system/tray/tray_popup_header_button.h" |
| 19 #include "ash/common/system/tray/tray_popup_item_style.h" | 20 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 20 #include "ash/common/system/tray/tray_popup_utils.h" | 21 #include "ash/common/system/tray/tray_popup_utils.h" |
| 21 #include "ash/common/system/tray/tri_view.h" | 22 #include "ash/common/system/tray/tri_view.h" |
| 22 #include "ash/common/wm_shell.h" | 23 #include "ash/common/wm_shell.h" |
| 23 #include "ash/resources/vector_icons/vector_icons.h" | 24 #include "ash/resources/vector_icons/vector_icons.h" |
| 24 #include "device/bluetooth/bluetooth_common.h" | 25 #include "device/bluetooth/bluetooth_common.h" |
| 25 #include "grit/ash_resources.h" | 26 #include "grit/ash_resources.h" |
| 26 #include "grit/ash_strings.h" | 27 #include "grit/ash_strings.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 29 #include "ui/gfx/color_palette.h" | 30 #include "ui/gfx/color_palette.h" |
| 30 #include "ui/gfx/image/image.h" | 31 #include "ui/gfx/image/image.h" |
| 31 #include "ui/gfx/paint_vector_icon.h" | 32 #include "ui/gfx/paint_vector_icon.h" |
| 32 #include "ui/gfx/vector_icons_public.h" | 33 #include "ui/gfx/vector_icons_public.h" |
| 33 #include "ui/views/controls/button/toggle_button.h" | |
| 34 #include "ui/views/controls/image_view.h" | 34 #include "ui/views/controls/image_view.h" |
| 35 #include "ui/views/controls/label.h" | 35 #include "ui/views/controls/label.h" |
| 36 #include "ui/views/controls/progress_bar.h" | 36 #include "ui/views/controls/progress_bar.h" |
| 37 #include "ui/views/layout/box_layout.h" | 37 #include "ui/views/layout/box_layout.h" |
| 38 | 38 |
| 39 namespace ash { | 39 namespace ash { |
| 40 namespace tray { | 40 namespace tray { |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 bool UseMd() { | 43 bool UseMd() { |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 return; | 534 return; |
| 535 | 535 |
| 536 if (UseMd()) { | 536 if (UseMd()) { |
| 537 DCHECK(!toggle_); | 537 DCHECK(!toggle_); |
| 538 DCHECK(!settings_); | 538 DCHECK(!settings_); |
| 539 | 539 |
| 540 tri_view()->SetContainerVisible(TriView::Container::END, true); | 540 tri_view()->SetContainerVisible(TriView::Container::END, true); |
| 541 | 541 |
| 542 // TODO(tdanderson): Move common toggle-creation logic to TrayPopupUtils. | 542 // TODO(tdanderson): Move common toggle-creation logic to TrayPopupUtils. |
| 543 // See crbug.com/614453. | 543 // See crbug.com/614453. |
| 544 toggle_ = new views::ToggleButton(this); | 544 toggle_ = new SystemMenuToggleButton(this, IDS_ASH_STATUS_TRAY_BLUETOOTH); |
| 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_); | 545 tri_view()->AddView(TriView::Container::END, toggle_); |
| 550 | 546 |
| 551 settings_ = CreateSettingsButton(login_); | 547 settings_ = CreateSettingsButton(login_); |
| 552 tri_view()->AddView(TriView::Container::END, settings_); | 548 tri_view()->AddView(TriView::Container::END, settings_); |
| 553 return; | 549 return; |
| 554 } | 550 } |
| 555 | 551 |
| 556 throbber_ = new ThrobberView; | 552 throbber_ = new ThrobberView; |
| 557 throbber_->SetTooltipText( | 553 throbber_->SetTooltipText( |
| 558 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING)); | 554 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING)); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 // Not used in material design. | 664 // Not used in material design. |
| 669 TrayPopupHeaderButton* toggle_bluetooth_; | 665 TrayPopupHeaderButton* toggle_bluetooth_; |
| 670 | 666 |
| 671 HoverHighlightView* enable_bluetooth_; | 667 HoverHighlightView* enable_bluetooth_; |
| 672 BluetoothDeviceList connected_devices_; | 668 BluetoothDeviceList connected_devices_; |
| 673 BluetoothDeviceList connecting_devices_; | 669 BluetoothDeviceList connecting_devices_; |
| 674 BluetoothDeviceList paired_not_connected_devices_; | 670 BluetoothDeviceList paired_not_connected_devices_; |
| 675 BluetoothDeviceList discovered_not_paired_devices_; | 671 BluetoothDeviceList discovered_not_paired_devices_; |
| 676 | 672 |
| 677 // The on/off toggle button used in material design. | 673 // The on/off toggle button used in material design. |
| 678 views::ToggleButton* toggle_; | 674 SystemMenuToggleButton* toggle_; |
| 679 | 675 |
| 680 // Only used in material design. | 676 // Only used in material design. |
| 681 views::Button* settings_; | 677 views::Button* settings_; |
| 682 | 678 |
| 683 // Only used in material design. | 679 // Only used in material design. |
| 684 // The container of the message "Bluetooth is disabled" and an icon. It should | 680 // The container of the message "Bluetooth is disabled" and an icon. It should |
| 685 // be shown instead of Bluetooth device list when Bluetooth is disabled. | 681 // be shown instead of Bluetooth device list when Bluetooth is disabled. |
| 686 views::View* disabled_panel_; | 682 views::View* disabled_panel_; |
| 687 | 683 |
| 688 DISALLOW_COPY_AND_ASSIGN(BluetoothDetailedView); | 684 DISALLOW_COPY_AND_ASSIGN(BluetoothDetailedView); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 detailed_->Update(); | 739 detailed_->Update(); |
| 744 } | 740 } |
| 745 | 741 |
| 746 void TrayBluetooth::OnBluetoothDiscoveringChanged() { | 742 void TrayBluetooth::OnBluetoothDiscoveringChanged() { |
| 747 if (!detailed_) | 743 if (!detailed_) |
| 748 return; | 744 return; |
| 749 detailed_->Update(); | 745 detailed_->Update(); |
| 750 } | 746 } |
| 751 | 747 |
| 752 } // namespace ash | 748 } // namespace ash |
| OLD | NEW |