| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 int TooltipManagerAura::GetMaxWidth(const gfx::Point& point, | 84 int TooltipManagerAura::GetMaxWidth(const gfx::Point& point, |
| 85 aura::Window* context) const { | 85 aura::Window* context) const { |
| 86 return aura::client::GetTooltipClient(context->GetRootWindow())-> | 86 return aura::client::GetTooltipClient(context->GetRootWindow())-> |
| 87 GetMaxWidth(point, context); | 87 GetMaxWidth(point, context); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void TooltipManagerAura::UpdateTooltip() { | 90 void TooltipManagerAura::UpdateTooltip() { |
| 91 aura::Window* root_window = GetWindow()->GetRootWindow(); | 91 aura::Window* root_window = GetWindow()->GetRootWindow(); |
| 92 if (aura::client::GetTooltipClient(root_window)) { | 92 if (aura::client::GetTooltipClient(root_window)) { |
| 93 if (!widget_->IsVisible()) { |
| 94 UpdateTooltipForTarget(NULL, gfx::Point(), root_window); |
| 95 return; |
| 96 } |
| 93 gfx::Point view_point = | 97 gfx::Point view_point = |
| 94 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 98 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
| 95 aura::Window::ConvertPointToTarget(root_window, GetWindow(), &view_point); | 99 aura::Window::ConvertPointToTarget(root_window, GetWindow(), &view_point); |
| 96 View* view = GetViewUnderPoint(view_point); | 100 View* view = GetViewUnderPoint(view_point); |
| 97 UpdateTooltipForTarget(view, view_point, root_window); | 101 UpdateTooltipForTarget(view, view_point, root_window); |
| 98 } | 102 } |
| 99 } | 103 } |
| 100 | 104 |
| 101 void TooltipManagerAura::TooltipTextChanged(View* view) { | 105 void TooltipManagerAura::TooltipTextChanged(View* view) { |
| 102 aura::Window* root_window = GetWindow()->GetRootWindow(); | 106 aura::Window* root_window = GetWindow()->GetRootWindow(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 aura::client::SetTooltipId(GetWindow(), target); | 140 aura::client::SetTooltipId(GetWindow(), target); |
| 137 | 141 |
| 138 aura::client::GetTooltipClient(root_window)->UpdateTooltip(GetWindow()); | 142 aura::client::GetTooltipClient(root_window)->UpdateTooltip(GetWindow()); |
| 139 } | 143 } |
| 140 | 144 |
| 141 aura::Window* TooltipManagerAura::GetWindow() { | 145 aura::Window* TooltipManagerAura::GetWindow() { |
| 142 return widget_->GetNativeView(); | 146 return widget_->GetNativeView(); |
| 143 } | 147 } |
| 144 | 148 |
| 145 } // namespace views. | 149 } // namespace views. |
| OLD | NEW |