OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/rotation/tray_rotation_lock.h" | 5 #include "ash/system/chromeos/rotation/tray_rotation_lock.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/system/tray/system_tray.h" | 8 #include "ash/common/system/tray/system_tray.h" |
9 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
10 #include "ash/common/system/tray/tray_item_more.h" | 10 #include "ash/common/system/tray/tray_item_more.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 SetVisible(false); | 77 SetVisible(false); |
78 } | 78 } |
79 | 79 |
80 void RotationLockDefaultView::UpdateImage() { | 80 void RotationLockDefaultView::UpdateImage() { |
81 const bool rotation_locked = | 81 const bool rotation_locked = |
82 Shell::GetInstance()->screen_orientation_controller()->rotation_locked(); | 82 Shell::GetInstance()->screen_orientation_controller()->rotation_locked(); |
83 if (MaterialDesignController::UseMaterialDesignSystemIcons()) { | 83 if (MaterialDesignController::UseMaterialDesignSystemIcons()) { |
84 const gfx::VectorIconId icon_id = | 84 const gfx::VectorIconId icon_id = |
85 rotation_locked ? gfx::VectorIconId::SYSTEM_MENU_ROTATION_LOCK_LOCKED | 85 rotation_locked ? gfx::VectorIconId::SYSTEM_MENU_ROTATION_LOCK_LOCKED |
86 : gfx::VectorIconId::SYSTEM_MENU_ROTATION_LOCK_AUTO; | 86 : gfx::VectorIconId::SYSTEM_MENU_ROTATION_LOCK_AUTO; |
87 gfx::ImageSkia image_md = | 87 SetImage(gfx::CreateVectorIcon(icon_id, kMenuIconSize, kMenuIconColor)); |
88 CreateVectorIcon(icon_id, kMenuIconSize, kMenuIconColor); | |
89 SetImage(&image_md); | |
90 } else { | 88 } else { |
91 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 89 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
92 const int resource_id = rotation_locked | 90 const int resource_id = rotation_locked |
93 ? IDR_AURA_UBER_TRAY_AUTO_ROTATION_LOCKED_DARK | 91 ? IDR_AURA_UBER_TRAY_AUTO_ROTATION_LOCKED_DARK |
94 : IDR_AURA_UBER_TRAY_AUTO_ROTATION_DARK; | 92 : IDR_AURA_UBER_TRAY_AUTO_ROTATION_DARK; |
95 SetImage(bundle.GetImageNamed(resource_id).ToImageSkia()); | 93 SetImage(*bundle.GetImageNamed(resource_id).ToImageSkia()); |
96 } | 94 } |
97 | 95 |
98 base::string16 label = l10n_util::GetStringUTF16( | 96 base::string16 label = l10n_util::GetStringUTF16( |
99 rotation_locked ? IDS_ASH_STATUS_TRAY_ROTATION_LOCK_LOCKED | 97 rotation_locked ? IDS_ASH_STATUS_TRAY_ROTATION_LOCK_LOCKED |
100 : IDS_ASH_STATUS_TRAY_ROTATION_LOCK_AUTO); | 98 : IDS_ASH_STATUS_TRAY_ROTATION_LOCK_AUTO); |
101 SetLabel(label); | 99 SetLabel(label); |
102 SetAccessibleName(label); | 100 SetAccessibleName(label); |
103 } | 101 } |
104 | 102 |
105 } // namespace tray | 103 } // namespace tray |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 175 } |
178 | 176 |
179 void TrayRotationLock::StopObservingShell() { | 177 void TrayRotationLock::StopObservingShell() { |
180 if (!observing_shell_) | 178 if (!observing_shell_) |
181 return; | 179 return; |
182 WmShell::Get()->RemoveShellObserver(this); | 180 WmShell::Get()->RemoveShellObserver(this); |
183 observing_shell_ = false; | 181 observing_shell_ = false; |
184 } | 182 } |
185 | 183 |
186 } // namespace ash | 184 } // namespace ash |
OLD | NEW |