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/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
10 #include "ash/system/tray/tray_constants.h" | 10 #include "ash/system/tray/tray_constants.h" |
11 #include "ash/system/tray/tray_details_view.h" | 11 #include "ash/system/tray/tray_details_view.h" |
12 #include "ash/system/tray/tray_item_more.h" | 12 #include "ash/system/tray/tray_item_more.h" |
13 #include "ash/system/tray/tray_views.h" | 13 #include "ash/system/tray/tray_views.h" |
14 #include "grit/ash_strings.h" | 14 #include "grit/ash_strings.h" |
15 #include "grit/ui_resources.h" | 15 #include "grit/ui_resources.h" |
| 16 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
18 #include "ui/views/controls/image_view.h" | 19 #include "ui/views/controls/image_view.h" |
19 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
20 #include "ui/views/layout/box_layout.h" | 21 #include "ui/views/layout/box_layout.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 const int kDeviceListHeight = 276; | 24 const int kDeviceListHeight = 276; |
24 } | 25 } |
25 | 26 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // Do not allow toggling bluetooth in the lock screen. | 96 // Do not allow toggling bluetooth in the lock screen. |
96 ash::SystemTrayDelegate* delegate = | 97 ash::SystemTrayDelegate* delegate = |
97 ash::Shell::GetInstance()->tray_delegate(); | 98 ash::Shell::GetInstance()->tray_delegate(); |
98 toggle_bluetooth_ = new TrayPopupHeaderButton(this, | 99 toggle_bluetooth_ = new TrayPopupHeaderButton(this, |
99 IDR_AURA_UBER_TRAY_BLUETOOTH_ENABLED, | 100 IDR_AURA_UBER_TRAY_BLUETOOTH_ENABLED, |
100 IDR_AURA_UBER_TRAY_BLUETOOTH_DISABLED, | 101 IDR_AURA_UBER_TRAY_BLUETOOTH_DISABLED, |
101 IDR_AURA_UBER_TRAY_BLUETOOTH_ENABLED_HOVER, | 102 IDR_AURA_UBER_TRAY_BLUETOOTH_ENABLED_HOVER, |
102 IDR_AURA_UBER_TRAY_BLUETOOTH_DISABLED_HOVER, | 103 IDR_AURA_UBER_TRAY_BLUETOOTH_DISABLED_HOVER, |
103 IDS_ASH_STATUS_TRAY_BLUETOOTH); | 104 IDS_ASH_STATUS_TRAY_BLUETOOTH); |
104 toggle_bluetooth_->SetToggled(!delegate->GetBluetoothEnabled()); | 105 toggle_bluetooth_->SetToggled(!delegate->GetBluetoothEnabled()); |
| 106 toggle_bluetooth_->SetTooltipText( |
| 107 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISABLE_BLUETOOTH)); |
| 108 toggle_bluetooth_->SetToggledTooltipText( |
| 109 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ENABLE_BLUETOOTH)); |
105 footer()->AddButton(toggle_bluetooth_); | 110 footer()->AddButton(toggle_bluetooth_); |
106 } | 111 } |
107 | 112 |
108 void AppendDeviceList(const BluetoothDeviceList& list) { | 113 void AppendDeviceList(const BluetoothDeviceList& list) { |
109 device_map_.clear(); | 114 device_map_.clear(); |
110 CreateScrollableList(); | 115 CreateScrollableList(); |
111 | 116 |
112 for (size_t i = 0; i < list.size(); i++) { | 117 for (size_t i = 0; i < list.size(); i++) { |
113 HoverHighlightView* container = new HoverHighlightView(this); | 118 HoverHighlightView* container = new HoverHighlightView(this); |
114 container->set_fixed_height(kTrayPopupItemHeight); | 119 container->set_fixed_height(kTrayPopupItemHeight); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 BluetoothDeviceList list; | 229 BluetoothDeviceList list; |
225 Shell::GetInstance()->tray_delegate()->GetAvailableBluetoothDevices(&list); | 230 Shell::GetInstance()->tray_delegate()->GetAvailableBluetoothDevices(&list); |
226 if (default_) | 231 if (default_) |
227 default_->UpdateLabel(); | 232 default_->UpdateLabel(); |
228 else if (detailed_) | 233 else if (detailed_) |
229 detailed_->Update(list); | 234 detailed_->Update(list); |
230 } | 235 } |
231 | 236 |
232 } // namespace internal | 237 } // namespace internal |
233 } // namespace ash | 238 } // namespace ash |
OLD | NEW |