| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_tooltip_manager.h" | 5 #include "ash/shelf/shelf_tooltip_manager.h" |
| 6 | 6 |
| 7 #include "ash/shelf/shelf.h" | 7 #include "ash/shelf/shelf.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shelf/shelf_view.h" | 9 #include "ash/shelf/shelf_view.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 ShelfTooltipManager::ShelfTooltipManager(ShelfView* shelf_view) | 95 ShelfTooltipManager::ShelfTooltipManager(ShelfView* shelf_view) |
| 96 : timer_delay_(kTooltipAppearanceDelay), | 96 : timer_delay_(kTooltipAppearanceDelay), |
| 97 shelf_view_(shelf_view), | 97 shelf_view_(shelf_view), |
| 98 root_window_(nullptr), | 98 root_window_(nullptr), |
| 99 shelf_layout_manager_(nullptr), | 99 shelf_layout_manager_(nullptr), |
| 100 bubble_(nullptr), | 100 bubble_(nullptr), |
| 101 weak_factory_(this) {} | 101 weak_factory_(this) {} |
| 102 | 102 |
| 103 ShelfTooltipManager::~ShelfTooltipManager() { | 103 ShelfTooltipManager::~ShelfTooltipManager() { |
| 104 WillDeleteShelf(); | 104 WillDeleteShelfLayoutManager(); |
| 105 | 105 |
| 106 Shell::GetInstance()->RemovePointerWatcher(this); | 106 Shell::GetInstance()->RemovePointerWatcher(this); |
| 107 | 107 |
| 108 if (root_window_) { | 108 if (root_window_) { |
| 109 root_window_->RemoveObserver(this); | 109 root_window_->RemoveObserver(this); |
| 110 root_window_->RemovePreTargetHandler(this); | 110 root_window_->RemovePreTargetHandler(this); |
| 111 root_window_ = nullptr; | 111 root_window_ = nullptr; |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 219 } |
| 220 | 220 |
| 221 void ShelfTooltipManager::OnWindowDestroying(aura::Window* window) { | 221 void ShelfTooltipManager::OnWindowDestroying(aura::Window* window) { |
| 222 if (window == root_window_) { | 222 if (window == root_window_) { |
| 223 root_window_->RemoveObserver(this); | 223 root_window_->RemoveObserver(this); |
| 224 root_window_->RemovePreTargetHandler(this); | 224 root_window_->RemovePreTargetHandler(this); |
| 225 root_window_ = nullptr; | 225 root_window_ = nullptr; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 void ShelfTooltipManager::WillDeleteShelf() { | 229 void ShelfTooltipManager::WillDeleteShelfLayoutManager() { |
| 230 if (shelf_layout_manager_) | 230 if (shelf_layout_manager_) |
| 231 shelf_layout_manager_->RemoveObserver(this); | 231 shelf_layout_manager_->RemoveObserver(this); |
| 232 shelf_layout_manager_ = nullptr; | 232 shelf_layout_manager_ = nullptr; |
| 233 shelf_view_ = nullptr; | 233 shelf_view_ = nullptr; |
| 234 } | 234 } |
| 235 | 235 |
| 236 void ShelfTooltipManager::WillChangeVisibilityState( | 236 void ShelfTooltipManager::WillChangeVisibilityState( |
| 237 ShelfVisibilityState new_state) { | 237 ShelfVisibilityState new_state) { |
| 238 if (new_state == SHELF_HIDDEN) | 238 if (new_state == SHELF_HIDDEN) |
| 239 Close(); | 239 Close(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void ShelfTooltipManager::OnAutoHideStateChanged(ShelfAutoHideState new_state) { | 242 void ShelfTooltipManager::OnAutoHideStateChanged(ShelfAutoHideState new_state) { |
| 243 if (new_state == SHELF_AUTO_HIDE_HIDDEN) { | 243 if (new_state == SHELF_AUTO_HIDE_HIDDEN) { |
| 244 timer_.Stop(); | 244 timer_.Stop(); |
| 245 // AutoHide state change happens during an event filter, so immediate close | 245 // AutoHide state change happens during an event filter, so immediate close |
| 246 // may cause a crash in the HandleMouseEvent() after the filter. So we just | 246 // may cause a crash in the HandleMouseEvent() after the filter. So we just |
| 247 // schedule the Close here. | 247 // schedule the Close here. |
| 248 base::ThreadTaskRunnerHandle::Get()->PostTask( | 248 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 249 FROM_HERE, | 249 FROM_HERE, |
| 250 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr())); | 250 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr())); |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace ash | 254 } // namespace ash |
| OLD | NEW |