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" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 } // namespace | 67 } // namespace |
68 | 68 |
69 class BluetoothDefaultView : public TrayItemMore { | 69 class BluetoothDefaultView : public TrayItemMore { |
70 public: | 70 public: |
71 BluetoothDefaultView(SystemTrayItem* owner, bool show_more) | 71 BluetoothDefaultView(SystemTrayItem* owner, bool show_more) |
72 : TrayItemMore(owner, show_more) { | 72 : TrayItemMore(owner, show_more) { |
73 if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { | 73 if (!MaterialDesignController::IsSystemTrayMenuMaterial()) { |
74 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 74 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
75 SetImage( | 75 SetImage( |
76 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH).ToImageSkia()); | 76 *bundle.GetImageNamed(IDR_AURA_UBER_TRAY_BLUETOOTH).ToImageSkia()); |
77 } | 77 } |
78 Update(); | 78 Update(); |
79 } | 79 } |
80 | 80 |
81 ~BluetoothDefaultView() override {} | 81 ~BluetoothDefaultView() override {} |
82 | 82 |
83 void Update() { | 83 void Update() { |
84 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); | 84 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
85 const bool enabled = delegate->GetBluetoothEnabled(); | 85 const bool enabled = delegate->GetBluetoothEnabled(); |
86 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 86 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { |
87 gfx::VectorIconId icon_id = | 87 gfx::VectorIconId icon_id = |
88 enabled ? gfx::VectorIconId::SYSTEM_MENU_BLUETOOTH | 88 enabled ? gfx::VectorIconId::SYSTEM_MENU_BLUETOOTH |
89 : gfx::VectorIconId::SYSTEM_MENU_BLUETOOTH_DISABLED; | 89 : gfx::VectorIconId::SYSTEM_MENU_BLUETOOTH_DISABLED; |
90 gfx::ImageSkia image = gfx::CreateVectorIcon(icon_id, kMenuIconColor); | 90 SetImage(gfx::CreateVectorIcon(icon_id, kMenuIconColor)); |
91 SetImage(&image); | |
92 } | 91 } |
93 | 92 |
94 if (delegate->GetBluetoothAvailable()) { | 93 if (delegate->GetBluetoothAvailable()) { |
95 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 94 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
96 const base::string16 label = rb.GetLocalizedString( | 95 const base::string16 label = rb.GetLocalizedString( |
97 enabled ? IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED | 96 enabled ? IDS_ASH_STATUS_TRAY_BLUETOOTH_ENABLED |
98 : IDS_ASH_STATUS_TRAY_BLUETOOTH_DISABLED); | 97 : IDS_ASH_STATUS_TRAY_BLUETOOTH_DISABLED); |
99 SetLabel(label); | 98 SetLabel(label); |
100 SetAccessibleName(label); | 99 SetAccessibleName(label); |
101 SetVisible(true); | 100 SetVisible(true); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 detailed_->Update(); | 458 detailed_->Update(); |
460 } | 459 } |
461 | 460 |
462 void TrayBluetooth::OnBluetoothDiscoveringChanged() { | 461 void TrayBluetooth::OnBluetoothDiscoveringChanged() { |
463 if (!detailed_) | 462 if (!detailed_) |
464 return; | 463 return; |
465 detailed_->Update(); | 464 detailed_->Update(); |
466 } | 465 } |
467 | 466 |
468 } // namespace ash | 467 } // namespace ash |
OLD | NEW |