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

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

Issue 2007003002: mash: Preliminary support for shelf auto-hide (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shutdown
Patch Set: typo Created 4 years, 6 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
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 <cstring> 9 #include <cstring>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/accelerators/accelerator_commands.h" 13 #include "ash/accelerators/accelerator_commands.h"
14 #include "ash/ash_switches.h" 14 #include "ash/ash_switches.h"
15 #include "ash/root_window_controller.h" 15 #include "ash/root_window_controller.h"
16 #include "ash/screen_util.h" 16 #include "ash/screen_util.h"
17 #include "ash/session/session_state_delegate.h" 17 #include "ash/session/session_state_delegate.h"
18 #include "ash/shelf/shelf.h" 18 #include "ash/shelf/shelf.h"
19 #include "ash/shelf/shelf_bezel_event_filter.h" 19 #include "ash/shelf/shelf_bezel_event_filter.h"
20 #include "ash/shelf/shelf_constants.h" 20 #include "ash/shelf/shelf_constants.h"
21 #include "ash/shelf/shelf_delegate.h"
21 #include "ash/shelf/shelf_layout_manager_observer.h" 22 #include "ash/shelf/shelf_layout_manager_observer.h"
22 #include "ash/shelf/shelf_util.h" 23 #include "ash/shelf/shelf_util.h"
23 #include "ash/shelf/shelf_widget.h" 24 #include "ash/shelf/shelf_widget.h"
24 #include "ash/shell.h" 25 #include "ash/shell.h"
25 #include "ash/shell_window_ids.h" 26 #include "ash/shell_window_ids.h"
26 #include "ash/system/status_area_widget.h" 27 #include "ash/system/status_area_widget.h"
27 #include "ash/wm/aura/wm_window_aura.h" 28 #include "ash/wm/aura/wm_window_aura.h"
28 #include "ash/wm/common/shelf/wm_shelf_util.h" 29 #include "ash/wm/common/shelf/wm_shelf_util.h"
29 #include "ash/wm/common/window_state.h" 30 #include "ash/wm/common/window_state.h"
30 #include "ash/wm/common/wm_root_window_controller.h" 31 #include "ash/wm/common/wm_root_window_controller.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const int ShelfLayoutManager::kWorkspaceAreaAutoHideInset = 5; 94 const int ShelfLayoutManager::kWorkspaceAreaAutoHideInset = 5;
94 95
95 // static 96 // static
96 const int ShelfLayoutManager::kAutoHideSize = 3; 97 const int ShelfLayoutManager::kAutoHideSize = 3;
97 98
98 // static 99 // static
99 const int ShelfLayoutManager::kShelfItemInset = 3; 100 const int ShelfLayoutManager::kShelfItemInset = 3;
100 101
101 // ShelfLayoutManager::AutoHideEventFilter ------------------------------------- 102 // ShelfLayoutManager::AutoHideEventFilter -------------------------------------
102 103
103 // Notifies ShelfLayoutManager any time the mouse moves. 104 // Notifies ShelfLayoutManager any time the mouse moves. Not used on mash.
105 // TODO(jamescook): Delete this once the mash implementation handles drags on
106 // and off the shelf.
104 class ShelfLayoutManager::AutoHideEventFilter : public ui::EventHandler { 107 class ShelfLayoutManager::AutoHideEventFilter : public ui::EventHandler {
105 public: 108 public:
106 explicit AutoHideEventFilter(ShelfLayoutManager* shelf); 109 explicit AutoHideEventFilter(ShelfLayoutManager* shelf);
107 ~AutoHideEventFilter() override; 110 ~AutoHideEventFilter() override;
108 111
109 // Returns true if the last mouse event was a mouse drag. 112 // Returns true if the last mouse event was a mouse drag.
110 bool in_mouse_drag() const { return in_mouse_drag_; } 113 bool in_mouse_drag() const { return in_mouse_drag_; }
111 114
112 // Overridden from ui::EventHandler: 115 // Overridden from ui::EventHandler:
113 void OnMouseEvent(ui::MouseEvent* event) override; 116 void OnMouseEvent(ui::MouseEvent* event) override;
114 void OnGestureEvent(ui::GestureEvent* event) override; 117 void OnGestureEvent(ui::GestureEvent* event) override;
115 118
116 private: 119 private:
117 ShelfLayoutManager* shelf_; 120 ShelfLayoutManager* shelf_;
118 bool in_mouse_drag_; 121 bool in_mouse_drag_;
119 ShelfGestureHandler gesture_handler_;
120 DISALLOW_COPY_AND_ASSIGN(AutoHideEventFilter); 122 DISALLOW_COPY_AND_ASSIGN(AutoHideEventFilter);
121 }; 123 };
122 124
123 ShelfLayoutManager::AutoHideEventFilter::AutoHideEventFilter( 125 ShelfLayoutManager::AutoHideEventFilter::AutoHideEventFilter(
124 ShelfLayoutManager* shelf) 126 ShelfLayoutManager* shelf)
125 : shelf_(shelf), 127 : shelf_(shelf),
126 in_mouse_drag_(false) { 128 in_mouse_drag_(false) {
127 Shell::GetInstance()->AddPreTargetHandler(this); 129 Shell::GetInstance()->AddPreTargetHandler(this);
128 } 130 }
129 131
130 ShelfLayoutManager::AutoHideEventFilter::~AutoHideEventFilter() { 132 ShelfLayoutManager::AutoHideEventFilter::~AutoHideEventFilter() {
131 Shell::GetInstance()->RemovePreTargetHandler(this); 133 Shell::GetInstance()->RemovePreTargetHandler(this);
132 } 134 }
133 135
134 void ShelfLayoutManager::AutoHideEventFilter::OnMouseEvent( 136 void ShelfLayoutManager::AutoHideEventFilter::OnMouseEvent(
135 ui::MouseEvent* event) { 137 ui::MouseEvent* event) {
136 // This also checks IsShelfWindow() to make sure we don't attempt to hide the 138 // This also checks IsShelfWindow() to make sure we don't attempt to hide the
137 // shelf if the mouse down occurs on the shelf. 139 // shelf if the mouse down occurs on the shelf.
138 in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED || 140 in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED ||
139 (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED && 141 (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED &&
140 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) && 142 event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) &&
141 !shelf_->IsShelfWindow(static_cast<aura::Window*>(event->target())); 143 !shelf_->IsShelfWindow(static_cast<aura::Window*>(event->target()));
142 if (event->type() == ui::ET_MOUSE_MOVED) 144 shelf_->UpdateAutoHideForMouseEvent(event);
143 shelf_->UpdateAutoHideState();
144 return;
145 } 145 }
146 146
147 void ShelfLayoutManager::AutoHideEventFilter::OnGestureEvent( 147 void ShelfLayoutManager::AutoHideEventFilter::OnGestureEvent(
148 ui::GestureEvent* event) { 148 ui::GestureEvent* event) {
149 aura::Window* target_window = static_cast<aura::Window*>(event->target()); 149 shelf_->UpdateAutoHideForGestureEvent(event);
150 if (shelf_->IsShelfWindow(target_window)) {
151 if (gesture_handler_.ProcessGestureEvent(*event, target_window))
152 event->StopPropagation();
153 }
154 } 150 }
155 151
156 // ShelfLayoutManager:UpdateShelfObserver -------------------------------------- 152 // ShelfLayoutManager:UpdateShelfObserver --------------------------------------
157 153
158 // UpdateShelfObserver is used to delay updating the background until the 154 // UpdateShelfObserver is used to delay updating the background until the
159 // animation completes. 155 // animation completes.
160 class ShelfLayoutManager::UpdateShelfObserver 156 class ShelfLayoutManager::UpdateShelfObserver
161 : public ui::ImplicitAnimationObserver { 157 : public ui::ImplicitAnimationObserver {
162 public: 158 public:
163 explicit UpdateShelfObserver(ShelfLayoutManager* shelf) : shelf_(shelf) { 159 explicit UpdateShelfObserver(ShelfLayoutManager* shelf) : shelf_(shelf) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 Shell::GetInstance()-> 250 Shell::GetInstance()->
255 session_state_delegate()->RemoveSessionStateObserver(this); 251 session_state_delegate()->RemoveSessionStateObserver(this);
256 if (root_window_controller_observer_) { 252 if (root_window_controller_observer_) {
257 wm::WmWindowAura::Get(root_window_) 253 wm::WmWindowAura::Get(root_window_)
258 ->GetRootWindowController() 254 ->GetRootWindowController()
259 ->RemoveObserver(root_window_controller_observer_.get()); 255 ->RemoveObserver(root_window_controller_observer_.get());
260 } 256 }
261 } 257 }
262 258
263 void ShelfLayoutManager::PrepareForShutdown() { 259 void ShelfLayoutManager::PrepareForShutdown() {
260 in_shutdown_ = true;
264 // Clear all event filters, otherwise sometimes those filters may catch 261 // Clear all event filters, otherwise sometimes those filters may catch
265 // synthesized mouse event and cause crashes during the shutdown. 262 // synthesized mouse event and cause crashes during the shutdown.
266 set_workspace_controller(NULL); 263 set_workspace_controller(NULL);
267 auto_hide_event_filter_.reset(); 264 auto_hide_event_filter_.reset();
268 bezel_event_filter_.reset(); 265 bezel_event_filter_.reset();
269 // Stop observing window change, otherwise we can attempt to update a 266 // Stop observing window change, otherwise we can attempt to update a
270 // partially destructed shelf. 267 // partially destructed shelf.
271 aura::client::GetActivationClient(root_window_)->RemoveObserver(this); 268 aura::client::GetActivationClient(root_window_)->RemoveObserver(this);
272 } 269 }
273 270
274 bool ShelfLayoutManager::IsVisible() const { 271 bool ShelfLayoutManager::IsVisible() const {
275 // status_area_widget() may be NULL during the shutdown. 272 // status_area_widget() may be NULL during the shutdown.
276 return shelf_->status_area_widget() && 273 return shelf_->status_area_widget() &&
277 shelf_->status_area_widget()->IsVisible() && 274 shelf_->status_area_widget()->IsVisible() &&
278 (state_.visibility_state == SHELF_VISIBLE || 275 (state_.visibility_state == SHELF_VISIBLE ||
279 (state_.visibility_state == SHELF_AUTO_HIDE && 276 (state_.visibility_state == SHELF_AUTO_HIDE &&
280 state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN)); 277 state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN));
281 } 278 }
282 279
283 gfx::Rect ShelfLayoutManager::GetIdealBounds() { 280 gfx::Rect ShelfLayoutManager::GetIdealBounds() {
284 gfx::Rect rect(ScreenUtil::GetDisplayBoundsInParent(shelf_->GetNativeView())); 281 gfx::Rect rect(ScreenUtil::GetDisplayBoundsInParent(shelf_->GetNativeView()));
285 return SelectValueForShelfAlignment( 282 return SelectValueForShelfAlignment(
286 gfx::Rect(rect.x(), rect.bottom() - kShelfSize, rect.width(), kShelfSize), 283 gfx::Rect(rect.x(), rect.bottom() - kShelfSize, rect.width(), kShelfSize),
287 gfx::Rect(rect.x(), rect.y(), kShelfSize, rect.height()), 284 gfx::Rect(rect.x(), rect.y(), kShelfSize, rect.height()),
288 gfx::Rect(rect.right() - kShelfSize, rect.y(), kShelfSize, 285 gfx::Rect(rect.right() - kShelfSize, rect.y(), kShelfSize,
289 rect.height())); 286 rect.height()));
290 } 287 }
291 288
289 gfx::Size ShelfLayoutManager::GetPreferredSize() {
290 TargetBounds target_bounds;
291 CalculateTargetBounds(state_, &target_bounds);
292 return target_bounds.shelf_bounds_in_root.size();
293 }
294
292 void ShelfLayoutManager::LayoutShelf() { 295 void ShelfLayoutManager::LayoutShelf() {
293 TargetBounds target_bounds; 296 TargetBounds target_bounds;
294 CalculateTargetBounds(state_, &target_bounds); 297 CalculateTargetBounds(state_, &target_bounds);
295 UpdateBoundsAndOpacity(target_bounds, false, NULL); 298 UpdateBoundsAndOpacity(target_bounds, false, NULL);
296 299
297 // Update insets in ShelfWindowTargeter when shelf bounds change. 300 // Update insets in ShelfWindowTargeter when shelf bounds change.
298 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, 301 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
299 WillChangeVisibilityState(visibility_state())); 302 WillChangeVisibilityState(visibility_state()));
300 } 303 }
301 304
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 auto_hide_timer_.Start( 372 auto_hide_timer_.Start(
370 FROM_HERE, 373 FROM_HERE,
371 base::TimeDelta::FromMilliseconds(kAutoHideDelayMS), 374 base::TimeDelta::FromMilliseconds(kAutoHideDelayMS),
372 this, &ShelfLayoutManager::UpdateAutoHideStateNow); 375 this, &ShelfLayoutManager::UpdateAutoHideStateNow);
373 } 376 }
374 } else { 377 } else {
375 StopAutoHideTimer(); 378 StopAutoHideTimer();
376 } 379 }
377 } 380 }
378 381
382 void ShelfLayoutManager::UpdateAutoHideForMouseEvent(ui::MouseEvent* event) {
383 // Don't update during shutdown because synthetic mouse events (e.g. mouse
384 // exit) may be generated during status area widget teardown.
385 if (visibility_state() != SHELF_AUTO_HIDE || in_shutdown_)
386 return;
387
388 if (event->type() == ui::ET_MOUSE_MOVED ||
389 event->type() == ui::ET_MOUSE_ENTERED ||
390 event->type() == ui::ET_MOUSE_EXITED)
msw 2016/05/25 01:10:34 nit: curlies?
James Cook 2016/05/25 16:24:26 Done.
391 UpdateAutoHideState();
392 }
393
394 void ShelfLayoutManager::UpdateAutoHideForGestureEvent(
395 ui::GestureEvent* event) {
396 if (visibility_state() != SHELF_AUTO_HIDE || in_shutdown_)
397 return;
398
399 aura::Window* target_window = static_cast<aura::Window*>(event->target());
400 if (IsShelfWindow(target_window)) {
401 if (gesture_handler_.ProcessGestureEvent(*event, target_window))
402 event->StopPropagation();
403 }
404 }
405
379 void ShelfLayoutManager::SetWindowOverlapsShelf(bool value) { 406 void ShelfLayoutManager::SetWindowOverlapsShelf(bool value) {
380 window_overlaps_shelf_ = value; 407 window_overlaps_shelf_ = value;
381 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE); 408 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE);
382 } 409 }
383 410
384 void ShelfLayoutManager::AddObserver(ShelfLayoutManagerObserver* observer) { 411 void ShelfLayoutManager::AddObserver(ShelfLayoutManagerObserver* observer) {
385 observers_.AddObserver(observer); 412 observers_.AddObserver(observer);
386 } 413 }
387 414
388 void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) { 415 void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 bool force_update = 600 bool force_update =
574 (gesture_drag_status_ == GESTURE_DRAG_CANCEL_IN_PROGRESS || 601 (gesture_drag_status_ == GESTURE_DRAG_CANCEL_IN_PROGRESS ||
575 gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS); 602 gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS);
576 603
577 if (!force_update && state_.Equals(state)) 604 if (!force_update && state_.Equals(state))
578 return; // Nothing changed. 605 return; // Nothing changed.
579 606
580 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, 607 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
581 WillChangeVisibilityState(visibility_state)); 608 WillChangeVisibilityState(visibility_state));
582 609
583 if (state.visibility_state == SHELF_AUTO_HIDE) { 610 // mash does not support global event handlers. It uses events on the shelf
584 // When state is SHELF_AUTO_HIDE we need to track when the mouse is over the 611 // and status area widgets to update auto-hide.
585 // shelf to unhide it. AutoHideEventFilter does that for us. 612 if (!Shell::GetInstance()->in_mus()) {
586 if (!auto_hide_event_filter_) 613 if (state.visibility_state == SHELF_AUTO_HIDE) {
587 auto_hide_event_filter_.reset(new AutoHideEventFilter(this)); 614 // When state is SHELF_AUTO_HIDE we need to track when the mouse is over
588 } else { 615 // the shelf to unhide it. AutoHideEventFilter does that for us.
589 auto_hide_event_filter_.reset(NULL); 616 if (!auto_hide_event_filter_)
617 auto_hide_event_filter_.reset(new AutoHideEventFilter(this));
618 } else {
619 auto_hide_event_filter_.reset(NULL);
620 }
590 } 621 }
591 622
592 StopAutoHideTimer(); 623 StopAutoHideTimer();
593 624
594 State old_state = state_; 625 State old_state = state_;
595 state_ = state; 626 state_ = state;
596 627
597 BackgroundAnimatorChangeType change_type = BACKGROUND_CHANGE_ANIMATE; 628 BackgroundAnimatorChangeType change_type = BACKGROUND_CHANGE_ANIMATE;
598 bool delay_background_change = false; 629 bool delay_background_change = false;
599 630
(...skipping 27 matching lines...) Expand all
627 658
628 shelf_->SetDimsShelf(state.visibility_state == SHELF_VISIBLE && 659 shelf_->SetDimsShelf(state.visibility_state == SHELF_VISIBLE &&
629 state.window_state == 660 state.window_state ==
630 wm::WORKSPACE_WINDOW_STATE_MAXIMIZED); 661 wm::WORKSPACE_WINDOW_STATE_MAXIMIZED);
631 662
632 TargetBounds target_bounds; 663 TargetBounds target_bounds;
633 CalculateTargetBounds(state_, &target_bounds); 664 CalculateTargetBounds(state_, &target_bounds);
634 UpdateBoundsAndOpacity(target_bounds, true, 665 UpdateBoundsAndOpacity(target_bounds, true,
635 delay_background_change ? update_shelf_observer_ : NULL); 666 delay_background_change ? update_shelf_observer_ : NULL);
636 667
668 // The delegate must be notified after |state_| is updated so that it can
669 // query the new target bounds.
670 ShelfDelegate* shelf_delegate = Shell::GetInstance()->GetShelfDelegate();
671 if (old_state.visibility_state != state_.visibility_state)
672 shelf_delegate->OnShelfVisibilityStateChanged(shelf_->shelf());
673
637 // OnAutoHideStateChanged Should be emitted when: 674 // OnAutoHideStateChanged Should be emitted when:
638 // - firstly state changed to auto-hide from other state 675 // - firstly state changed to auto-hide from other state
639 // - or, auto_hide_state has changed 676 // - or, auto_hide_state has changed
640 if ((old_state.visibility_state != state_.visibility_state && 677 if ((old_state.visibility_state != state_.visibility_state &&
641 state_.visibility_state == SHELF_AUTO_HIDE) || 678 state_.visibility_state == SHELF_AUTO_HIDE) ||
642 old_state.auto_hide_state != state_.auto_hide_state) { 679 old_state.auto_hide_state != state_.auto_hide_state) {
680 shelf_delegate->OnShelfAutoHideStateChanged(shelf_->shelf());
643 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, 681 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
644 OnAutoHideStateChanged(state_.auto_hide_state)); 682 OnAutoHideStateChanged(state_.auto_hide_state));
645 } 683 }
646 } 684 }
647 685
648 void ShelfLayoutManager::UpdateBoundsAndOpacity( 686 void ShelfLayoutManager::UpdateBoundsAndOpacity(
649 const TargetBounds& target_bounds, 687 const TargetBounds& target_bounds,
650 bool animate, 688 bool animate,
651 ui::ImplicitAnimationObserver* observer) { 689 ui::ImplicitAnimationObserver* observer) {
652 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true); 690 base::AutoReset<bool> auto_reset_updating_bounds(&updating_bounds_, true);
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 return SHELF_AUTO_HIDE_SHOWN; 1029 return SHELF_AUTO_HIDE_SHOWN;
992 1030
993 if (shelf_->shelf() && shelf_->shelf()->IsShowingOverflowBubble()) 1031 if (shelf_->shelf() && shelf_->shelf()->IsShowingOverflowBubble())
994 return SHELF_AUTO_HIDE_SHOWN; 1032 return SHELF_AUTO_HIDE_SHOWN;
995 1033
996 if (shelf_->IsActive() || 1034 if (shelf_->IsActive() ||
997 (shelf_->status_area_widget() && 1035 (shelf_->status_area_widget() &&
998 shelf_->status_area_widget()->IsActive())) 1036 shelf_->status_area_widget()->IsActive()))
999 return SHELF_AUTO_HIDE_SHOWN; 1037 return SHELF_AUTO_HIDE_SHOWN;
1000 1038
1001 const std::vector<aura::Window*> windows = 1039 // TODO(jamescook): Track visible windows on mash via ShelfDelegate.
1002 shell->mru_window_tracker()->BuildWindowListIgnoreModal(); 1040 if (!Shell::GetInstance()->in_mus()) {
1041 const std::vector<aura::Window*> windows =
1042 shell->mru_window_tracker()->BuildWindowListIgnoreModal();
1003 1043
1004 // Process the window list and check if there are any visible windows. 1044 // Process the window list and check if there are any visible windows.
1005 bool visible_window = false; 1045 bool visible_window = false;
1006 for (size_t i = 0; i < windows.size(); ++i) { 1046 for (size_t i = 0; i < windows.size(); ++i) {
1007 if (windows[i] && windows[i]->IsVisible() && 1047 if (windows[i] && windows[i]->IsVisible() &&
1008 !wm::GetWindowState(windows[i])->IsMinimized() && 1048 !wm::GetWindowState(windows[i])->IsMinimized() &&
1009 root_window_ == windows[i]->GetRootWindow()) { 1049 root_window_ == windows[i]->GetRootWindow()) {
1010 visible_window = true; 1050 visible_window = true;
1011 break; 1051 break;
1052 }
1012 } 1053 }
1054 // If there are no visible windows do not hide the shelf.
1055 if (!visible_window)
1056 return SHELF_AUTO_HIDE_SHOWN;
1013 } 1057 }
1014 // If there are no visible windows do not hide the shelf.
1015 if (!visible_window)
1016 return SHELF_AUTO_HIDE_SHOWN;
1017 1058
1018 if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) 1059 if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS)
1019 return gesture_drag_auto_hide_state_; 1060 return gesture_drag_auto_hide_state_;
1020 1061
1021 // Don't show if the user is dragging the mouse. 1062 // Don't show if the user is dragging the mouse.
1022 if (auto_hide_event_filter_.get() && auto_hide_event_filter_->in_mouse_drag()) 1063 if (auto_hide_event_filter_.get() && auto_hide_event_filter_->in_mouse_drag())
1023 return SHELF_AUTO_HIDE_HIDDEN; 1064 return SHELF_AUTO_HIDE_HIDDEN;
1024 1065
1025 // Ignore the mouse position if mouse events are disabled. 1066 // Ignore the mouse position if mouse events are disabled.
1026 aura::client::CursorClient* cursor_client = aura::client::GetCursorClient( 1067 aura::client::CursorClient* cursor_client = aura::client::GetCursorClient(
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 UpdateBoundsAndOpacity(target_bounds, true, NULL); 1186 UpdateBoundsAndOpacity(target_bounds, true, NULL);
1146 UpdateVisibilityState(); 1187 UpdateVisibilityState();
1147 } 1188 }
1148 1189
1149 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() { 1190 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() {
1150 UpdateVisibilityState(); 1191 UpdateVisibilityState();
1151 LayoutShelf(); 1192 LayoutShelf();
1152 } 1193 }
1153 1194
1154 } // namespace ash 1195 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698