OLD | NEW |
---|---|
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 Loading... | |
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 wm::WmRootWindowController* controller = |
238 ->AddObserver(root_window_controller_observer_.get()); | 236 wm::WmWindowAura::Get(root_window_)->GetRootWindowController(); |
237 if (controller) { | |
238 root_window_controller_observer_.reset( | |
239 new RootWindowControllerObserverImpl(this)); | |
240 controller->AddObserver(root_window_controller_observer_.get()); | |
241 } else { | |
242 DCHECK(Shell::GetInstance()->in_mus()); | |
sky
2016/04/28 15:23:12
What about wrapping this whole thing in !Shell::Ge
sadrul
2016/04/28 15:28:51
Done.
| |
243 } | |
239 Shell::GetInstance()->lock_state_controller()->AddObserver(this); | 244 Shell::GetInstance()->lock_state_controller()->AddObserver(this); |
240 aura::client::GetActivationClient(root_window_)->AddObserver(this); | 245 aura::client::GetActivationClient(root_window_)->AddObserver(this); |
241 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this); | 246 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this); |
242 } | 247 } |
243 | 248 |
244 ShelfLayoutManager::~ShelfLayoutManager() { | 249 ShelfLayoutManager::~ShelfLayoutManager() { |
245 if (update_shelf_observer_) | 250 if (update_shelf_observer_) |
246 update_shelf_observer_->Detach(); | 251 update_shelf_observer_->Detach(); |
247 | 252 |
248 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf()); | 253 FOR_EACH_OBSERVER(ShelfLayoutManagerObserver, observers_, WillDeleteShelf()); |
249 Shell::GetInstance()->RemoveShellObserver(this); | 254 Shell::GetInstance()->RemoveShellObserver(this); |
250 Shell::GetInstance()->lock_state_controller()->RemoveObserver(this); | 255 Shell::GetInstance()->lock_state_controller()->RemoveObserver(this); |
251 Shell::GetInstance()-> | 256 Shell::GetInstance()-> |
252 session_state_delegate()->RemoveSessionStateObserver(this); | 257 session_state_delegate()->RemoveSessionStateObserver(this); |
253 wm::WmWindowAura::Get(root_window_) | 258 if (root_window_controller_observer_) { |
254 ->GetRootWindowController() | 259 wm::WmWindowAura::Get(root_window_) |
255 ->RemoveObserver(root_window_controller_observer_.get()); | 260 ->GetRootWindowController() |
261 ->RemoveObserver(root_window_controller_observer_.get()); | |
262 } | |
256 } | 263 } |
257 | 264 |
258 void ShelfLayoutManager::PrepareForShutdown() { | 265 void ShelfLayoutManager::PrepareForShutdown() { |
259 // Clear all event filters, otherwise sometimes those filters may catch | 266 // Clear all event filters, otherwise sometimes those filters may catch |
260 // synthesized mouse event and cause crashes during the shutdown. | 267 // synthesized mouse event and cause crashes during the shutdown. |
261 set_workspace_controller(NULL); | 268 set_workspace_controller(NULL); |
262 auto_hide_event_filter_.reset(); | 269 auto_hide_event_filter_.reset(); |
263 bezel_event_filter_.reset(); | 270 bezel_event_filter_.reset(); |
264 // Stop observing window change, otherwise we can attempt to update a | 271 // Stop observing window change, otherwise we can attempt to update a |
265 // partially destructed shelf. | 272 // partially destructed shelf. |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1135 UpdateBoundsAndOpacity(target_bounds, true, NULL); | 1142 UpdateBoundsAndOpacity(target_bounds, true, NULL); |
1136 UpdateVisibilityState(); | 1143 UpdateVisibilityState(); |
1137 } | 1144 } |
1138 | 1145 |
1139 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() { | 1146 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() { |
1140 UpdateVisibilityState(); | 1147 UpdateVisibilityState(); |
1141 LayoutShelf(); | 1148 LayoutShelf(); |
1142 } | 1149 } |
1143 | 1150 |
1144 } // namespace ash | 1151 } // namespace ash |
OLD | NEW |