| 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/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 gfx::Rect TooltipAura::GetBoundsForTooltip( | 164 gfx::Rect TooltipAura::GetBoundsForTooltip( |
| 165 const gfx::Point& origin) const { | 165 const gfx::Point& origin) const { |
| 166 DCHECK(tooltip_window_); | 166 DCHECK(tooltip_window_); |
| 167 gfx::Rect widget_bounds; | 167 gfx::Rect widget_bounds; |
| 168 // For Desktop aura we constrain the tooltip to the bounds of the Widget | 168 // For Desktop aura we constrain the tooltip to the bounds of the Widget |
| 169 // (which comes from the RootWindow). | 169 // (which comes from the RootWindow). |
| 170 if (screen_type_ == gfx::SCREEN_TYPE_NATIVE && | 170 if (screen_type_ == gfx::SCREEN_TYPE_NATIVE && |
| 171 gfx::SCREEN_TYPE_NATIVE != gfx::SCREEN_TYPE_ALTERNATE) { | 171 gfx::SCREEN_TYPE_NATIVE != gfx::SCREEN_TYPE_ALTERNATE) { |
| 172 widget_bounds = tooltip_window_->GetDispatcher()->host()->GetBounds(); | 172 widget_bounds = tooltip_window_->GetHost()->GetBounds(); |
| 173 } | 173 } |
| 174 gfx::Screen* screen = gfx::Screen::GetScreenByType(screen_type_); | 174 gfx::Screen* screen = gfx::Screen::GetScreenByType(screen_type_); |
| 175 gfx::Rect bounds(screen->GetDisplayNearestPoint(origin).bounds()); | 175 gfx::Rect bounds(screen->GetDisplayNearestPoint(origin).bounds()); |
| 176 if (!widget_bounds.IsEmpty()) | 176 if (!widget_bounds.IsEmpty()) |
| 177 bounds.Intersect(widget_bounds); | 177 bounds.Intersect(widget_bounds); |
| 178 return bounds; | 178 return bounds; |
| 179 } | 179 } |
| 180 | 180 |
| 181 void TooltipAura::SetTooltipBounds(const gfx::Point& mouse_pos, | 181 void TooltipAura::SetTooltipBounds(const gfx::Point& mouse_pos, |
| 182 int tooltip_width, | 182 int tooltip_width, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 264 } |
| 265 | 265 |
| 266 void TooltipAura::OnWidgetDestroying(views::Widget* widget) { | 266 void TooltipAura::OnWidgetDestroying(views::Widget* widget) { |
| 267 DCHECK_EQ(widget_, widget); | 267 DCHECK_EQ(widget_, widget); |
| 268 widget_ = NULL; | 268 widget_ = NULL; |
| 269 tooltip_window_ = NULL; | 269 tooltip_window_ = NULL; |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace corewm | 272 } // namespace corewm |
| 273 } // namespace views | 273 } // namespace views |
| OLD | NEW |