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

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

Issue 2177663002: mash: Move ownership of ShelfDelegate to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix wallpaper tests again Created 4 years, 5 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_delegate.h ('k') | ash/shelf/shelf_view.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 <cstring> 9 #include <cstring>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "ash/aura/wm_window_aura.h" 13 #include "ash/aura/wm_window_aura.h"
14 #include "ash/common/accelerators/accelerator_commands.h" 14 #include "ash/common/accelerators/accelerator_commands.h"
15 #include "ash/common/ash_switches.h" 15 #include "ash/common/ash_switches.h"
16 #include "ash/common/material_design/material_design_controller.h" 16 #include "ash/common/material_design/material_design_controller.h"
17 #include "ash/common/session/session_state_delegate.h" 17 #include "ash/common/session/session_state_delegate.h"
18 #include "ash/common/shelf/shelf_constants.h" 18 #include "ash/common/shelf/shelf_constants.h"
19 #include "ash/common/shelf/shelf_delegate.h"
19 #include "ash/common/shelf/wm_shelf_util.h" 20 #include "ash/common/shelf/wm_shelf_util.h"
20 #include "ash/common/shell_window_ids.h" 21 #include "ash/common/shell_window_ids.h"
21 #include "ash/common/system/status_area_widget.h" 22 #include "ash/common/system/status_area_widget.h"
22 #include "ash/common/wm/mru_window_tracker.h" 23 #include "ash/common/wm/mru_window_tracker.h"
23 #include "ash/common/wm/window_state.h" 24 #include "ash/common/wm/window_state.h"
24 #include "ash/common/wm_root_window_controller.h" 25 #include "ash/common/wm_root_window_controller.h"
25 #include "ash/common/wm_root_window_controller_observer.h" 26 #include "ash/common/wm_root_window_controller_observer.h"
26 #include "ash/common/wm_shell.h" 27 #include "ash/common/wm_shell.h"
27 #include "ash/root_window_controller.h" 28 #include "ash/root_window_controller.h"
28 #include "ash/screen_util.h" 29 #include "ash/screen_util.h"
29 #include "ash/shelf/shelf.h" 30 #include "ash/shelf/shelf.h"
30 #include "ash/shelf/shelf_bezel_event_filter.h" 31 #include "ash/shelf/shelf_bezel_event_filter.h"
31 #include "ash/shelf/shelf_delegate.h"
32 #include "ash/shelf/shelf_layout_manager_observer.h" 32 #include "ash/shelf/shelf_layout_manager_observer.h"
33 #include "ash/shelf/shelf_util.h" 33 #include "ash/shelf/shelf_util.h"
34 #include "ash/shelf/shelf_widget.h" 34 #include "ash/shelf/shelf_widget.h"
35 #include "ash/shell.h" 35 #include "ash/shell.h"
36 #include "ash/wm/gestures/shelf_gesture_handler.h" 36 #include "ash/wm/gestures/shelf_gesture_handler.h"
37 #include "ash/wm/window_animations.h" 37 #include "ash/wm/window_animations.h"
38 #include "ash/wm/window_state_aura.h" 38 #include "ash/wm/window_state_aura.h"
39 #include "ash/wm/window_util.h" 39 #include "ash/wm/window_util.h"
40 #include "ash/wm/workspace_controller.h" 40 #include "ash/wm/workspace_controller.h"
41 #include "base/auto_reset.h" 41 #include "base/auto_reset.h"
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 wm::WORKSPACE_WINDOW_STATE_MAXIMIZED); 679 wm::WORKSPACE_WINDOW_STATE_MAXIMIZED);
680 680
681 TargetBounds target_bounds; 681 TargetBounds target_bounds;
682 CalculateTargetBounds(state_, &target_bounds); 682 CalculateTargetBounds(state_, &target_bounds);
683 UpdateBoundsAndOpacity(target_bounds, true, delay_background_change 683 UpdateBoundsAndOpacity(target_bounds, true, delay_background_change
684 ? update_shelf_observer_ 684 ? update_shelf_observer_
685 : NULL); 685 : NULL);
686 686
687 // The delegate must be notified after |state_| is updated so that it can 687 // The delegate must be notified after |state_| is updated so that it can
688 // query the new target bounds. 688 // query the new target bounds.
689 ShelfDelegate* shelf_delegate = Shell::GetInstance()->GetShelfDelegate(); 689 ShelfDelegate* shelf_delegate = WmShell::Get()->shelf_delegate();
690 DCHECK(shelf_delegate);
690 if (old_state.visibility_state != state_.visibility_state) 691 if (old_state.visibility_state != state_.visibility_state)
691 shelf_delegate->OnShelfVisibilityStateChanged(shelf_widget_->shelf()); 692 shelf_delegate->OnShelfVisibilityStateChanged(shelf_widget_->shelf());
692 693
693 // OnAutoHideStateChanged Should be emitted when: 694 // OnAutoHideStateChanged Should be emitted when:
694 // - firstly state changed to auto-hide from other state 695 // - firstly state changed to auto-hide from other state
695 // - or, auto_hide_state has changed 696 // - or, auto_hide_state has changed
696 if ((old_state.visibility_state != state_.visibility_state && 697 if ((old_state.visibility_state != state_.visibility_state &&
697 state_.visibility_state == SHELF_AUTO_HIDE) || 698 state_.visibility_state == SHELF_AUTO_HIDE) ||
698 old_state.auto_hide_state != state_.auto_hide_state) { 699 old_state.auto_hide_state != state_.auto_hide_state) {
699 shelf_delegate->OnShelfAutoHideStateChanged(shelf_widget_->shelf()); 700 shelf_delegate->OnShelfAutoHideStateChanged(shelf_widget_->shelf());
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 if (ash::MaterialDesignController::IsShelfMaterial()) { 1206 if (ash::MaterialDesignController::IsShelfMaterial()) {
1206 return (state.visibility_state == SHELF_AUTO_HIDE && 1207 return (state.visibility_state == SHELF_AUTO_HIDE &&
1207 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN) 1208 state.auto_hide_state == SHELF_AUTO_HIDE_SHOWN)
1208 ? 1.0f 1209 ? 1.0f
1209 : 0.0f; 1210 : 0.0f;
1210 } 1211 }
1211 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f; 1212 return (state.visibility_state == SHELF_AUTO_HIDE) ? 1.0f : 0.0f;
1212 } 1213 }
1213 1214
1214 } // namespace ash 1215 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_delegate.h ('k') | ash/shelf/shelf_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698