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

Side by Side Diff: ui/views/corewm/tooltip_controller.cc

Issue 23477022: Two changes to desktop aura for tooltips: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 2013 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/test/event_generator.cc ('k') | ui/views/corewm/tooltip_controller_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 "ui/views/corewm/tooltip_controller.h" 5 #include "ui/views/corewm/tooltip_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // simply simulate a timeout. 249 // simply simulate a timeout.
250 if (tooltip_shown_timer_.IsRunning()) { 250 if (tooltip_shown_timer_.IsRunning()) {
251 tooltip_shown_timer_.Stop(); 251 tooltip_shown_timer_.Stop();
252 TooltipShownTimerFired(); 252 TooltipShownTimerFired();
253 } 253 }
254 } 254 }
255 255
256 void TooltipController::OnMouseEvent(ui::MouseEvent* event) { 256 void TooltipController::OnMouseEvent(ui::MouseEvent* event) {
257 aura::Window* target = static_cast<aura::Window*>(event->target()); 257 aura::Window* target = static_cast<aura::Window*>(event->target());
258 switch (event->type()) { 258 switch (event->type()) {
259 case ui::ET_MOUSE_EXITED:
260 target = NULL;
261 // Fall through.
259 case ui::ET_MOUSE_MOVED: 262 case ui::ET_MOUSE_MOVED:
260 case ui::ET_MOUSE_DRAGGED: 263 case ui::ET_MOUSE_DRAGGED:
261 if (tooltip_window_ != target) { 264 if (tooltip_window_ != target) {
262 if (tooltip_window_) 265 if (tooltip_window_)
263 tooltip_window_->RemoveObserver(this); 266 tooltip_window_->RemoveObserver(this);
264 tooltip_window_ = target; 267 tooltip_window_ = target;
265 tooltip_window_->AddObserver(this); 268 if (tooltip_window_)
269 tooltip_window_->AddObserver(this);
266 } 270 }
267 curr_mouse_loc_ = event->location(); 271 curr_mouse_loc_ = event->location();
268 if (tooltip_timer_.IsRunning()) 272 if (tooltip_timer_.IsRunning())
269 tooltip_timer_.Reset(); 273 tooltip_timer_.Reset();
270 274
271 if (GetTooltip()->IsVisible()) 275 if (GetTooltip()->IsVisible())
272 UpdateIfRequired(); 276 UpdateIfRequired();
273 break; 277 break;
274 case ui::ET_MOUSE_PRESSED: 278 case ui::ET_MOUSE_PRESSED:
275 if ((event->flags() & ui::EF_IS_NON_CLIENT) == 0) { 279 if ((event->flags() & ui::EF_IS_NON_CLIENT) == 0) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 int TooltipController::GetTooltipShownTimeout() { 532 int TooltipController::GetTooltipShownTimeout() {
529 std::map<aura::Window*, int>::const_iterator it = 533 std::map<aura::Window*, int>::const_iterator it =
530 tooltip_shown_timeout_map_.find(tooltip_window_); 534 tooltip_shown_timeout_map_.find(tooltip_window_);
531 if (it == tooltip_shown_timeout_map_.end()) 535 if (it == tooltip_shown_timeout_map_.end())
532 return kDefaultTooltipShownTimeoutMs; 536 return kDefaultTooltipShownTimeoutMs;
533 return it->second; 537 return it->second;
534 } 538 }
535 539
536 } // namespace corewm 540 } // namespace corewm
537 } // namespace views 541 } // namespace views
OLDNEW
« no previous file with comments | « ui/aura/test/event_generator.cc ('k') | ui/views/corewm/tooltip_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698