Chromium Code Reviews| 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/system/tray/actionable_view.h" | 7 #include "ash/common/system/tray/actionable_view.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_popup_item_style.h" | 10 #include "ash/common/system/tray/tray_popup_item_style.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 } // namespace tray | 157 } // namespace tray |
| 158 | 158 |
| 159 TrayRotationLock::TrayRotationLock(SystemTray* system_tray) | 159 TrayRotationLock::TrayRotationLock(SystemTray* system_tray) |
| 160 : TrayImageItem(system_tray, | 160 : TrayImageItem(system_tray, |
| 161 kSystemTrayRotationLockLockedIcon, | 161 kSystemTrayRotationLockLockedIcon, |
| 162 UMA_ROTATION_LOCK) { | 162 UMA_ROTATION_LOCK) { |
| 163 Shell::GetInstance()->AddShellObserver(this); | 163 Shell::GetInstance()->AddShellObserver(this); |
| 164 } | 164 } |
| 165 | 165 |
| 166 TrayRotationLock::~TrayRotationLock() { | 166 TrayRotationLock::~TrayRotationLock() { |
| 167 StopObservingRotation(); | |
|
jonross
2017/03/24 16:46:49
Are we sending state change notifications during s
oshima
2017/03/24 17:19:35
This was for the test which wasn't following the n
jonross
2017/03/24 17:32:21
Acknowledged.
| |
| 167 Shell::GetInstance()->RemoveShellObserver(this); | 168 Shell::GetInstance()->RemoveShellObserver(this); |
| 168 } | 169 } |
| 169 | 170 |
| 170 void TrayRotationLock::OnUserRotationLockChanged() { | 171 void TrayRotationLock::OnUserRotationLockChanged() { |
| 171 tray_view()->SetVisible(ShouldBeVisible()); | 172 tray_view()->SetVisible(ShouldBeVisible()); |
| 172 } | 173 } |
| 173 | 174 |
| 174 views::View* TrayRotationLock::CreateDefaultView(LoginStatus status) { | 175 views::View* TrayRotationLock::CreateDefaultView(LoginStatus status) { |
| 175 if (OnPrimaryDisplay()) | 176 if (OnPrimaryDisplay()) |
| 176 return new tray::RotationLockDefaultView(this); | 177 return new tray::RotationLockDefaultView(this); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 } | 211 } |
| 211 | 212 |
| 212 void TrayRotationLock::StopObservingRotation() { | 213 void TrayRotationLock::StopObservingRotation() { |
| 213 ScreenOrientationController* controller = | 214 ScreenOrientationController* controller = |
| 214 Shell::GetInstance()->screen_orientation_controller(); | 215 Shell::GetInstance()->screen_orientation_controller(); |
| 215 if (controller) | 216 if (controller) |
| 216 controller->RemoveObserver(this); | 217 controller->RemoveObserver(this); |
| 217 } | 218 } |
| 218 | 219 |
| 219 } // namespace ash | 220 } // namespace ash |
| OLD | NEW |