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

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

Issue 2391253004: Use mojo Shelf interfaces for both mash and classic ash. (Closed)
Patch Set: Address comments. Created 4 years, 2 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/common/shelf/shelf_delegate.h ('k') | ash/common/shelf/shelf_widget.h » ('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/common/shelf/shelf_layout_manager.h" 5 #include "ash/common/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
11 #include "ash/common/material_design/material_design_controller.h" 11 #include "ash/common/material_design/material_design_controller.h"
12 #include "ash/common/session/session_state_delegate.h" 12 #include "ash/common/session/session_state_delegate.h"
13 #include "ash/common/shelf/shelf_constants.h" 13 #include "ash/common/shelf/shelf_constants.h"
14 #include "ash/common/shelf/shelf_delegate.h"
15 #include "ash/common/shelf/shelf_layout_manager_observer.h" 14 #include "ash/common/shelf/shelf_layout_manager_observer.h"
16 #include "ash/common/shelf/wm_shelf.h" 15 #include "ash/common/shelf/wm_shelf.h"
17 #include "ash/common/shelf/wm_shelf_util.h" 16 #include "ash/common/shelf/wm_shelf_util.h"
18 #include "ash/common/shell_window_ids.h" 17 #include "ash/common/shell_window_ids.h"
19 #include "ash/common/system/status_area_widget.h" 18 #include "ash/common/system/status_area_widget.h"
20 #include "ash/common/wm/fullscreen_window_finder.h" 19 #include "ash/common/wm/fullscreen_window_finder.h"
21 #include "ash/common/wm/mru_window_tracker.h" 20 #include "ash/common/wm/mru_window_tracker.h"
22 #include "ash/common/wm/window_state.h" 21 #include "ash/common/wm/window_state.h"
23 #include "ash/common/wm/wm_screen_util.h" 22 #include "ash/common/wm/wm_screen_util.h"
24 #include "ash/common/wm_lookup.h" 23 #include "ash/common/wm_lookup.h"
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 shelf_widget_->SetDimsShelf(state.visibility_state == SHELF_VISIBLE && 503 shelf_widget_->SetDimsShelf(state.visibility_state == SHELF_VISIBLE &&
505 state.window_state == 504 state.window_state ==
506 wm::WORKSPACE_WINDOW_STATE_MAXIMIZED); 505 wm::WORKSPACE_WINDOW_STATE_MAXIMIZED);
507 506
508 TargetBounds target_bounds; 507 TargetBounds target_bounds;
509 CalculateTargetBounds(state_, &target_bounds); 508 CalculateTargetBounds(state_, &target_bounds);
510 UpdateBoundsAndOpacity( 509 UpdateBoundsAndOpacity(
511 target_bounds, true /* animate */, true /* change_work_area */, 510 target_bounds, true /* animate */, true /* change_work_area */,
512 delay_background_change ? update_shelf_observer_ : NULL); 511 delay_background_change ? update_shelf_observer_ : NULL);
513 512
514 // The delegate must be notified after |state_| is updated so that it can
515 // query the new target bounds.
516 ShelfDelegate* shelf_delegate = WmShell::Get()->shelf_delegate();
517 DCHECK(shelf_delegate);
518 if (old_state.visibility_state != state_.visibility_state)
519 shelf_delegate->OnShelfVisibilityStateChanged(wm_shelf_);
520
521 // OnAutoHideStateChanged Should be emitted when: 513 // OnAutoHideStateChanged Should be emitted when:
522 // - firstly state changed to auto-hide from other state 514 // - firstly state changed to auto-hide from other state
523 // - or, auto_hide_state has changed 515 // - or, auto_hide_state has changed
524 if ((old_state.visibility_state != state_.visibility_state && 516 if ((old_state.visibility_state != state_.visibility_state &&
525 state_.visibility_state == SHELF_AUTO_HIDE) || 517 state_.visibility_state == SHELF_AUTO_HIDE) ||
526 old_state.auto_hide_state != state_.auto_hide_state) { 518 old_state.auto_hide_state != state_.auto_hide_state) {
527 shelf_delegate->OnShelfAutoHideStateChanged(wm_shelf_);
528 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, 519 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_,
529 OnAutoHideStateChanged(state_.auto_hide_state)); 520 OnAutoHideStateChanged(state_.auto_hide_state));
530 } 521 }
531 } 522 }
532 523
533 void ShelfLayoutManager::UpdateBoundsAndOpacity( 524 void ShelfLayoutManager::UpdateBoundsAndOpacity(
534 const TargetBounds& target_bounds, 525 const TargetBounds& target_bounds,
535 bool animate, 526 bool animate,
536 bool change_work_area, 527 bool change_work_area,
537 ui::ImplicitAnimationObserver* observer) { 528 ui::ImplicitAnimationObserver* observer) {
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 gesture_drag_status_ = GESTURE_DRAG_NONE; 1102 gesture_drag_status_ = GESTURE_DRAG_NONE;
1112 } 1103 }
1113 1104
1114 void ShelfLayoutManager::CancelGestureDrag() { 1105 void ShelfLayoutManager::CancelGestureDrag() {
1115 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; 1106 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS;
1116 UpdateVisibilityState(); 1107 UpdateVisibilityState();
1117 gesture_drag_status_ = GESTURE_DRAG_NONE; 1108 gesture_drag_status_ = GESTURE_DRAG_NONE;
1118 } 1109 }
1119 1110
1120 } // namespace ash 1111 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_delegate.h ('k') | ash/common/shelf/shelf_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698