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 <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "ash/metrics/user_metrics_recorder.h" | 12 #include "ash/metrics/user_metrics_recorder.h" |
13 #include "ash/resources/vector_icons/vector_icons.h" | 13 #include "ash/resources/vector_icons/vector_icons.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
15 #include "ash/strings/grit/ash_strings.h" | 15 #include "ash/strings/grit/ash_strings.h" |
16 #include "ash/system/bluetooth/tray_bluetooth_helper.h" | 16 #include "ash/system/bluetooth/tray_bluetooth_helper.h" |
17 #include "ash/system/tray/hover_highlight_view.h" | 17 #include "ash/system/tray/hover_highlight_view.h" |
18 #include "ash/system/tray/system_tray.h" | 18 #include "ash/system/tray/system_tray.h" |
19 #include "ash/system/tray/system_tray_controller.h" | 19 #include "ash/system/tray/system_tray_controller.h" |
20 #include "ash/system/tray/system_tray_notifier.h" | 20 #include "ash/system/tray/system_tray_notifier.h" |
21 #include "ash/system/tray/tray_constants.h" | 21 #include "ash/system/tray/tray_constants.h" |
22 #include "ash/system/tray/tray_details_view.h" | 22 #include "ash/system/tray/tray_details_view.h" |
| 23 #include "ash/system/tray/tray_info_label.h" |
23 #include "ash/system/tray/tray_item_more.h" | 24 #include "ash/system/tray/tray_item_more.h" |
24 #include "ash/system/tray/tray_popup_item_style.h" | 25 #include "ash/system/tray/tray_popup_item_style.h" |
25 #include "ash/system/tray/tray_popup_utils.h" | 26 #include "ash/system/tray/tray_popup_utils.h" |
26 #include "ash/system/tray/tri_view.h" | 27 #include "ash/system/tray/tri_view.h" |
27 #include "device/bluetooth/bluetooth_common.h" | 28 #include "device/bluetooth/bluetooth_common.h" |
28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/gfx/color_palette.h" | 30 #include "ui/gfx/color_palette.h" |
30 #include "ui/gfx/geometry/insets.h" | 31 #include "ui/gfx/geometry/insets.h" |
31 #include "ui/gfx/image/image.h" | 32 #include "ui/gfx/image/image.h" |
32 #include "ui/gfx/paint_vector_icon.h" | 33 #include "ui/gfx/paint_vector_icon.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // present, also add a section header above the unpaired devices. | 308 // present, also add a section header above the unpaired devices. |
308 if (discovered_not_paired_devices_.size() > 0) { | 309 if (discovered_not_paired_devices_.size() > 0) { |
309 if (num_paired_devices > 0) | 310 if (num_paired_devices > 0) |
310 AddScrollListSubHeader(IDS_ASH_STATUS_TRAY_BLUETOOTH_UNPAIRED_DEVICES); | 311 AddScrollListSubHeader(IDS_ASH_STATUS_TRAY_BLUETOOTH_UNPAIRED_DEVICES); |
311 AppendSameTypeDevicesToScrollList(discovered_not_paired_devices_, false, | 312 AppendSameTypeDevicesToScrollList(discovered_not_paired_devices_, false, |
312 false, bluetooth_enabled); | 313 false, bluetooth_enabled); |
313 } | 314 } |
314 | 315 |
315 // Show user Bluetooth state if there is no bluetooth devices in list. | 316 // Show user Bluetooth state if there is no bluetooth devices in list. |
316 if (device_map_.size() == 0 && bluetooth_available && bluetooth_enabled) { | 317 if (device_map_.size() == 0 && bluetooth_available && bluetooth_enabled) { |
317 scroll_content()->AddChildView( | 318 scroll_content()->AddChildView(new TrayInfoLabel( |
318 new InfoLabel(IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING)); | 319 nullptr /* delegate */, IDS_ASH_STATUS_TRAY_BLUETOOTH_DISCOVERING)); |
319 } | 320 } |
320 | 321 |
321 // Focus the device which was focused before the device-list update. | 322 // Focus the device which was focused before the device-list update. |
322 if (!focused_device_address.empty()) | 323 if (!focused_device_address.empty()) |
323 FocusDeviceByAddress(focused_device_address); | 324 FocusDeviceByAddress(focused_device_address); |
324 | 325 |
325 scroll_content()->InvalidateLayout(); | 326 scroll_content()->InvalidateLayout(); |
326 } | 327 } |
327 | 328 |
328 void AppendSameTypeDevicesToScrollList(const BluetoothDeviceList& list, | 329 void AppendSameTypeDevicesToScrollList(const BluetoothDeviceList& list, |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 detailed_->Update(); | 571 detailed_->Update(); |
571 } | 572 } |
572 | 573 |
573 void TrayBluetooth::OnBluetoothDiscoveringChanged() { | 574 void TrayBluetooth::OnBluetoothDiscoveringChanged() { |
574 if (!detailed_) | 575 if (!detailed_) |
575 return; | 576 return; |
576 detailed_->Update(); | 577 detailed_->Update(); |
577 } | 578 } |
578 | 579 |
579 } // namespace ash | 580 } // namespace ash |
OLD | NEW |