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 "ui/views/corewm/tooltip_aura.h" | 5 #include "ui/views/corewm/tooltip_aura.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "ui/aura/root_window.h" | 9 #include "ui/aura/root_window.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 gfx::Rect TooltipAura::GetBoundsForTooltip( | 168 gfx::Rect TooltipAura::GetBoundsForTooltip( |
169 const gfx::Point& origin) const { | 169 const gfx::Point& origin) const { |
170 DCHECK(tooltip_window_); | 170 DCHECK(tooltip_window_); |
171 gfx::Rect widget_bounds; | 171 gfx::Rect widget_bounds; |
172 // For Desktop aura we constrain the tooltip to the bounds of the Widget | 172 // For Desktop aura we constrain the tooltip to the bounds of the Widget |
173 // (which comes from the RootWindow). | 173 // (which comes from the RootWindow). |
174 if (screen_type_ == gfx::SCREEN_TYPE_NATIVE && | 174 if (screen_type_ == gfx::SCREEN_TYPE_NATIVE && |
175 gfx::SCREEN_TYPE_NATIVE != gfx::SCREEN_TYPE_ALTERNATE) { | 175 gfx::SCREEN_TYPE_NATIVE != gfx::SCREEN_TYPE_ALTERNATE) { |
176 aura::WindowEventDispatcher* dispatcher = tooltip_window_->GetDispatcher(); | 176 widget_bounds = tooltip_window_->GetDispatcher()->host()->GetBounds(); |
177 widget_bounds = gfx::Rect(dispatcher->GetHostOrigin(), | |
178 dispatcher->GetHostSize()); | |
179 } | 177 } |
180 gfx::Screen* screen = gfx::Screen::GetScreenByType(screen_type_); | 178 gfx::Screen* screen = gfx::Screen::GetScreenByType(screen_type_); |
181 gfx::Rect bounds(screen->GetDisplayNearestPoint(origin).bounds()); | 179 gfx::Rect bounds(screen->GetDisplayNearestPoint(origin).bounds()); |
182 if (!widget_bounds.IsEmpty()) | 180 if (!widget_bounds.IsEmpty()) |
183 bounds.Intersect(widget_bounds); | 181 bounds.Intersect(widget_bounds); |
184 return bounds; | 182 return bounds; |
185 } | 183 } |
186 | 184 |
187 void TooltipAura::SetTooltipBounds(const gfx::Point& mouse_pos, | 185 void TooltipAura::SetTooltipBounds(const gfx::Point& mouse_pos, |
188 int tooltip_width, | 186 int tooltip_width, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 268 } |
271 | 269 |
272 void TooltipAura::OnWidgetDestroying(views::Widget* widget) { | 270 void TooltipAura::OnWidgetDestroying(views::Widget* widget) { |
273 DCHECK_EQ(widget_, widget); | 271 DCHECK_EQ(widget_, widget); |
274 widget_ = NULL; | 272 widget_ = NULL; |
275 tooltip_window_ = NULL; | 273 tooltip_window_ = NULL; |
276 } | 274 } |
277 | 275 |
278 } // namespace corewm | 276 } // namespace corewm |
279 } // namespace views | 277 } // namespace views |
OLD | NEW |