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/resources/grit/ash_resources.h" | 7 #include "ash/resources/grit/ash_resources.h" |
8 #include "ash/resources/vector_icons/vector_icons.h" | 8 #include "ash/resources/vector_icons/vector_icons.h" |
9 #include "ash/session/session_state_delegate.h" | 9 #include "ash/session/session_state_delegate.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/shell_port.h" |
11 #include "ash/strings/grit/ash_strings.h" | 12 #include "ash/strings/grit/ash_strings.h" |
12 #include "ash/system/bluetooth/tray_bluetooth_helper.h" | 13 #include "ash/system/bluetooth/tray_bluetooth_helper.h" |
13 #include "ash/system/tray/hover_highlight_view.h" | 14 #include "ash/system/tray/hover_highlight_view.h" |
14 #include "ash/system/tray/system_tray.h" | 15 #include "ash/system/tray/system_tray.h" |
15 #include "ash/system/tray/system_tray_controller.h" | 16 #include "ash/system/tray/system_tray_controller.h" |
16 #include "ash/system/tray/system_tray_notifier.h" | 17 #include "ash/system/tray/system_tray_notifier.h" |
17 #include "ash/system/tray/throbber_view.h" | 18 #include "ash/system/tray/throbber_view.h" |
18 #include "ash/system/tray/tray_constants.h" | 19 #include "ash/system/tray/tray_constants.h" |
19 #include "ash/system/tray/tray_details_view.h" | 20 #include "ash/system/tray/tray_details_view.h" |
20 #include "ash/system/tray/tray_item_more.h" | 21 #include "ash/system/tray/tray_item_more.h" |
21 #include "ash/system/tray/tray_popup_item_style.h" | 22 #include "ash/system/tray/tray_popup_item_style.h" |
22 #include "ash/system/tray/tray_popup_utils.h" | 23 #include "ash/system/tray/tray_popup_utils.h" |
23 #include "ash/system/tray/tri_view.h" | 24 #include "ash/system/tray/tri_view.h" |
24 #include "ash/wm_shell.h" | |
25 #include "device/bluetooth/bluetooth_common.h" | 25 #include "device/bluetooth/bluetooth_common.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
28 #include "ui/gfx/color_palette.h" | 28 #include "ui/gfx/color_palette.h" |
29 #include "ui/gfx/image/image.h" | 29 #include "ui/gfx/image/image.h" |
30 #include "ui/gfx/paint_vector_icon.h" | 30 #include "ui/gfx/paint_vector_icon.h" |
31 #include "ui/views/controls/button/toggle_button.h" | 31 #include "ui/views/controls/button/toggle_button.h" |
32 #include "ui/views/controls/image_view.h" | 32 #include "ui/views/controls/image_view.h" |
33 #include "ui/views/controls/label.h" | 33 #include "ui/views/controls/label.h" |
34 #include "ui/views/controls/progress_bar.h" | 34 #include "ui/views/controls/progress_bar.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 return; | 451 return; |
452 | 452 |
453 UpdateClickedDevice(device_id, view); | 453 UpdateClickedDevice(device_id, view); |
454 helper->ConnectToBluetoothDevice(device_id); | 454 helper->ConnectToBluetoothDevice(device_id); |
455 } | 455 } |
456 | 456 |
457 void HandleButtonPressed(views::Button* sender, | 457 void HandleButtonPressed(views::Button* sender, |
458 const ui::Event& event) override { | 458 const ui::Event& event) override { |
459 if (sender == toggle_) { | 459 if (sender == toggle_) { |
460 TrayBluetoothHelper* helper = Shell::Get()->tray_bluetooth_helper(); | 460 TrayBluetoothHelper* helper = Shell::Get()->tray_bluetooth_helper(); |
461 WmShell::Get()->RecordUserMetricsAction( | 461 ShellPort::Get()->RecordUserMetricsAction( |
462 helper->GetBluetoothEnabled() ? UMA_STATUS_AREA_BLUETOOTH_DISABLED | 462 helper->GetBluetoothEnabled() ? UMA_STATUS_AREA_BLUETOOTH_DISABLED |
463 : UMA_STATUS_AREA_BLUETOOTH_ENABLED); | 463 : UMA_STATUS_AREA_BLUETOOTH_ENABLED); |
464 helper->ToggleBluetoothEnabled(); | 464 helper->ToggleBluetoothEnabled(); |
465 } else if (sender == settings_) { | 465 } else if (sender == settings_) { |
466 ShowSettings(); | 466 ShowSettings(); |
467 } else { | 467 } else { |
468 NOTREACHED(); | 468 NOTREACHED(); |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 CHECK(default_ == NULL); | 613 CHECK(default_ == NULL); |
614 default_ = new tray::BluetoothDefaultView(this); | 614 default_ = new tray::BluetoothDefaultView(this); |
615 default_->SetEnabled(status != LoginStatus::LOCKED); | 615 default_->SetEnabled(status != LoginStatus::LOCKED); |
616 default_->Update(); | 616 default_->Update(); |
617 return default_; | 617 return default_; |
618 } | 618 } |
619 | 619 |
620 views::View* TrayBluetooth::CreateDetailedView(LoginStatus status) { | 620 views::View* TrayBluetooth::CreateDetailedView(LoginStatus status) { |
621 if (!Shell::Get()->tray_bluetooth_helper()->GetBluetoothAvailable()) | 621 if (!Shell::Get()->tray_bluetooth_helper()->GetBluetoothAvailable()) |
622 return NULL; | 622 return NULL; |
623 WmShell::Get()->RecordUserMetricsAction( | 623 ShellPort::Get()->RecordUserMetricsAction( |
624 UMA_STATUS_AREA_DETAILED_BLUETOOTH_VIEW); | 624 UMA_STATUS_AREA_DETAILED_BLUETOOTH_VIEW); |
625 CHECK(detailed_ == NULL); | 625 CHECK(detailed_ == NULL); |
626 detailed_ = new tray::BluetoothDetailedView(this, status); | 626 detailed_ = new tray::BluetoothDetailedView(this, status); |
627 detailed_->Update(); | 627 detailed_->Update(); |
628 return detailed_; | 628 return detailed_; |
629 } | 629 } |
630 | 630 |
631 void TrayBluetooth::DestroyTrayView() {} | 631 void TrayBluetooth::DestroyTrayView() {} |
632 | 632 |
633 void TrayBluetooth::DestroyDefaultView() { | 633 void TrayBluetooth::DestroyDefaultView() { |
(...skipping 13 matching lines...) Expand all Loading... |
647 detailed_->Update(); | 647 detailed_->Update(); |
648 } | 648 } |
649 | 649 |
650 void TrayBluetooth::OnBluetoothDiscoveringChanged() { | 650 void TrayBluetooth::OnBluetoothDiscoveringChanged() { |
651 if (!detailed_) | 651 if (!detailed_) |
652 return; | 652 return; |
653 detailed_->Update(); | 653 detailed_->Update(); |
654 } | 654 } |
655 | 655 |
656 } // namespace ash | 656 } // namespace ash |
OLD | NEW |