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

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

Issue 1915363002: Rename gfx::Display/Screen to display::Display/Screen in views/wm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanups Created 4 years, 8 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 | « ui/views/corewm/tooltip_aura.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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "ui/aura/client/capture_client.h" 15 #include "ui/aura/client/capture_client.h"
16 #include "ui/aura/client/cursor_client.h" 16 #include "ui/aura/client/cursor_client.h"
17 #include "ui/aura/client/screen_position_client.h" 17 #include "ui/aura/client/screen_position_client.h"
18 #include "ui/aura/env.h" 18 #include "ui/aura/env.h"
19 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
20 #include "ui/display/screen.h"
20 #include "ui/events/event.h" 21 #include "ui/events/event.h"
21 #include "ui/gfx/font.h" 22 #include "ui/gfx/font.h"
22 #include "ui/gfx/geometry/rect.h" 23 #include "ui/gfx/geometry/rect.h"
23 #include "ui/gfx/screen.h"
24 #include "ui/gfx/text_elider.h" 24 #include "ui/gfx/text_elider.h"
25 #include "ui/views/corewm/tooltip.h" 25 #include "ui/views/corewm/tooltip.h"
26 #include "ui/views/widget/tooltip_manager.h" 26 #include "ui/views/widget/tooltip_manager.h"
27 #include "ui/wm/public/drag_drop_client.h" 27 #include "ui/wm/public/drag_drop_client.h"
28 28
29 namespace views { 29 namespace views {
30 namespace corewm { 30 namespace corewm {
31 namespace { 31 namespace {
32 32
33 const int kTooltipTimeoutMs = 500; 33 const int kTooltipTimeoutMs = 500;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 } 91 }
92 return event_target; 92 return event_target;
93 } 93 }
94 94
95 // If |target| has capture all events go to it, even if the mouse is 95 // If |target| has capture all events go to it, even if the mouse is
96 // really over another window. Find the real window the mouse is over. 96 // really over another window. Find the real window the mouse is over.
97 gfx::Point screen_loc(event.location()); 97 gfx::Point screen_loc(event.location());
98 aura::client::GetScreenPositionClient(event_target->GetRootWindow())-> 98 aura::client::GetScreenPositionClient(event_target->GetRootWindow())->
99 ConvertPointToScreen(event_target, &screen_loc); 99 ConvertPointToScreen(event_target, &screen_loc);
100 gfx::Screen* screen = gfx::Screen::GetScreen(); 100 display::Screen* screen = display::Screen::GetScreen();
101 aura::Window* target = screen->GetWindowAtScreenPoint(screen_loc); 101 aura::Window* target = screen->GetWindowAtScreenPoint(screen_loc);
102 if (!target) 102 if (!target)
103 return NULL; 103 return NULL;
104 gfx::Point target_loc(screen_loc); 104 gfx::Point target_loc(screen_loc);
105 aura::client::GetScreenPositionClient(target->GetRootWindow())-> 105 aura::client::GetScreenPositionClient(target->GetRootWindow())->
106 ConvertPointFromScreen(target, &target_loc); 106 ConvertPointFromScreen(target, &target_loc);
107 aura::Window* screen_target = target->GetEventHandlerForPoint(target_loc); 107 aura::Window* screen_target = target->GetEventHandlerForPoint(target_loc);
108 if (!IsValidTarget(event_target, screen_target)) 108 if (!IsValidTarget(event_target, screen_target))
109 return NULL; 109 return NULL;
110 110
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 void TooltipController::OnMouseEvent(ui::MouseEvent* event) { 198 void TooltipController::OnMouseEvent(ui::MouseEvent* event) {
199 switch (event->type()) { 199 switch (event->type()) {
200 case ui::ET_MOUSE_CAPTURE_CHANGED: 200 case ui::ET_MOUSE_CAPTURE_CHANGED:
201 case ui::ET_MOUSE_EXITED: 201 case ui::ET_MOUSE_EXITED:
202 case ui::ET_MOUSE_MOVED: 202 case ui::ET_MOUSE_MOVED:
203 case ui::ET_MOUSE_DRAGGED: { 203 case ui::ET_MOUSE_DRAGGED: {
204 curr_mouse_loc_ = event->location(); 204 curr_mouse_loc_ = event->location();
205 aura::Window* target = NULL; 205 aura::Window* target = NULL;
206 // Avoid a call to gfx::Screen::GetWindowAtScreenPoint() since it can be 206 // Avoid a call to display::Screen::GetWindowAtScreenPoint() since it can
207 // very expensive on X11 in cases when the tooltip is hidden anyway. 207 // be very expensive on X11 in cases when the tooltip is hidden anyway.
208 if (tooltips_enabled_ && 208 if (tooltips_enabled_ &&
209 !aura::Env::GetInstance()->IsMouseButtonDown() && 209 !aura::Env::GetInstance()->IsMouseButtonDown() &&
210 !IsDragDropInProgress()) { 210 !IsDragDropInProgress()) {
211 target = GetTooltipTarget(*event, &curr_mouse_loc_); 211 target = GetTooltipTarget(*event, &curr_mouse_loc_);
212 } 212 }
213 SetTooltipWindow(target); 213 SetTooltipWindow(target);
214 if (tooltip_timer_.IsRunning()) 214 if (tooltip_timer_.IsRunning())
215 tooltip_timer_.Reset(); 215 tooltip_timer_.Reset();
216 216
217 if (tooltip_->IsVisible()) 217 if (tooltip_->IsVisible())
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 return; 378 return;
379 if (tooltip_window_) 379 if (tooltip_window_)
380 tooltip_window_->RemoveObserver(this); 380 tooltip_window_->RemoveObserver(this);
381 tooltip_window_ = target; 381 tooltip_window_ = target;
382 if (tooltip_window_) 382 if (tooltip_window_)
383 tooltip_window_->AddObserver(this); 383 tooltip_window_->AddObserver(this);
384 } 384 }
385 385
386 } // namespace corewm 386 } // namespace corewm
387 } // namespace views 387 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/tooltip_aura.cc ('k') | ui/views/corewm/tooltip_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698