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

Side by Side Diff: ash/launcher/launcher_tooltip_manager.cc

Issue 23536012: [ash] Hide tooltip when mouse button is pressed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments Created 7 years, 3 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 | ash/launcher/launcher_tooltip_manager_unittest.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/launcher/launcher_tooltip_manager.h" 5 #include "ash/launcher/launcher_tooltip_manager.h"
6 6
7 #include "ash/launcher/launcher_view.h" 7 #include "ash/launcher/launcher_view.h"
8 #include "ash/shelf/shelf_layout_manager.h" 8 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 void LauncherTooltipManager::OnMouseEvent(ui::MouseEvent* event) { 250 void LauncherTooltipManager::OnMouseEvent(ui::MouseEvent* event) {
251 DCHECK(event); 251 DCHECK(event);
252 DCHECK(event->target()); 252 DCHECK(event->target());
253 if (!widget_ || !widget_->IsVisible()) 253 if (!widget_ || !widget_->IsVisible())
254 return; 254 return;
255 255
256 DCHECK(view_); 256 DCHECK(view_);
257 DCHECK(launcher_view_); 257 DCHECK(launcher_view_);
258 258
259 // Pressing the mouse button anywhere should close the tooltip.
260 if (event->type() == ui::ET_MOUSE_PRESSED) {
261 CloseSoon();
262 return;
263 }
264
259 aura::Window* target = static_cast<aura::Window*>(event->target()); 265 aura::Window* target = static_cast<aura::Window*>(event->target());
260 if (widget_->GetNativeWindow()->GetRootWindow() != target->GetRootWindow()) { 266 if (widget_->GetNativeWindow()->GetRootWindow() != target->GetRootWindow()) {
261 CloseSoon(); 267 CloseSoon();
262 return; 268 return;
263 } 269 }
264 270
265 gfx::Point location_in_launcher_view = event->location(); 271 gfx::Point location_in_launcher_view = event->location();
266 aura::Window::ConvertPointToTarget( 272 aura::Window::ConvertPointToTarget(
267 target, launcher_view_->GetWidget()->GetNativeWindow(), 273 target, launcher_view_->GetWidget()->GetNativeWindow(),
268 &location_in_launcher_view); 274 &location_in_launcher_view);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 new_timer->Start( 373 new_timer->Start(
368 FROM_HERE, 374 FROM_HERE,
369 base::TimeDelta::FromMilliseconds(delay_in_ms), 375 base::TimeDelta::FromMilliseconds(delay_in_ms),
370 this, 376 this,
371 &LauncherTooltipManager::ShowInternal); 377 &LauncherTooltipManager::ShowInternal);
372 timer_.reset(new_timer); 378 timer_.reset(new_timer);
373 } 379 }
374 380
375 } // namespace internal 381 } // namespace internal
376 } // namespace ash 382 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/launcher/launcher_tooltip_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698