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