| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 private: | 186 private: |
| 187 ShelfLayoutManager* shelf_layout_manager_; | 187 ShelfLayoutManager* shelf_layout_manager_; |
| 188 WmRootWindowController* root_window_controller_; | 188 WmRootWindowController* root_window_controller_; |
| 189 | 189 |
| 190 DISALLOW_COPY_AND_ASSIGN(RootWindowControllerObserverImpl); | 190 DISALLOW_COPY_AND_ASSIGN(RootWindowControllerObserverImpl); |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 // ShelfLayoutManager ---------------------------------------------------------- | 193 // ShelfLayoutManager ---------------------------------------------------------- |
| 194 | 194 |
| 195 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf_widget) | 195 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf_widget) |
| 196 : root_window_(shelf_widget->GetNativeView()->GetRootWindow()), | 196 : updating_bounds_(false), |
| 197 updating_bounds_(false), | |
| 198 shelf_widget_(shelf_widget), | 197 shelf_widget_(shelf_widget), |
| 199 workspace_controller_(NULL), | 198 workspace_controller_(NULL), |
| 200 window_overlaps_shelf_(false), | 199 window_overlaps_shelf_(false), |
| 201 mouse_over_shelf_when_auto_hide_timer_started_(false), | 200 mouse_over_shelf_when_auto_hide_timer_started_(false), |
| 202 bezel_event_filter_(new ShelfBezelEventFilter(this)), | 201 bezel_event_filter_(new ShelfBezelEventFilter(this)), |
| 203 gesture_drag_status_(GESTURE_DRAG_NONE), | 202 gesture_drag_status_(GESTURE_DRAG_NONE), |
| 204 gesture_drag_amount_(0.f), | 203 gesture_drag_amount_(0.f), |
| 205 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), | 204 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), |
| 206 update_shelf_observer_(NULL), | 205 update_shelf_observer_(NULL), |
| 207 chromevox_panel_height_(0), | 206 chromevox_panel_height_(0), |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 keyboard_is_about_to_hide = true; | 473 keyboard_is_about_to_hide = true; |
| 475 | 474 |
| 476 keyboard_bounds_ = new_bounds; | 475 keyboard_bounds_ = new_bounds; |
| 477 OnWindowResized(); | 476 OnWindowResized(); |
| 478 | 477 |
| 479 // On login screen if keyboard has been just hidden, update bounds just once | 478 // On login screen if keyboard has been just hidden, update bounds just once |
| 480 // but ignore target_bounds.work_area_insets since shelf overlaps with login | 479 // but ignore target_bounds.work_area_insets since shelf overlaps with login |
| 481 // window. | 480 // window. |
| 482 if (WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked() && | 481 if (WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked() && |
| 483 keyboard_is_about_to_hide) { | 482 keyboard_is_about_to_hide) { |
| 484 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, gfx::Insets()); | 483 WmWindow* window = WmLookup::Get()->GetWindowForWidget(shelf_widget_); |
| 484 WmShell::Get()->SetDisplayWorkAreaInsets(window, gfx::Insets()); |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 | 487 |
| 488 bool ShelfLayoutManager::IsHorizontalAlignment() const { | 488 bool ShelfLayoutManager::IsHorizontalAlignment() const { |
| 489 return ::ash::IsHorizontalAlignment(GetAlignment()); | 489 return ::ash::IsHorizontalAlignment(GetAlignment()); |
| 490 } | 490 } |
| 491 | 491 |
| 492 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { | 492 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { |
| 493 if (state_.visibility_state != SHELF_AUTO_HIDE && | 493 if (state_.visibility_state != SHELF_AUTO_HIDE && |
| 494 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { | 494 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 // For crbug.com/622431, when the shelf alignment is BOTTOM_LOCKED, we | 686 // For crbug.com/622431, when the shelf alignment is BOTTOM_LOCKED, we |
| 687 // don't set display work area, as it is not real user-set alignment. | 687 // don't set display work area, as it is not real user-set alignment. |
| 688 if (!state_.is_screen_locked && | 688 if (!state_.is_screen_locked && |
| 689 shelf_widget_->GetAlignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED) { | 689 shelf_widget_->GetAlignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED) { |
| 690 gfx::Insets insets; | 690 gfx::Insets insets; |
| 691 // If user session is blocked (login to new user session or add user to | 691 // If user session is blocked (login to new user session or add user to |
| 692 // the existing session - multi-profile) then give 100% of work area only | 692 // the existing session - multi-profile) then give 100% of work area only |
| 693 // if keyboard is not shown. | 693 // if keyboard is not shown. |
| 694 if (!state_.is_adding_user_screen || !keyboard_bounds_.IsEmpty()) | 694 if (!state_.is_adding_user_screen || !keyboard_bounds_.IsEmpty()) |
| 695 insets = target_bounds.work_area_insets; | 695 insets = target_bounds.work_area_insets; |
| 696 Shell::GetInstance()->SetDisplayWorkAreaInsets(root_window_, insets); | 696 WmWindow* window = WmLookup::Get()->GetWindowForWidget(shelf_widget_); |
| 697 WmShell::Get()->SetDisplayWorkAreaInsets(window, insets); |
| 697 } | 698 } |
| 698 } | 699 } |
| 699 | 700 |
| 700 // Set an empty border to avoid the shelf view and status area overlapping. | 701 // Set an empty border to avoid the shelf view and status area overlapping. |
| 701 // TODO(msw): Avoid setting bounds of views within the shelf widget here. | 702 // TODO(msw): Avoid setting bounds of views within the shelf widget here. |
| 702 gfx::Rect shelf_bounds = gfx::Rect(target_bounds.shelf_bounds_in_root.size()); | 703 gfx::Rect shelf_bounds = gfx::Rect(target_bounds.shelf_bounds_in_root.size()); |
| 703 shelf_widget_->GetContentsView()->SetBorder(views::Border::CreateEmptyBorder( | 704 shelf_widget_->GetContentsView()->SetBorder(views::Border::CreateEmptyBorder( |
| 704 shelf_bounds.InsetsFrom(target_bounds.shelf_bounds_in_shelf))); | 705 shelf_bounds.InsetsFrom(target_bounds.shelf_bounds_in_shelf))); |
| 705 shelf_widget_->GetContentsView()->Layout(); | 706 shelf_widget_->GetContentsView()->Layout(); |
| 706 | 707 |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1212 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 1212 } | 1213 } |
| 1213 | 1214 |
| 1214 void ShelfLayoutManager::CancelGestureDrag() { | 1215 void ShelfLayoutManager::CancelGestureDrag() { |
| 1215 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; | 1216 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; |
| 1216 UpdateVisibilityState(); | 1217 UpdateVisibilityState(); |
| 1217 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1218 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 1218 } | 1219 } |
| 1219 | 1220 |
| 1220 } // namespace ash | 1221 } // namespace ash |
| OLD | NEW |