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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 alignment_(SHELF_ALIGNMENT_BOTTOM), | 189 alignment_(SHELF_ALIGNMENT_BOTTOM), |
190 shelf_(shelf), | 190 shelf_(shelf), |
191 workspace_controller_(NULL), | 191 workspace_controller_(NULL), |
192 window_overlaps_shelf_(false), | 192 window_overlaps_shelf_(false), |
193 mouse_over_shelf_when_auto_hide_timer_started_(false), | 193 mouse_over_shelf_when_auto_hide_timer_started_(false), |
194 bezel_event_filter_(new ShelfBezelEventFilter(this)), | 194 bezel_event_filter_(new ShelfBezelEventFilter(this)), |
195 gesture_drag_status_(GESTURE_DRAG_NONE), | 195 gesture_drag_status_(GESTURE_DRAG_NONE), |
196 gesture_drag_amount_(0.f), | 196 gesture_drag_amount_(0.f), |
197 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), | 197 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), |
198 update_shelf_observer_(NULL), | 198 update_shelf_observer_(NULL), |
| 199 chromevox_panel_height_(0), |
199 duration_override_in_ms_(0) { | 200 duration_override_in_ms_(0) { |
200 Shell::GetInstance()->AddShellObserver(this); | 201 Shell::GetInstance()->AddShellObserver(this); |
201 Shell::GetInstance()->lock_state_controller()->AddObserver(this); | 202 Shell::GetInstance()->lock_state_controller()->AddObserver(this); |
202 aura::client::GetActivationClient(root_window_)->AddObserver(this); | 203 aura::client::GetActivationClient(root_window_)->AddObserver(this); |
203 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this); | 204 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this); |
204 } | 205 } |
205 | 206 |
206 ShelfLayoutManager::~ShelfLayoutManager() { | 207 ShelfLayoutManager::~ShelfLayoutManager() { |
207 if (update_shelf_observer_) | 208 if (update_shelf_observer_) |
208 update_shelf_observer_->Detach(); | 209 update_shelf_observer_->Detach(); |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 aura::Window* gained_active, | 535 aura::Window* gained_active, |
535 aura::Window* lost_active) { | 536 aura::Window* lost_active) { |
536 UpdateAutoHideStateNow(); | 537 UpdateAutoHideStateNow(); |
537 } | 538 } |
538 | 539 |
539 bool ShelfLayoutManager::IsHorizontalAlignment() const { | 540 bool ShelfLayoutManager::IsHorizontalAlignment() const { |
540 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM || | 541 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM || |
541 GetAlignment() == SHELF_ALIGNMENT_TOP; | 542 GetAlignment() == SHELF_ALIGNMENT_TOP; |
542 } | 543 } |
543 | 544 |
| 545 void ShelfLayoutManager::SetChromeVoxPanelHeight(int height) { |
| 546 chromevox_panel_height_ = height; |
| 547 LayoutShelf(); |
| 548 } |
| 549 |
544 // static | 550 // static |
545 ShelfLayoutManager* ShelfLayoutManager::ForShelf(aura::Window* window) { | 551 ShelfLayoutManager* ShelfLayoutManager::ForShelf(aura::Window* window) { |
546 ShelfWidget* shelf = RootWindowController::ForShelf(window)->shelf(); | 552 ShelfWidget* shelf = RootWindowController::ForShelf(window)->shelf(); |
547 return shelf ? shelf->shelf_layout_manager() : NULL; | 553 return shelf ? shelf->shelf_layout_manager() : NULL; |
548 } | 554 } |
549 | 555 |
550 //////////////////////////////////////////////////////////////////////////////// | 556 //////////////////////////////////////////////////////////////////////////////// |
551 // ShelfLayoutManager, private: | 557 // ShelfLayoutManager, private: |
552 | 558 |
553 ShelfLayoutManager::TargetBounds::TargetBounds() | 559 ShelfLayoutManager::TargetBounds::TargetBounds() |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 } | 833 } |
828 | 834 |
829 // Also push in the work area inset for the dock if it is visible. | 835 // Also push in the work area inset for the dock if it is visible. |
830 if (!dock_bounds_.IsEmpty()) { | 836 if (!dock_bounds_.IsEmpty()) { |
831 gfx::Insets dock_insets( | 837 gfx::Insets dock_insets( |
832 0, (dock_bounds_.x() > 0 ? 0 : dock_bounds_.width()), | 838 0, (dock_bounds_.x() > 0 ? 0 : dock_bounds_.width()), |
833 0, (dock_bounds_.x() > 0 ? dock_bounds_.width() : 0)); | 839 0, (dock_bounds_.x() > 0 ? dock_bounds_.width() : 0)); |
834 target_bounds->work_area_insets += dock_insets; | 840 target_bounds->work_area_insets += dock_insets; |
835 } | 841 } |
836 | 842 |
| 843 // Also push in the work area insets for the ChromeVox panel if it's visible. |
| 844 if (chromevox_panel_height_) { |
| 845 gfx::Insets chromevox_insets(chromevox_panel_height_, 0, 0, 0); |
| 846 target_bounds->work_area_insets += chromevox_insets; |
| 847 } |
| 848 |
837 target_bounds->opacity = | 849 target_bounds->opacity = |
838 (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || | 850 (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || |
839 state.visibility_state == SHELF_VISIBLE || | 851 state.visibility_state == SHELF_VISIBLE || |
840 state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; | 852 state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; |
841 target_bounds->status_opacity = | 853 target_bounds->status_opacity = |
842 (state.visibility_state == SHELF_AUTO_HIDE && | 854 (state.visibility_state == SHELF_AUTO_HIDE && |
843 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && | 855 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && |
844 gesture_drag_status_ != GESTURE_DRAG_IN_PROGRESS) ? | 856 gesture_drag_status_ != GESTURE_DRAG_IN_PROGRESS) ? |
845 0.0f : target_bounds->opacity; | 857 0.0f : target_bounds->opacity; |
846 | 858 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 return false; | 1205 return false; |
1194 } | 1206 } |
1195 if (session_state_delegate->IsUserSessionBlocked() || | 1207 if (session_state_delegate->IsUserSessionBlocked() || |
1196 state_.is_adding_user_screen) { | 1208 state_.is_adding_user_screen) { |
1197 return true; | 1209 return true; |
1198 } | 1210 } |
1199 return false; | 1211 return false; |
1200 } | 1212 } |
1201 | 1213 |
1202 } // namespace ash | 1214 } // namespace ash |
OLD | NEW |