| 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/tray_item_more.h" | 7 #include "ash/common/system/tray/tray_item_more.h" |
| 8 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 8 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 10 #include "ash/display/screen_orientation_controller_chromeos.h" | 10 #include "ash/display/screen_orientation_controller_chromeos.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 void UpdateImage(); | 40 void UpdateImage(); |
| 41 | 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(RotationLockDefaultView); | 42 DISALLOW_COPY_AND_ASSIGN(RotationLockDefaultView); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 RotationLockDefaultView::RotationLockDefaultView(SystemTrayItem* owner) | 45 RotationLockDefaultView::RotationLockDefaultView(SystemTrayItem* owner) |
| 46 : TrayItemMore(owner, false) { | 46 : TrayItemMore(owner, false) { |
| 47 UpdateImage(); | 47 UpdateImage(); |
| 48 SetVisible(Shell::GetInstance() | 48 SetVisible(WmShell::Get() |
| 49 ->maximize_mode_controller() | 49 ->maximize_mode_controller() |
| 50 ->IsMaximizeModeWindowManagerEnabled()); | 50 ->IsMaximizeModeWindowManagerEnabled()); |
| 51 WmShell::Get()->AddShellObserver(this); | 51 WmShell::Get()->AddShellObserver(this); |
| 52 } | 52 } |
| 53 | 53 |
| 54 RotationLockDefaultView::~RotationLockDefaultView() { | 54 RotationLockDefaultView::~RotationLockDefaultView() { |
| 55 WmShell::Get()->RemoveShellObserver(this); | 55 WmShell::Get()->RemoveShellObserver(this); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool RotationLockDefaultView::PerformAction(const ui::Event& event) { | 58 bool RotationLockDefaultView::PerformAction(const ui::Event& event) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 StopObservingShell(); | 133 StopObservingShell(); |
| 134 TrayImageItem::DestroyTrayView(); | 134 TrayImageItem::DestroyTrayView(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool TrayRotationLock::GetInitialVisibility() { | 137 bool TrayRotationLock::GetInitialVisibility() { |
| 138 return ShouldBeVisible(); | 138 return ShouldBeVisible(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool TrayRotationLock::ShouldBeVisible() { | 141 bool TrayRotationLock::ShouldBeVisible() { |
| 142 return OnPrimaryDisplay() && | 142 return OnPrimaryDisplay() && |
| 143 Shell::GetInstance() | 143 WmShell::Get() |
| 144 ->maximize_mode_controller() | 144 ->maximize_mode_controller() |
| 145 ->IsMaximizeModeWindowManagerEnabled() && | 145 ->IsMaximizeModeWindowManagerEnabled() && |
| 146 Shell::GetInstance() | 146 Shell::GetInstance() |
| 147 ->screen_orientation_controller() | 147 ->screen_orientation_controller() |
| 148 ->rotation_locked(); | 148 ->rotation_locked(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool TrayRotationLock::OnPrimaryDisplay() const { | 151 bool TrayRotationLock::OnPrimaryDisplay() const { |
| 152 gfx::NativeView native_view = system_tray()->GetWidget()->GetNativeView(); | 152 gfx::NativeView native_view = system_tray()->GetWidget()->GetNativeView(); |
| 153 display::Display parent_display = | 153 display::Display parent_display = |
| (...skipping 12 matching lines...) Expand all Loading... |
| 166 } | 166 } |
| 167 | 167 |
| 168 void TrayRotationLock::StopObservingShell() { | 168 void TrayRotationLock::StopObservingShell() { |
| 169 if (!observing_shell_) | 169 if (!observing_shell_) |
| 170 return; | 170 return; |
| 171 WmShell::Get()->RemoveShellObserver(this); | 171 WmShell::Get()->RemoveShellObserver(this); |
| 172 observing_shell_ = false; | 172 observing_shell_ = false; |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // namespace ash | 175 } // namespace ash |
| OLD | NEW |