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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 ShelfLayoutManager* shelf_; | 160 ShelfLayoutManager* shelf_; |
161 | 161 |
162 DISALLOW_COPY_AND_ASSIGN(UpdateShelfObserver); | 162 DISALLOW_COPY_AND_ASSIGN(UpdateShelfObserver); |
163 }; | 163 }; |
164 | 164 |
165 // ShelfLayoutManager ---------------------------------------------------------- | 165 // ShelfLayoutManager ---------------------------------------------------------- |
166 | 166 |
167 ShelfLayoutManager::ShelfLayoutManager(views::Widget* status) | 167 ShelfLayoutManager::ShelfLayoutManager(views::Widget* status) |
168 : root_window_(Shell::GetPrimaryRootWindow()), | 168 : root_window_(Shell::GetPrimaryRootWindow()), |
169 in_layout_(false), | 169 in_layout_(false), |
170 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT), | 170 auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER), |
171 alignment_(SHELF_ALIGNMENT_BOTTOM), | 171 alignment_(SHELF_ALIGNMENT_BOTTOM), |
172 launcher_(NULL), | 172 launcher_(NULL), |
173 status_(status), | 173 status_(status), |
174 workspace_controller_(NULL), | 174 workspace_controller_(NULL), |
175 window_overlaps_shelf_(false), | 175 window_overlaps_shelf_(false), |
176 gesture_drag_status_(GESTURE_DRAG_NONE), | 176 gesture_drag_status_(GESTURE_DRAG_NONE), |
177 gesture_drag_amount_(0.f), | 177 gesture_drag_amount_(0.f), |
178 gesture_drag_auto_hide_state_(AUTO_HIDE_SHOWN), | 178 gesture_drag_auto_hide_state_(AUTO_HIDE_SHOWN), |
179 update_shelf_observer_(NULL) { | 179 update_shelf_observer_(NULL) { |
180 Shell::GetInstance()->AddShellObserver(this); | 180 Shell::GetInstance()->AddShellObserver(this); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) { | 282 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) { |
283 SetState(AUTO_HIDE); | 283 SetState(AUTO_HIDE); |
284 } else { | 284 } else { |
285 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); | 285 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); |
286 switch (window_state) { | 286 switch (window_state) { |
287 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: | 287 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: |
288 SetState(HIDDEN); | 288 SetState(HIDDEN); |
289 break; | 289 break; |
290 | 290 |
291 case WORKSPACE_WINDOW_STATE_MAXIMIZED: | 291 case WORKSPACE_WINDOW_STATE_MAXIMIZED: |
292 SetState(auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_NEVER ? | 292 SetState(auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? |
293 AUTO_HIDE : VISIBLE); | 293 AUTO_HIDE : VISIBLE); |
294 break; | 294 break; |
295 | 295 |
296 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: | 296 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: |
297 case WORKSPACE_WINDOW_STATE_DEFAULT: | 297 case WORKSPACE_WINDOW_STATE_DEFAULT: |
298 SetState(auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? | 298 SetState(auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? |
299 AUTO_HIDE : VISIBLE); | 299 AUTO_HIDE : VISIBLE); |
300 SetWindowOverlapsShelf(window_state == | 300 SetWindowOverlapsShelf(window_state == |
301 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF); | 301 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF); |
302 break; | 302 break; |
303 } | 303 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 } | 482 } |
483 | 483 |
484 //////////////////////////////////////////////////////////////////////////////// | 484 //////////////////////////////////////////////////////////////////////////////// |
485 // ShelfLayoutManager, private: | 485 // ShelfLayoutManager, private: |
486 | 486 |
487 ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {} | 487 ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {} |
488 | 488 |
489 gfx::Rect ShelfLayoutManager::GetMaximizedWindowBounds( | 489 gfx::Rect ShelfLayoutManager::GetMaximizedWindowBounds( |
490 aura::Window* window) { | 490 aura::Window* window) { |
491 gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent(window)); | 491 gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent(window)); |
492 if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT || | 492 if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { |
493 auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { | |
494 AdjustBoundsBasedOnAlignment(kAutoHideSize, &bounds); | 493 AdjustBoundsBasedOnAlignment(kAutoHideSize, &bounds); |
495 return bounds; | 494 return bounds; |
496 } | 495 } |
497 // SHELF_AUTO_HIDE_BEHAVIOR_NEVER maximized windows don't get any taller. | 496 // SHELF_AUTO_HIDE_BEHAVIOR_NEVER maximized windows don't get any taller. |
498 return GetUnmaximizedWorkAreaBounds(window); | 497 return GetUnmaximizedWorkAreaBounds(window); |
499 } | 498 } |
500 | 499 |
501 gfx::Rect ShelfLayoutManager::GetUnmaximizedWorkAreaBounds( | 500 gfx::Rect ShelfLayoutManager::GetUnmaximizedWorkAreaBounds( |
502 aura::Window* window) { | 501 aura::Window* window) { |
503 gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent(window)); | 502 gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent(window)); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { | 911 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { |
913 if (state.visibility_state == VISIBLE) | 912 if (state.visibility_state == VISIBLE) |
914 return size; | 913 return size; |
915 if (state.visibility_state == AUTO_HIDE) | 914 if (state.visibility_state == AUTO_HIDE) |
916 return kAutoHideSize; | 915 return kAutoHideSize; |
917 return 0; | 916 return 0; |
918 } | 917 } |
919 | 918 |
920 } // namespace internal | 919 } // namespace internal |
921 } // namespace ash | 920 } // namespace ash |
OLD | NEW |