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

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

Issue 1949823002: WIP: Eliminate event.target() usage from TrayEventFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: container delegate 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 | « ash/shelf/shelf_tooltip_manager.h ('k') | ash/shell.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 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 void ShelfTooltipManager::ShowTooltipWithDelay(views::View* view) { 168 void ShelfTooltipManager::ShowTooltipWithDelay(views::View* view) {
169 if (!shelf_layout_manager_ || shelf_layout_manager_->IsVisible()) { 169 if (!shelf_layout_manager_ || shelf_layout_manager_->IsVisible()) {
170 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(timer_delay_), 170 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(timer_delay_),
171 base::Bind(&ShelfTooltipManager::ShowTooltip, 171 base::Bind(&ShelfTooltipManager::ShowTooltip,
172 weak_factory_.GetWeakPtr(), view)); 172 weak_factory_.GetWeakPtr(), view));
173 } 173 }
174 } 174 }
175 175
176 void ShelfTooltipManager::OnMousePressed(const ui::MouseEvent& event, 176 void ShelfTooltipManager::OnMousePressed(const ui::MouseEvent& event,
177 const gfx::Point& location_in_screen) { 177 const gfx::Point& location_in_screen,
178 views::Widget* target) {
178 // Close on any mouse press events inside or outside the tooltip. 179 // Close on any mouse press events inside or outside the tooltip.
179 Close(); 180 Close();
180 } 181 }
181 182
182 void ShelfTooltipManager::OnTouchPressed(const ui::TouchEvent& event, 183 void ShelfTooltipManager::OnTouchPressed(const ui::TouchEvent& event,
183 const gfx::Point& location_in_screen) { 184 const gfx::Point& location_in_screen,
185 views::Widget* target) {
184 // Close on any touch press events inside or outside the tooltip. 186 // Close on any touch press events inside or outside the tooltip.
185 Close(); 187 Close();
186 } 188 }
187 189
188 void ShelfTooltipManager::OnEvent(ui::Event* event) { 190 void ShelfTooltipManager::OnEvent(ui::Event* event) {
189 // Mouse and touch press events are handled via views::PointerWatcher. 191 // Mouse and touch press events are handled via views::PointerWatcher.
190 if (event->type() == ui::ET_MOUSE_PRESSED || 192 if (event->type() == ui::ET_MOUSE_PRESSED ||
191 event->type() == ui::ET_TOUCH_PRESSED) { 193 event->type() == ui::ET_TOUCH_PRESSED) {
192 return; 194 return;
193 } 195 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // AutoHide state change happens during an event filter, so immediate close 245 // AutoHide state change happens during an event filter, so immediate close
244 // 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
245 // schedule the Close here. 247 // schedule the Close here.
246 base::ThreadTaskRunnerHandle::Get()->PostTask( 248 base::ThreadTaskRunnerHandle::Get()->PostTask(
247 FROM_HERE, 249 FROM_HERE,
248 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr())); 250 base::Bind(&ShelfTooltipManager::Close, weak_factory_.GetWeakPtr()));
249 } 251 }
250 } 252 }
251 253
252 } // namespace ash 254 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_tooltip_manager.h ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698