| OLD | NEW |
| 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/widget/tooltip_manager_aura.h" | 5 #include "ui/views/widget/tooltip_manager_aura.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/aura/client/screen_position_client.h" | 8 #include "ui/aura/client/screen_position_client.h" |
| 9 #include "ui/aura/window_event_dispatcher.h" | 9 #include "ui/aura/window_event_dispatcher.h" |
| 10 #include "ui/aura/window_tree_host.h" | 10 #include "ui/aura/window_tree_host.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/display/screen.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/gfx/screen.h" | |
| 14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 15 #include "ui/wm/public/tooltip_client.h" | 15 #include "ui/wm/public/tooltip_client.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
| 20 // TooltipManagerAura public: | 20 // TooltipManagerAura public: |
| 21 | 21 |
| 22 TooltipManagerAura::TooltipManagerAura(Widget* widget) : widget_(widget) { | 22 TooltipManagerAura::TooltipManagerAura(Widget* widget) : widget_(widget) { |
| 23 aura::client::SetTooltipText(GetWindow(), &tooltip_text_); | 23 aura::client::SetTooltipText(GetWindow(), &tooltip_text_); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 if (!root_window) | 42 if (!root_window) |
| 43 return; | 43 return; |
| 44 | 44 |
| 45 gfx::Point screen_loc( | 45 gfx::Point screen_loc( |
| 46 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot()); | 46 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot()); |
| 47 aura::client::ScreenPositionClient* screen_position_client = | 47 aura::client::ScreenPositionClient* screen_position_client = |
| 48 aura::client::GetScreenPositionClient(root_window); | 48 aura::client::GetScreenPositionClient(root_window); |
| 49 if (!screen_position_client) | 49 if (!screen_position_client) |
| 50 return; | 50 return; |
| 51 screen_position_client->ConvertPointToScreen(root_window, &screen_loc); | 51 screen_position_client->ConvertPointToScreen(root_window, &screen_loc); |
| 52 gfx::Screen* screen = gfx::Screen::GetScreen(); | 52 display::Screen* screen = display::Screen::GetScreen(); |
| 53 aura::Window* target = screen->GetWindowAtScreenPoint(screen_loc); | 53 aura::Window* target = screen->GetWindowAtScreenPoint(screen_loc); |
| 54 if (!target) | 54 if (!target) |
| 55 return; | 55 return; |
| 56 gfx::Point target_loc(screen_loc); | 56 gfx::Point target_loc(screen_loc); |
| 57 screen_position_client = | 57 screen_position_client = |
| 58 aura::client::GetScreenPositionClient(target->GetRootWindow()); | 58 aura::client::GetScreenPositionClient(target->GetRootWindow()); |
| 59 if (!screen_position_client) | 59 if (!screen_position_client) |
| 60 return; | 60 return; |
| 61 screen_position_client->ConvertPointFromScreen(target, &target_loc); | 61 screen_position_client->ConvertPointFromScreen(target, &target_loc); |
| 62 target = target->GetEventHandlerForPoint(target_loc); | 62 target = target->GetEventHandlerForPoint(target_loc); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 aura::client::SetTooltipId(GetWindow(), target); | 140 aura::client::SetTooltipId(GetWindow(), target); |
| 141 | 141 |
| 142 aura::client::GetTooltipClient(root_window)->UpdateTooltip(GetWindow()); | 142 aura::client::GetTooltipClient(root_window)->UpdateTooltip(GetWindow()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 aura::Window* TooltipManagerAura::GetWindow() { | 145 aura::Window* TooltipManagerAura::GetWindow() { |
| 146 return widget_->GetNativeView(); | 146 return widget_->GetNativeView(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace views. | 149 } // namespace views. |
| OLD | NEW |