Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: ash/shelf/shelf_layout_manager.cc

Issue 2888623005: mash: Remove some WmWindow usage in ash/shelf. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/shelf/wm_shelf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // from the right edge of the primary display which can trigger showing the 70 // from the right edge of the primary display which can trigger showing the
71 // auto hidden shelf. The region is used to make it easier to trigger showing 71 // auto hidden shelf. The region is used to make it easier to trigger showing
72 // the auto hidden shelf when the shelf is on the boundary between displays. 72 // the auto hidden shelf when the shelf is on the boundary between displays.
73 const int kMaxAutoHideShowShelfRegionSize = 10; 73 const int kMaxAutoHideShowShelfRegionSize = 10;
74 74
75 ui::Layer* GetLayer(views::Widget* widget) { 75 ui::Layer* GetLayer(views::Widget* widget) {
76 return widget->GetNativeView()->layer(); 76 return widget->GetNativeView()->layer();
77 } 77 }
78 78
79 // Returns true if the window is in the app list window container. 79 // Returns true if the window is in the app list window container.
80 bool IsAppListWindow(WmWindow* window) { 80 bool IsAppListWindow(const aura::Window* window) {
81 return window->GetParent() && window->GetParent()->aura_window()->id() == 81 const aura::Window* parent = window->parent();
82 kShellWindowId_AppListContainer; 82 return parent && parent->id() == kShellWindowId_AppListContainer;
83 } 83 }
84 84
85 } // namespace 85 } // namespace
86 86
87 // ShelfLayoutManager::UpdateShelfObserver ------------------------------------- 87 // ShelfLayoutManager::UpdateShelfObserver -------------------------------------
88 88
89 // UpdateShelfObserver is used to delay updating the background until the 89 // UpdateShelfObserver is used to delay updating the background until the
90 // animation completes. 90 // animation completes.
91 class ShelfLayoutManager::UpdateShelfObserver 91 class ShelfLayoutManager::UpdateShelfObserver
92 : public ui::ImplicitAnimationObserver { 92 : public ui::ImplicitAnimationObserver {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 case SHELF_AUTO_HIDE_BEHAVIOR_NEVER: 228 case SHELF_AUTO_HIDE_BEHAVIOR_NEVER:
229 return SHELF_VISIBLE; 229 return SHELF_VISIBLE;
230 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN: 230 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN:
231 return SHELF_HIDDEN; 231 return SHELF_HIDDEN;
232 } 232 }
233 return SHELF_VISIBLE; 233 return SHELF_VISIBLE;
234 } 234 }
235 235
236 void ShelfLayoutManager::UpdateVisibilityState() { 236 void ShelfLayoutManager::UpdateVisibilityState() {
237 // Bail out early before the shelf is initialized or after it is destroyed. 237 // Bail out early before the shelf is initialized or after it is destroyed.
238 WmWindow* shelf_window = WmWindow::Get(shelf_widget_->GetNativeWindow()); 238 aura::Window* shelf_window = shelf_widget_->GetNativeWindow();
James Cook 2017/05/16 21:50:16 Your patch and mine are going to conflict here. Yo
239 if (in_shutdown_ || !wm_shelf_->IsShelfInitialized() || !shelf_window) 239 if (in_shutdown_ || !wm_shelf_->IsShelfInitialized() || !shelf_window)
240 return; 240 return;
241 if (state_.IsScreenLocked() || state_.IsAddingSecondaryUser()) { 241 if (state_.IsScreenLocked() || state_.IsAddingSecondaryUser()) {
242 SetState(SHELF_VISIBLE); 242 SetState(SHELF_VISIBLE);
243 } else if (Shell::Get()->screen_pinning_controller()->IsPinned()) { 243 } else if (Shell::Get()->screen_pinning_controller()->IsPinned()) {
244 SetState(SHELF_HIDDEN); 244 SetState(SHELF_HIDDEN);
245 } else { 245 } else {
246 // TODO(zelidrag): Verify shelf drag animation still shows on the device 246 // TODO(zelidrag): Verify shelf drag animation still shows on the device
247 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. 247 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN.
248 wm::WorkspaceWindowState window_state( 248 wm::WorkspaceWindowState window_state(
249 shelf_window->GetRootWindowController()->GetWorkspaceWindowState()); 249 RootWindowController::ForWindow(shelf_window)
250 ->GetWorkspaceWindowState());
250 251
251 switch (window_state) { 252 switch (window_state) {
252 case wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN: { 253 case wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN: {
253 if (IsShelfAutoHideForFullscreenMaximized()) { 254 if (IsShelfAutoHideForFullscreenMaximized()) {
254 SetState(SHELF_AUTO_HIDE); 255 SetState(SHELF_AUTO_HIDE);
255 } else if (IsShelfHiddenForFullscreen()) { 256 } else if (IsShelfHiddenForFullscreen()) {
256 SetState(SHELF_HIDDEN); 257 SetState(SHELF_HIDDEN);
257 } else { 258 } else {
258 // The shelf is sometimes not hidden when in immersive fullscreen. 259 // The shelf is sometimes not hidden when in immersive fullscreen.
259 // Force the shelf to be auto hidden in this case. 260 // Force the shelf to be auto hidden in this case.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 auto_hide_timer_.Start( 296 auto_hide_timer_.Start(
296 FROM_HERE, base::TimeDelta::FromMilliseconds(kAutoHideDelayMS), this, 297 FROM_HERE, base::TimeDelta::FromMilliseconds(kAutoHideDelayMS), this,
297 &ShelfLayoutManager::UpdateAutoHideStateNow); 298 &ShelfLayoutManager::UpdateAutoHideStateNow);
298 } 299 }
299 } else { 300 } else {
300 StopAutoHideTimer(); 301 StopAutoHideTimer();
301 } 302 }
302 } 303 }
303 304
304 void ShelfLayoutManager::UpdateAutoHideForMouseEvent(ui::MouseEvent* event, 305 void ShelfLayoutManager::UpdateAutoHideForMouseEvent(ui::MouseEvent* event,
305 WmWindow* target) { 306 aura::Window* target) {
306 // This also checks IsShelfWindow() to make sure we don't attempt to hide the 307 // This also checks IsShelfWindow() to make sure we don't attempt to hide the
307 // shelf if the mouse down occurs on the shelf. 308 // shelf if the mouse down occurs on the shelf.
308 in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED || 309 in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED ||
309 (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED && 310 (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED &&
310 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) && 311 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) &&
311 !IsShelfWindow(target); 312 !IsShelfWindow(target);
312 313
313 // Don't update during shutdown because synthetic mouse events (e.g. mouse 314 // Don't update during shutdown because synthetic mouse events (e.g. mouse
314 // exit) may be generated during status area widget teardown. 315 // exit) may be generated during status area widget teardown.
315 if (visibility_state() != SHELF_AUTO_HIDE || in_shutdown_) 316 if (visibility_state() != SHELF_AUTO_HIDE || in_shutdown_)
316 return; 317 return;
317 318
318 if (event->type() == ui::ET_MOUSE_MOVED || 319 if (event->type() == ui::ET_MOUSE_MOVED ||
319 event->type() == ui::ET_MOUSE_ENTERED || 320 event->type() == ui::ET_MOUSE_ENTERED ||
320 event->type() == ui::ET_MOUSE_EXITED) { 321 event->type() == ui::ET_MOUSE_EXITED) {
321 UpdateAutoHideState(); 322 UpdateAutoHideState();
322 } 323 }
323 } 324 }
324 325
325 void ShelfLayoutManager::UpdateAutoHideForGestureEvent(ui::GestureEvent* event, 326 void ShelfLayoutManager::UpdateAutoHideForGestureEvent(ui::GestureEvent* event,
326 WmWindow* target) { 327 aura::Window* target) {
327 if (visibility_state() != SHELF_AUTO_HIDE || in_shutdown_) 328 if (visibility_state() != SHELF_AUTO_HIDE || in_shutdown_)
328 return; 329 return;
329 330
330 if (IsShelfWindow(target) && ProcessGestureEvent(*event)) 331 if (IsShelfWindow(target) && ProcessGestureEvent(*event))
331 event->StopPropagation(); 332 event->StopPropagation();
332 } 333 }
333 334
334 void ShelfLayoutManager::SetWindowOverlapsShelf(bool value) { 335 void ShelfLayoutManager::SetWindowOverlapsShelf(bool value) {
335 window_overlaps_shelf_ = value; 336 window_overlaps_shelf_ = value;
336 MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE); 337 MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 ShelfLayoutManager::TargetBounds::TargetBounds() 486 ShelfLayoutManager::TargetBounds::TargetBounds()
486 : opacity(0.0f), status_opacity(0.0f) {} 487 : opacity(0.0f), status_opacity(0.0f) {}
487 488
488 ShelfLayoutManager::TargetBounds::~TargetBounds() {} 489 ShelfLayoutManager::TargetBounds::~TargetBounds() {}
489 490
490 void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) { 491 void ShelfLayoutManager::SetState(ShelfVisibilityState visibility_state) {
491 State state; 492 State state;
492 state.visibility_state = visibility_state; 493 state.visibility_state = visibility_state;
493 state.auto_hide_state = CalculateAutoHideState(visibility_state); 494 state.auto_hide_state = CalculateAutoHideState(visibility_state);
494 495
495 WmWindow* shelf_window = WmWindow::Get(shelf_widget_->GetNativeWindow()); 496 RootWindowController* controller =
496 RootWindowController* controller = shelf_window->GetRootWindowController(); 497 RootWindowController::ForWindow(shelf_widget_->GetNativeWindow());
497 state.window_state = controller ? controller->GetWorkspaceWindowState() 498 state.window_state = controller ? controller->GetWorkspaceWindowState()
498 : wm::WORKSPACE_WINDOW_STATE_DEFAULT; 499 : wm::WORKSPACE_WINDOW_STATE_DEFAULT;
499 // Preserve the log in screen states. 500 // Preserve the log in screen states.
500 state.session_state = state_.session_state; 501 state.session_state = state_.session_state;
501 state.pre_lock_screen_animation_active = 502 state.pre_lock_screen_animation_active =
502 state_.pre_lock_screen_animation_active; 503 state_.pre_lock_screen_animation_active;
503 504
504 // Force an update because gesture drags affect the shelf bounds and we 505 // Force an update because gesture drags affect the shelf bounds and we
505 // should animate back to the normal bounds at the end of a gesture. 506 // should animate back to the normal bounds at the end of a gesture.
506 bool force_update = 507 bool force_update =
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 for (auto& observer : observers_) 565 for (auto& observer : observers_)
565 observer.OnAutoHideStateChanged(state_.auto_hide_state); 566 observer.OnAutoHideStateChanged(state_.auto_hide_state);
566 } 567 }
567 } 568 }
568 569
569 void ShelfLayoutManager::UpdateBoundsAndOpacity( 570 void ShelfLayoutManager::UpdateBoundsAndOpacity(
570 const TargetBounds& target_bounds, 571 const TargetBounds& target_bounds,
571 bool animate, 572 bool animate,
572 bool change_work_area, 573 bool change_work_area,
573 ui::ImplicitAnimationObserver* observer) { 574 ui::ImplicitAnimationObserver* observer) {
575 StatusAreaWidget* status_widget = shelf_widget_->status_area_widget();
574 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); 576 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true);
575 { 577 {
576 ui::ScopedLayerAnimationSettings shelf_animation_setter( 578 ui::ScopedLayerAnimationSettings shelf_animation_setter(
577 GetLayer(shelf_widget_)->GetAnimator()); 579 GetLayer(shelf_widget_)->GetAnimator());
578 ui::ScopedLayerAnimationSettings status_animation_setter( 580 ui::ScopedLayerAnimationSettings status_animation_setter(
579 GetLayer(shelf_widget_->status_area_widget())->GetAnimator()); 581 GetLayer(status_widget)->GetAnimator());
580 if (animate) { 582 if (animate) {
581 int duration = duration_override_in_ms_ ? duration_override_in_ms_ 583 int duration = duration_override_in_ms_ ? duration_override_in_ms_
582 : kAnimationDurationMS; 584 : kAnimationDurationMS;
583 shelf_animation_setter.SetTransitionDuration( 585 shelf_animation_setter.SetTransitionDuration(
584 base::TimeDelta::FromMilliseconds(duration)); 586 base::TimeDelta::FromMilliseconds(duration));
585 shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); 587 shelf_animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
586 shelf_animation_setter.SetPreemptionStrategy( 588 shelf_animation_setter.SetPreemptionStrategy(
587 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 589 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
588 status_animation_setter.SetTransitionDuration( 590 status_animation_setter.SetTransitionDuration(
589 base::TimeDelta::FromMilliseconds(duration)); 591 base::TimeDelta::FromMilliseconds(duration));
590 status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT); 592 status_animation_setter.SetTweenType(gfx::Tween::EASE_OUT);
591 status_animation_setter.SetPreemptionStrategy( 593 status_animation_setter.SetPreemptionStrategy(
592 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 594 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
593 } else { 595 } else {
594 StopAnimating(); 596 StopAnimating();
595 shelf_animation_setter.SetTransitionDuration(base::TimeDelta()); 597 shelf_animation_setter.SetTransitionDuration(base::TimeDelta());
596 status_animation_setter.SetTransitionDuration(base::TimeDelta()); 598 status_animation_setter.SetTransitionDuration(base::TimeDelta());
597 } 599 }
598 if (observer) 600 if (observer)
599 status_animation_setter.AddObserver(observer); 601 status_animation_setter.AddObserver(observer);
600 602
601 GetLayer(shelf_widget_)->SetOpacity(target_bounds.opacity); 603 GetLayer(shelf_widget_)->SetOpacity(target_bounds.opacity);
602 WmWindow* shelf_window = WmWindow::Get(shelf_widget_->GetNativeWindow()); 604 gfx::Rect shelf_bounds = target_bounds.shelf_bounds_in_root;
603 shelf_widget_->SetBounds(shelf_window->GetParent()->ConvertRectToScreen( 605 ::wm::ConvertRectToScreen(shelf_widget_->GetNativeWindow()->parent(),
604 target_bounds.shelf_bounds_in_root)); 606 &shelf_bounds);
607 shelf_widget_->SetBounds(shelf_bounds);
605 608
606 GetLayer(shelf_widget_->status_area_widget()) 609 GetLayer(status_widget)->SetOpacity(target_bounds.status_opacity);
607 ->SetOpacity(target_bounds.status_opacity);
608 610
609 // Having a window which is visible but does not have an opacity is an 611 // Having a window which is visible but does not have an opacity is an
610 // illegal state. We therefore hide the shelf here if required. 612 // illegal state. We therefore hide the shelf here if required.
611 if (!target_bounds.status_opacity) 613 if (!target_bounds.status_opacity)
612 shelf_widget_->status_area_widget()->Hide(); 614 status_widget->Hide();
613 // Setting visibility during an animation causes the visibility property to 615 // Setting visibility during an animation causes the visibility property to
614 // animate. Override the animation settings to immediately set the 616 // animate. Override the animation settings to immediately set the
615 // visibility property. Opacity will still animate. 617 // visibility property. Opacity will still animate.
616 618
617 // TODO(harrym): Once status area widget is a child view of shelf 619 // TODO(harrym): Once status area widget is a child view of shelf
618 // this can be simplified. 620 // this can be simplified.
619 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; 621 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf;
620 status_bounds.Offset(target_bounds.shelf_bounds_in_root.OffsetFromOrigin()); 622 status_bounds.Offset(target_bounds.shelf_bounds_in_root.OffsetFromOrigin());
621 WmWindow* status_window = 623 ::wm::ConvertRectToScreen(status_widget->GetNativeWindow()->parent(),
622 WmWindow::Get(shelf_widget_->status_area_widget()->GetNativeWindow()); 624 &status_bounds);
623 shelf_widget_->status_area_widget()->SetBounds( 625 status_widget->SetBounds(status_bounds);
624 status_window->GetParent()->ConvertRectToScreen(status_bounds));
625 626
626 // For crbug.com/622431, when the shelf alignment is BOTTOM_LOCKED, we 627 // For crbug.com/622431, when the shelf alignment is BOTTOM_LOCKED, we
627 // don't set display work area, as it is not real user-set alignment. 628 // don't set display work area, as it is not real user-set alignment.
628 if (!state_.IsScreenLocked() && 629 if (!state_.IsScreenLocked() &&
629 wm_shelf_->GetAlignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED && 630 wm_shelf_->GetAlignment() != SHELF_ALIGNMENT_BOTTOM_LOCKED &&
630 change_work_area) { 631 change_work_area) {
631 gfx::Insets insets; 632 gfx::Insets insets;
632 // If user session is blocked (login to new user session or add user to 633 // If user session is blocked (login to new user session or add user to
633 // the existing session - multi-profile) then give 100% of work area only 634 // the existing session - multi-profile) then give 100% of work area only
634 // if keyboard is not shown. 635 // if keyboard is not shown.
635 if (!state_.IsAddingSecondaryUser() || !keyboard_bounds_.IsEmpty()) 636 if (!state_.IsAddingSecondaryUser() || !keyboard_bounds_.IsEmpty())
636 insets = target_bounds.work_area_insets; 637 insets = target_bounds.work_area_insets;
638 WmWindow* shelf_window = WmWindow::Get(shelf_widget_->GetNativeWindow());
637 ShellPort::Get()->SetDisplayWorkAreaInsets(shelf_window, insets); 639 ShellPort::Get()->SetDisplayWorkAreaInsets(shelf_window, insets);
638 } 640 }
639 } 641 }
640 642
641 // Set an empty border to avoid the shelf view and status area overlapping. 643 // Set an empty border to avoid the shelf view and status area overlapping.
642 // TODO(msw): Avoid setting bounds of views within the shelf widget here. 644 // TODO(msw): Avoid setting bounds of views within the shelf widget here.
643 gfx::Rect shelf_bounds = gfx::Rect(target_bounds.shelf_bounds_in_root.size()); 645 gfx::Rect shelf_bounds = gfx::Rect(target_bounds.shelf_bounds_in_root.size());
644 shelf_widget_->GetContentsView()->SetBorder(views::CreateEmptyBorder( 646 shelf_widget_->GetContentsView()->SetBorder(views::CreateEmptyBorder(
645 shelf_bounds.InsetsFrom(target_bounds.shelf_bounds_in_shelf))); 647 shelf_bounds.InsetsFrom(target_bounds.shelf_bounds_in_shelf)));
646 shelf_widget_->GetContentsView()->Layout(); 648 shelf_widget_->GetContentsView()->Layout();
647 649
648 // Setting visibility during an animation causes the visibility property to 650 // Setting visibility during an animation causes the visibility property to
649 // animate. Set the visibility property without an animation. 651 // animate. Set the visibility property without an animation.
650 if (target_bounds.status_opacity) 652 if (target_bounds.status_opacity)
651 shelf_widget_->status_area_widget()->Show(); 653 status_widget->Show();
652 } 654 }
653 655
654 void ShelfLayoutManager::StopAnimating() { 656 void ShelfLayoutManager::StopAnimating() {
655 GetLayer(shelf_widget_)->GetAnimator()->StopAnimating(); 657 GetLayer(shelf_widget_)->GetAnimator()->StopAnimating();
656 GetLayer(shelf_widget_->status_area_widget())->GetAnimator()->StopAnimating(); 658 GetLayer(shelf_widget_->status_area_widget())->GetAnimator()->StopAnimating();
657 } 659 }
658 660
659 void ShelfLayoutManager::CalculateTargetBounds(const State& state, 661 void ShelfLayoutManager::CalculateTargetBounds(const State& state,
660 TargetBounds* target_bounds) { 662 TargetBounds* target_bounds) {
661 int shelf_size = kShelfSize; 663 int shelf_size = kShelfSize;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 } 869 }
868 870
869 bool ShelfLayoutManager::HasVisibleWindow() const { 871 bool ShelfLayoutManager::HasVisibleWindow() const {
870 WmWindow* root = 872 WmWindow* root =
871 WmWindow::Get(shelf_widget_->GetNativeWindow())->GetRootWindow(); 873 WmWindow::Get(shelf_widget_->GetNativeWindow())->GetRootWindow();
872 const std::vector<WmWindow*> windows = 874 const std::vector<WmWindow*> windows =
873 Shell::Get()->mru_window_tracker()->BuildWindowListIgnoreModal(); 875 Shell::Get()->mru_window_tracker()->BuildWindowListIgnoreModal();
874 // Process the window list and check if there are any visible windows. 876 // Process the window list and check if there are any visible windows.
875 // Ignore app list windows that may be animating to hide after dismissal. 877 // Ignore app list windows that may be animating to hide after dismissal.
876 for (auto* window : windows) { 878 for (auto* window : windows) {
877 if (window->IsVisible() && !IsAppListWindow(window) && 879 if (window->IsVisible() && !IsAppListWindow(window->aura_window()) &&
878 root->Contains(window)) { 880 root->Contains(window)) {
879 return true; 881 return true;
880 } 882 }
881 } 883 }
882 return false; 884 return false;
883 } 885 }
884 886
885 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( 887 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
886 ShelfVisibilityState visibility_state) const { 888 ShelfVisibilityState visibility_state) const {
887 if (visibility_state != SHELF_AUTO_HIDE || !wm_shelf_->IsShelfInitialized()) 889 if (visibility_state != SHELF_AUTO_HIDE || !wm_shelf_->IsShelfInitialized())
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 if ((state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN || 956 if ((state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN ||
955 mouse_over_shelf_when_auto_hide_timer_started_) && 957 mouse_over_shelf_when_auto_hide_timer_started_) &&
956 GetAutoHideShowShelfRegionInScreen().Contains( 958 GetAutoHideShowShelfRegionInScreen().Contains(
957 cursor_position_in_screen)) { 959 cursor_position_in_screen)) {
958 return SHELF_AUTO_HIDE_SHOWN; 960 return SHELF_AUTO_HIDE_SHOWN;
959 } 961 }
960 962
961 return SHELF_AUTO_HIDE_HIDDEN; 963 return SHELF_AUTO_HIDE_HIDDEN;
962 } 964 }
963 965
964 bool ShelfLayoutManager::IsShelfWindow(WmWindow* window) { 966 bool ShelfLayoutManager::IsShelfWindow(aura::Window* window) {
965 if (!window) 967 if (!window)
966 return false; 968 return false;
967 WmWindow* shelf_window = WmWindow::Get(shelf_widget_->GetNativeWindow()); 969 const aura::Window* shelf_window = shelf_widget_->GetNativeWindow();
968 WmWindow* status_window = 970 const aura::Window* status_window =
969 WmWindow::Get(shelf_widget_->status_area_widget()->GetNativeWindow()); 971 shelf_widget_->status_area_widget()->GetNativeWindow();
970 return (shelf_window && shelf_window->Contains(window)) || 972 return (shelf_window && shelf_window->Contains(window)) ||
971 (status_window && status_window->Contains(window)); 973 (status_window && status_window->Contains(window));
972 } 974 }
973 975
974 int ShelfLayoutManager::GetWorkAreaInsets(const State& state, int size) const { 976 int ShelfLayoutManager::GetWorkAreaInsets(const State& state, int size) const {
975 if (state.visibility_state == SHELF_VISIBLE) 977 if (state.visibility_state == SHELF_VISIBLE)
976 return size; 978 return size;
977 return 0; 979 return 0;
978 } 980 }
979 981
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 gesture_drag_status_ = GESTURE_DRAG_NONE; 1143 gesture_drag_status_ = GESTURE_DRAG_NONE;
1142 } 1144 }
1143 1145
1144 void ShelfLayoutManager::CancelGestureDrag() { 1146 void ShelfLayoutManager::CancelGestureDrag() {
1145 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; 1147 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS;
1146 UpdateVisibilityState(); 1148 UpdateVisibilityState();
1147 gesture_drag_status_ = GESTURE_DRAG_NONE; 1149 gesture_drag_status_ = GESTURE_DRAG_NONE;
1148 } 1150 }
1149 1151
1150 } // namespace ash 1152 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/shelf/wm_shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698