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( |
86 return aura::client::GetTooltipClient(context->GetRootWindow())-> | 86 widget_->GetNativeView()->GetRootWindow()) |
87 GetMaxWidth(point, context); | 87 ->GetMaxWidth(point); |
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()) { | 93 if (!widget_->IsVisible()) { |
94 UpdateTooltipForTarget(NULL, gfx::Point(), root_window); | 94 UpdateTooltipForTarget(NULL, gfx::Point(), root_window); |
95 return; | 95 return; |
96 } | 96 } |
97 gfx::Point view_point = | 97 gfx::Point view_point = |
(...skipping 42 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 |