| 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" | |
| 8 #include "ash/common/system/tray/actionable_view.h" | 7 #include "ash/common/system/tray/actionable_view.h" |
| 9 #include "ash/common/system/tray/system_tray.h" | 8 #include "ash/common/system/tray/system_tray.h" |
| 10 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
| 11 #include "ash/common/system/tray/tray_popup_item_style.h" | 10 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 12 #include "ash/common/system/tray/tray_popup_utils.h" | 11 #include "ash/common/system/tray/tray_popup_utils.h" |
| 13 #include "ash/common/system/tray/tri_view.h" | 12 #include "ash/common/system/tray/tri_view.h" |
| 14 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 13 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 15 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 16 #include "ash/display/screen_orientation_controller_chromeos.h" | 15 #include "ash/display/screen_orientation_controller_chromeos.h" |
| 17 #include "ash/resources/vector_icons/vector_icons.h" | 16 #include "ash/resources/vector_icons/vector_icons.h" |
| 18 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 19 #include "grit/ash_resources.h" | |
| 20 #include "grit/ash_strings.h" | 18 #include "grit/ash_strings.h" |
| 21 #include "ui/accessibility/ax_node_data.h" | 19 #include "ui/accessibility/ax_node_data.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | |
| 24 #include "ui/display/display.h" | 21 #include "ui/display/display.h" |
| 25 #include "ui/gfx/paint_vector_icon.h" | 22 #include "ui/gfx/paint_vector_icon.h" |
| 26 #include "ui/views/controls/image_view.h" | 23 #include "ui/views/controls/image_view.h" |
| 27 #include "ui/views/controls/label.h" | 24 #include "ui/views/controls/label.h" |
| 28 #include "ui/views/layout/fill_layout.h" | 25 #include "ui/views/layout/fill_layout.h" |
| 29 | 26 |
| 30 namespace ash { | 27 namespace ash { |
| 31 | 28 |
| 32 namespace { | 29 namespace { |
| 33 | 30 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 151 } |
| 155 | 152 |
| 156 void RotationLockDefaultView::OnRotationLockChanged(bool rotation_locked) { | 153 void RotationLockDefaultView::OnRotationLockChanged(bool rotation_locked) { |
| 157 Update(); | 154 Update(); |
| 158 } | 155 } |
| 159 | 156 |
| 160 } // namespace tray | 157 } // namespace tray |
| 161 | 158 |
| 162 TrayRotationLock::TrayRotationLock(SystemTray* system_tray) | 159 TrayRotationLock::TrayRotationLock(SystemTray* system_tray) |
| 163 : TrayImageItem(system_tray, | 160 : TrayImageItem(system_tray, |
| 164 IDR_AURA_UBER_TRAY_AUTO_ROTATION_LOCKED, | 161 kSystemTrayRotationLockLockedIcon, |
| 165 UMA_ROTATION_LOCK) { | 162 UMA_ROTATION_LOCK) { |
| 166 WmShell::Get()->AddShellObserver(this); | 163 WmShell::Get()->AddShellObserver(this); |
| 167 } | 164 } |
| 168 | 165 |
| 169 TrayRotationLock::~TrayRotationLock() { | 166 TrayRotationLock::~TrayRotationLock() { |
| 170 WmShell::Get()->RemoveShellObserver(this); | 167 WmShell::Get()->RemoveShellObserver(this); |
| 171 } | 168 } |
| 172 | 169 |
| 173 void TrayRotationLock::OnRotationLockChanged(bool rotation_locked) { | 170 void TrayRotationLock::OnRotationLockChanged(bool rotation_locked) { |
| 174 tray_view()->SetVisible(ShouldBeVisible()); | 171 tray_view()->SetVisible(ShouldBeVisible()); |
| 175 } | 172 } |
| 176 | 173 |
| 177 views::View* TrayRotationLock::CreateDefaultView(LoginStatus status) { | 174 views::View* TrayRotationLock::CreateDefaultView(LoginStatus status) { |
| 178 if (OnPrimaryDisplay()) | 175 if (OnPrimaryDisplay()) |
| 179 return new tray::RotationLockDefaultView(this); | 176 return new tray::RotationLockDefaultView(this); |
| 180 return NULL; | 177 return nullptr; |
| 181 } | 178 } |
| 182 | 179 |
| 183 void TrayRotationLock::OnMaximizeModeStarted() { | 180 void TrayRotationLock::OnMaximizeModeStarted() { |
| 184 tray_view()->SetVisible(IsRotationLocked()); | 181 tray_view()->SetVisible(IsRotationLocked()); |
| 185 Shell::GetInstance()->screen_orientation_controller()->AddObserver(this); | 182 Shell::GetInstance()->screen_orientation_controller()->AddObserver(this); |
| 186 } | 183 } |
| 187 | 184 |
| 188 void TrayRotationLock::OnMaximizeModeEnded() { | 185 void TrayRotationLock::OnMaximizeModeEnded() { |
| 189 tray_view()->SetVisible(false); | 186 tray_view()->SetVisible(false); |
| 190 StopObservingRotation(); | 187 StopObservingRotation(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 213 } | 210 } |
| 214 | 211 |
| 215 void TrayRotationLock::StopObservingRotation() { | 212 void TrayRotationLock::StopObservingRotation() { |
| 216 ScreenOrientationController* controller = | 213 ScreenOrientationController* controller = |
| 217 Shell::GetInstance()->screen_orientation_controller(); | 214 Shell::GetInstance()->screen_orientation_controller(); |
| 218 if (controller) | 215 if (controller) |
| 219 controller->RemoveObserver(this); | 216 controller->RemoveObserver(this); |
| 220 } | 217 } |
| 221 | 218 |
| 222 } // namespace ash | 219 } // namespace ash |
| OLD | NEW |