| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <cstring> | 9 #include <cstring> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 if (!Shell::GetInstance()->in_mus()) { | 218 if (!Shell::GetInstance()->in_mus()) { |
| 219 root_window_controller_observer_.reset( | 219 root_window_controller_observer_.reset( |
| 220 new RootWindowControllerObserverImpl(this)); | 220 new RootWindowControllerObserverImpl(this)); |
| 221 WmWindowAura::Get(root_window_) | 221 WmWindowAura::Get(root_window_) |
| 222 ->GetRootWindowController() | 222 ->GetRootWindowController() |
| 223 ->AddObserver(root_window_controller_observer_.get()); | 223 ->AddObserver(root_window_controller_observer_.get()); |
| 224 } | 224 } |
| 225 Shell::GetInstance()->lock_state_controller()->AddObserver(this); | 225 Shell::GetInstance()->lock_state_controller()->AddObserver(this); |
| 226 aura::client::GetActivationClient(root_window_)->AddObserver(this); | 226 aura::client::GetActivationClient(root_window_)->AddObserver(this); |
| 227 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this); | 227 WmShell::Get()->GetSessionStateDelegate()->AddSessionStateObserver(this); |
| 228 } | 228 } |
| 229 | 229 |
| 230 ShelfLayoutManager::~ShelfLayoutManager() { | 230 ShelfLayoutManager::~ShelfLayoutManager() { |
| 231 if (update_shelf_observer_) | 231 if (update_shelf_observer_) |
| 232 update_shelf_observer_->Detach(); | 232 update_shelf_observer_->Detach(); |
| 233 | 233 |
| 234 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, | 234 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, |
| 235 WillDeleteShelfLayoutManager()); | 235 WillDeleteShelfLayoutManager()); |
| 236 WmShell::Get()->RemoveShellObserver(this); | 236 WmShell::Get()->RemoveShellObserver(this); |
| 237 Shell::GetInstance()->lock_state_controller()->RemoveObserver(this); | 237 Shell::GetInstance()->lock_state_controller()->RemoveObserver(this); |
| 238 Shell::GetInstance()->session_state_delegate()->RemoveSessionStateObserver( | 238 WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver( |
| 239 this); | 239 this); |
| 240 if (root_window_controller_observer_) { | 240 if (root_window_controller_observer_) { |
| 241 WmWindowAura::Get(root_window_) | 241 WmWindowAura::Get(root_window_) |
| 242 ->GetRootWindowController() | 242 ->GetRootWindowController() |
| 243 ->RemoveObserver(root_window_controller_observer_.get()); | 243 ->RemoveObserver(root_window_controller_observer_.get()); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 void ShelfLayoutManager::PrepareForShutdown() { | 247 void ShelfLayoutManager::PrepareForShutdown() { |
| 248 in_shutdown_ = true; | 248 in_shutdown_ = true; |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 } | 567 } |
| 568 | 568 |
| 569 void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) { | 569 void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) { |
| 570 bool keyboard_is_about_to_hide = false; | 570 bool keyboard_is_about_to_hide = false; |
| 571 if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty()) | 571 if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty()) |
| 572 keyboard_is_about_to_hide = true; | 572 keyboard_is_about_to_hide = true; |
| 573 | 573 |
| 574 keyboard_bounds_ = new_bounds; | 574 keyboard_bounds_ = new_bounds; |
| 575 OnWindowResized(); | 575 OnWindowResized(); |
| 576 | 576 |
| 577 SessionStateDelegate* session_state_delegate = | |
| 578 Shell::GetInstance()->session_state_delegate(); | |
| 579 | |
| 580 // On login screen if keyboard has been just hidden, update bounds just once | 577 // On login screen if keyboard has been just hidden, update bounds just once |
| 581 // but ignore target_bounds.work_area_insets since shelf overlaps with login | 578 // but ignore target_bounds.work_area_insets since shelf overlaps with login |
| 582 // window. | 579 // window. |
| 583 if (session_state_delegate->IsUserSessionBlocked() && | 580 if (WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked() && |
| 584 keyboard_is_about_to_hide) { | 581 keyboard_is_about_to_hide) { |
| 585 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); | 582 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); |
| 586 } | 583 } |
| 587 } | 584 } |
| 588 | 585 |
| 589 bool ShelfLayoutManager::IsHorizontalAlignment() const { | 586 bool ShelfLayoutManager::IsHorizontalAlignment() const { |
| 590 return ::ash::IsHorizontalAlignment(GetAlignment()); | 587 return ::ash::IsHorizontalAlignment(GetAlignment()); |
| 591 } | 588 } |
| 592 | 589 |
| 593 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { | 590 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 if (ash::MaterialDesignController::IsShelfMaterial()) { | 1207 if (ash::MaterialDesignController::IsShelfMaterial()) { |
| 1211 return (state.visibility_state == SHELF_AUTO_HIDE && | 1208 return (state.visibility_state == SHELF_AUTO_HIDE && |
| 1212 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) | 1209 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) |
| 1213 ? 1.0f | 1210 ? 1.0f |
| 1214 : 0.0f; | 1211 : 0.0f; |
| 1215 } | 1212 } |
| 1216 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; | 1213 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; |
| 1217 } | 1214 } |
| 1218 | 1215 |
| 1219 } // namespace ash | 1216 } // namespace ash |
| OLD | NEW |