| 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/wm/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 ShelfLayoutManager::AutoHideEventFilter::PreHandleGestureEvent( | 112 ShelfLayoutManager::AutoHideEventFilter::PreHandleGestureEvent( |
| 113 aura::Window* target, | 113 aura::Window* target, |
| 114 aura::GestureEvent* event) { | 114 aura::GestureEvent* event) { |
| 115 return ui::GESTURE_STATUS_UNKNOWN; // Not handled. | 115 return ui::GESTURE_STATUS_UNKNOWN; // Not handled. |
| 116 } | 116 } |
| 117 | 117 |
| 118 //////////////////////////////////////////////////////////////////////////////// | 118 //////////////////////////////////////////////////////////////////////////////// |
| 119 // ShelfLayoutManager, public: | 119 // ShelfLayoutManager, public: |
| 120 | 120 |
| 121 ShelfLayoutManager::ShelfLayoutManager(views::Widget* status) | 121 ShelfLayoutManager::ShelfLayoutManager(views::Widget* status) |
| 122 : root_window_(Shell::GetInstance()->GetRootWindow()), | 122 : root_window_(Shell::GetPrimaryRootWindow()), |
| 123 in_layout_(false), | 123 in_layout_(false), |
| 124 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT), | 124 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT), |
| 125 alignment_(SHELF_ALIGNMENT_BOTTOM), | 125 alignment_(SHELF_ALIGNMENT_BOTTOM), |
| 126 launcher_(NULL), | 126 launcher_(NULL), |
| 127 status_(status), | 127 status_(status), |
| 128 workspace_manager_(NULL), | 128 workspace_manager_(NULL), |
| 129 window_overlaps_shelf_(false) { | 129 window_overlaps_shelf_(false) { |
| 130 Shell::GetInstance()->AddShellObserver(this); | 130 Shell::GetInstance()->AddShellObserver(this); |
| 131 root_window_->AddObserver(this); | 131 root_window_->AddObserver(this); |
| 132 } | 132 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 CalculateTargetBounds(state_, &target_bounds); | 226 CalculateTargetBounds(state_, &target_bounds); |
| 227 if (launcher_widget()) { | 227 if (launcher_widget()) { |
| 228 GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); | 228 GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); |
| 229 | 229 |
| 230 launcher_widget()->SetBounds(target_bounds.launcher_bounds); | 230 launcher_widget()->SetBounds(target_bounds.launcher_bounds); |
| 231 launcher_->SetStatusSize(target_bounds.status_bounds.size()); | 231 launcher_->SetStatusSize(target_bounds.status_bounds.size()); |
| 232 } | 232 } |
| 233 GetLayer(status_)->SetOpacity(target_bounds.opacity); | 233 GetLayer(status_)->SetOpacity(target_bounds.opacity); |
| 234 status_->SetBounds(target_bounds.status_bounds); | 234 status_->SetBounds(target_bounds.status_bounds); |
| 235 Shell::GetInstance()->SetMonitorWorkAreaInsets( | 235 Shell::GetInstance()->SetMonitorWorkAreaInsets( |
| 236 Shell::GetRootWindow(), | 236 Shell::GetPrimaryRootWindow(), |
| 237 target_bounds.work_area_insets); | 237 target_bounds.work_area_insets); |
| 238 UpdateHitTestBounds(); | 238 UpdateHitTestBounds(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 void ShelfLayoutManager::UpdateVisibilityState() { | 241 void ShelfLayoutManager::UpdateVisibilityState() { |
| 242 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | 242 ShellDelegate* delegate = Shell::GetInstance()->delegate(); |
| 243 if (delegate && delegate->IsScreenLocked()) { | 243 if (delegate && delegate->IsScreenLocked()) { |
| 244 SetState(VISIBLE); | 244 SetState(VISIBLE); |
| 245 } else { | 245 } else { |
| 246 WorkspaceManager::WindowState window_state( | 246 WorkspaceManager::WindowState window_state( |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); | 373 GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); |
| 374 } | 374 } |
| 375 ui::ScopedLayerAnimationSettings status_animation_setter( | 375 ui::ScopedLayerAnimationSettings status_animation_setter( |
| 376 GetLayer(status_)->GetAnimator()); | 376 GetLayer(status_)->GetAnimator()); |
| 377 status_animation_setter.SetTransitionDuration( | 377 status_animation_setter.SetTransitionDuration( |
| 378 base::TimeDelta::FromMilliseconds(130)); | 378 base::TimeDelta::FromMilliseconds(130)); |
| 379 status_animation_setter.SetTweenType(ui::Tween::EASE_OUT); | 379 status_animation_setter.SetTweenType(ui::Tween::EASE_OUT); |
| 380 GetLayer(status_)->SetBounds(target_bounds.status_bounds); | 380 GetLayer(status_)->SetBounds(target_bounds.status_bounds); |
| 381 GetLayer(status_)->SetOpacity(target_bounds.opacity); | 381 GetLayer(status_)->SetOpacity(target_bounds.opacity); |
| 382 Shell::GetInstance()->SetMonitorWorkAreaInsets( | 382 Shell::GetInstance()->SetMonitorWorkAreaInsets( |
| 383 Shell::GetRootWindow(), | 383 Shell::GetPrimaryRootWindow(), |
| 384 target_bounds.work_area_insets); | 384 target_bounds.work_area_insets); |
| 385 UpdateHitTestBounds(); | 385 UpdateHitTestBounds(); |
| 386 UpdateShelfBackground(change_type); | 386 UpdateShelfBackground(change_type); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void ShelfLayoutManager::StopAnimating() { | 389 void ShelfLayoutManager::StopAnimating() { |
| 390 if (launcher_widget()) | 390 if (launcher_widget()) |
| 391 GetLayer(launcher_widget())->GetAnimator()->StopAnimating(); | 391 GetLayer(launcher_widget())->GetAnimator()->StopAnimating(); |
| 392 GetLayer(status_)->GetAnimator()->StopAnimating(); | 392 GetLayer(status_)->GetAnimator()->StopAnimating(); |
| 393 } | 393 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { | 567 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { |
| 568 if (state.visibility_state == VISIBLE) | 568 if (state.visibility_state == VISIBLE) |
| 569 return size; | 569 return size; |
| 570 if (state.visibility_state == AUTO_HIDE) | 570 if (state.visibility_state == AUTO_HIDE) |
| 571 return kAutoHideSize; | 571 return kAutoHideSize; |
| 572 return 0; | 572 return 0; |
| 573 } | 573 } |
| 574 | 574 |
| 575 } // namespace internal | 575 } // namespace internal |
| 576 } // namespace ash | 576 } // namespace ash |
| OLD | NEW |