| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 bool TrayRotationLock::GetInitialVisibility() { | 196 bool TrayRotationLock::GetInitialVisibility() { |
| 197 return ShouldBeVisible(); | 197 return ShouldBeVisible(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool TrayRotationLock::ShouldBeVisible() { | 200 bool TrayRotationLock::ShouldBeVisible() { |
| 201 return OnPrimaryDisplay() && IsMaximizeModeWindowManagerEnabled() && | 201 return OnPrimaryDisplay() && IsMaximizeModeWindowManagerEnabled() && |
| 202 IsUserRotationLocked(); | 202 IsUserRotationLocked(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 bool TrayRotationLock::OnPrimaryDisplay() const { | 205 bool TrayRotationLock::OnPrimaryDisplay() const { |
| 206 gfx::NativeView native_view = system_tray()->GetWidget()->GetNativeView(); | 206 gfx::NativeView native_window = system_tray()->GetWidget()->GetNativeWindow(); |
| 207 display::Display parent_display = | 207 display::Display parent_display = |
| 208 display::Screen::GetScreen()->GetDisplayNearestWindow(native_view); | 208 display::Screen::GetScreen()->GetDisplayNearestWindow(native_window); |
| 209 return parent_display.IsInternal(); | 209 return parent_display.IsInternal(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void TrayRotationLock::StopObservingRotation() { | 212 void TrayRotationLock::StopObservingRotation() { |
| 213 ScreenOrientationController* controller = | 213 ScreenOrientationController* controller = |
| 214 Shell::GetInstance()->screen_orientation_controller(); | 214 Shell::GetInstance()->screen_orientation_controller(); |
| 215 if (controller) | 215 if (controller) |
| 216 controller->RemoveObserver(this); | 216 controller->RemoveObserver(this); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace ash | 219 } // namespace ash |
| OLD | NEW |