| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after 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::GetScreenFor(root_window); | 52 gfx::Screen* screen = gfx::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 11 matching lines...) Expand all Loading... |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 //////////////////////////////////////////////////////////////////////////////// | 77 //////////////////////////////////////////////////////////////////////////////// |
| 78 // TooltipManagerAura, TooltipManager implementation: | 78 // TooltipManagerAura, TooltipManager implementation: |
| 79 | 79 |
| 80 const gfx::FontList& TooltipManagerAura::GetFontList() const { | 80 const gfx::FontList& TooltipManagerAura::GetFontList() const { |
| 81 return GetDefaultFontList(); | 81 return GetDefaultFontList(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 int TooltipManagerAura::GetMaxWidth(const gfx::Point& point, | 84 int TooltipManagerAura::GetMaxWidth(const gfx::Point& point) const { |
| 85 aura::Window* context) const { | 85 return aura::client::GetTooltipClient(GetWindow()->GetRootWindow()) |
| 86 return aura::client::GetTooltipClient(context->GetRootWindow())-> | 86 ->GetMaxWidth(point); |
| 87 GetMaxWidth(point, context); | |
| 88 } | 87 } |
| 89 | 88 |
| 90 void TooltipManagerAura::UpdateTooltip() { | 89 void TooltipManagerAura::UpdateTooltip() { |
| 91 aura::Window* root_window = GetWindow()->GetRootWindow(); | 90 aura::Window* root_window = GetWindow()->GetRootWindow(); |
| 92 if (aura::client::GetTooltipClient(root_window)) { | 91 if (aura::client::GetTooltipClient(root_window)) { |
| 93 if (!widget_->IsVisible()) { | 92 if (!widget_->IsVisible()) { |
| 94 UpdateTooltipForTarget(NULL, gfx::Point(), root_window); | 93 UpdateTooltipForTarget(NULL, gfx::Point(), root_window); |
| 95 return; | 94 return; |
| 96 } | 95 } |
| 97 gfx::Point view_point = | 96 gfx::Point view_point = |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 tooltip_text_ = new_tooltip_text; | 134 tooltip_text_ = new_tooltip_text; |
| 136 } else { | 135 } else { |
| 137 tooltip_text_.clear(); | 136 tooltip_text_.clear(); |
| 138 } | 137 } |
| 139 | 138 |
| 140 aura::client::SetTooltipId(GetWindow(), target); | 139 aura::client::SetTooltipId(GetWindow(), target); |
| 141 | 140 |
| 142 aura::client::GetTooltipClient(root_window)->UpdateTooltip(GetWindow()); | 141 aura::client::GetTooltipClient(root_window)->UpdateTooltip(GetWindow()); |
| 143 } | 142 } |
| 144 | 143 |
| 145 aura::Window* TooltipManagerAura::GetWindow() { | 144 aura::Window* TooltipManagerAura::GetWindow() const { |
| 146 return widget_->GetNativeView(); | 145 return widget_->GetNativeView(); |
| 147 } | 146 } |
| 148 | 147 |
| 149 } // namespace views. | 148 } // namespace views. |
| OLD | NEW |