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

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

Issue 1916913007: mus/ash: WmRootWindowController can be null in mus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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 | « no previous file | no next file » | 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>
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 shelf_(shelf), 222 shelf_(shelf),
223 workspace_controller_(NULL), 223 workspace_controller_(NULL),
224 window_overlaps_shelf_(false), 224 window_overlaps_shelf_(false),
225 mouse_over_shelf_when_auto_hide_timer_started_(false), 225 mouse_over_shelf_when_auto_hide_timer_started_(false),
226 bezel_event_filter_(new ShelfBezelEventFilter(this)), 226 bezel_event_filter_(new ShelfBezelEventFilter(this)),
227 gesture_drag_status_(GESTURE_DRAG_NONE), 227 gesture_drag_status_(GESTURE_DRAG_NONE),
228 gesture_drag_amount_(0.f), 228 gesture_drag_amount_(0.f),
229 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), 229 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN),
230 update_shelf_observer_(NULL), 230 update_shelf_observer_(NULL),
231 chromevox_panel_height_(0), 231 chromevox_panel_height_(0),
232 duration_override_in_ms_(0), 232 duration_override_in_ms_(0) {
233 root_window_controller_observer_(
234 new RootWindowControllerObserverImpl(this)) {
235 Shell::GetInstance()->AddShellObserver(this); 233 Shell::GetInstance()->AddShellObserver(this);
236 wm::WmWindowAura::Get(root_window_) 234
237 ->GetRootWindowController() 235 if (!Shell::GetInstance()->in_mus()) {
238 ->AddObserver(root_window_controller_observer_.get()); 236 root_window_controller_observer_.reset(
237 new RootWindowControllerObserverImpl(this));
238 wm::WmWindowAura::Get(root_window_)
239 ->GetRootWindowController()
240 ->AddObserver(root_window_controller_observer_.get());
241 }
239 Shell::GetInstance()->lock_state_controller()->AddObserver(this); 242 Shell::GetInstance()->lock_state_controller()->AddObserver(this);
240 aura::client::GetActivationClient(root_window_)->AddObserver(this); 243 aura::client::GetActivationClient(root_window_)->AddObserver(this);
241 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this); 244 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this);
242 } 245 }
243 246
244 ShelfLayoutManager::~ShelfLayoutManager() { 247 ShelfLayoutManager::~ShelfLayoutManager() {
245 if (update_shelf_observer_) 248 if (update_shelf_observer_)
246 update_shelf_observer_->Detach(); 249 update_shelf_observer_->Detach();
247 250
248 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf()); 251 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf());
249 Shell::GetInstance()->RemoveShellObserver(this); 252 Shell::GetInstance()->RemoveShellObserver(this);
250 Shell::GetInstance()->lock_state_controller()->RemoveObserver(this); 253 Shell::GetInstance()->lock_state_controller()->RemoveObserver(this);
251 Shell::GetInstance()-> 254 Shell::GetInstance()->
252 session_state_delegate()->RemoveSessionStateObserver(this); 255 session_state_delegate()->RemoveSessionStateObserver(this);
253 wm::WmWindowAura::Get(root_window_) 256 if (root_window_controller_observer_) {
254 ->GetRootWindowController() 257 wm::WmWindowAura::Get(root_window_)
255 ->RemoveObserver(root_window_controller_observer_.get()); 258 ->GetRootWindowController()
259 ->RemoveObserver(root_window_controller_observer_.get());
260 }
256 } 261 }
257 262
258 void ShelfLayoutManager::PrepareForShutdown() { 263 void ShelfLayoutManager::PrepareForShutdown() {
259 // Clear all event filters, otherwise sometimes those filters may catch 264 // Clear all event filters, otherwise sometimes those filters may catch
260 // synthesized mouse event and cause crashes during the shutdown. 265 // synthesized mouse event and cause crashes during the shutdown.
261 set_workspace_controller(NULL); 266 set_workspace_controller(NULL);
262 auto_hide_event_filter_.reset(); 267 auto_hide_event_filter_.reset();
263 bezel_event_filter_.reset(); 268 bezel_event_filter_.reset();
264 // Stop observing window change, otherwise we can attempt to update a 269 // Stop observing window change, otherwise we can attempt to update a
265 // partially destructed shelf. 270 // partially destructed shelf.
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 UpdateBoundsAndOpacity(target_bounds, true, NULL); 1140 UpdateBoundsAndOpacity(target_bounds, true, NULL);
1136 UpdateVisibilityState(); 1141 UpdateVisibilityState();
1137 } 1142 }
1138 1143
1139 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() { 1144 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() {
1140 UpdateVisibilityState(); 1145 UpdateVisibilityState();
1141 LayoutShelf(); 1146 LayoutShelf();
1142 } 1147 }
1143 1148
1144 } // namespace ash 1149 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698