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