OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "ui/aura/client/aura_constants.h" | 6 #include "ui/aura/client/aura_constants.h" |
7 #include "ui/aura/client/tooltip_client.h" | 7 #include "ui/aura/client/tooltip_client.h" |
8 #include "ui/aura/desktop.h" | 8 #include "ui/aura/root_window.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/gfx/font.h" | 10 #include "ui/gfx/font.h" |
11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
12 #include "ui/gfx/screen.h" | 12 #include "ui/gfx/screen.h" |
13 #include "ui/views/widget/native_widget_aura.h" | 13 #include "ui/views/widget/native_widget_aura.h" |
14 #include "ui/views/widget/tooltip_manager_aura.h" | 14 #include "ui/views/widget/tooltip_manager_aura.h" |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 | 17 |
18 // static | 18 // static |
(...skipping 24 matching lines...) Expand all Loading... |
43 | 43 |
44 TooltipManagerAura::~TooltipManagerAura() { | 44 TooltipManagerAura::~TooltipManagerAura() { |
45 native_widget_aura_->GetNativeView()->SetProperty(aura::kTooltipTextKey, | 45 native_widget_aura_->GetNativeView()->SetProperty(aura::kTooltipTextKey, |
46 NULL); | 46 NULL); |
47 } | 47 } |
48 | 48 |
49 //////////////////////////////////////////////////////////////////////////////// | 49 //////////////////////////////////////////////////////////////////////////////// |
50 // TooltipManagerAura, TooltipManager implementation: | 50 // TooltipManagerAura, TooltipManager implementation: |
51 | 51 |
52 void TooltipManagerAura::UpdateTooltip() { | 52 void TooltipManagerAura::UpdateTooltip() { |
53 void* property = aura::Desktop::GetInstance()->GetProperty( | 53 void* property = aura::RootWindow::GetInstance()->GetProperty( |
54 aura::kDesktopTooltipClientKey); | 54 aura::kRootWindowTooltipClientKey); |
55 if (property) { | 55 if (property) { |
56 gfx::Point view_point = aura::Desktop::GetInstance()->last_mouse_location(); | 56 gfx::Point view_point = |
57 aura::Window::ConvertPointToWindow(aura::Desktop::GetInstance(), | 57 aura::RootWindow::GetInstance()->last_mouse_location(); |
| 58 aura::Window::ConvertPointToWindow(aura::RootWindow::GetInstance(), |
58 native_widget_aura_->GetNativeView(), &view_point); | 59 native_widget_aura_->GetNativeView(), &view_point); |
59 View* view = GetViewUnderPoint(view_point); | 60 View* view = GetViewUnderPoint(view_point); |
60 if (view) { | 61 if (view) { |
61 View::ConvertPointFromWidget(view, &view_point); | 62 View::ConvertPointFromWidget(view, &view_point); |
62 if (!view->GetTooltipText(view_point, &tooltip_text_)) | 63 if (!view->GetTooltipText(view_point, &tooltip_text_)) |
63 tooltip_text_.clear(); | 64 tooltip_text_.clear(); |
64 } else { | 65 } else { |
65 tooltip_text_.clear(); | 66 tooltip_text_.clear(); |
66 } | 67 } |
67 aura::TooltipClient* tc = static_cast<aura::TooltipClient*>(property); | 68 aura::TooltipClient* tc = static_cast<aura::TooltipClient*>(property); |
68 tc->UpdateTooltip(native_widget_aura_->GetNativeView()); | 69 tc->UpdateTooltip(native_widget_aura_->GetNativeView()); |
69 } | 70 } |
70 } | 71 } |
71 | 72 |
72 void TooltipManagerAura::TooltipTextChanged(View* view) { | 73 void TooltipManagerAura::TooltipTextChanged(View* view) { |
73 void* property = aura::Desktop::GetInstance()->GetProperty( | 74 void* property = aura::RootWindow::GetInstance()->GetProperty( |
74 aura::kDesktopTooltipClientKey); | 75 aura::kRootWindowTooltipClientKey); |
75 if (property) { | 76 if (property) { |
76 gfx::Point view_point = aura::Desktop::GetInstance()->last_mouse_location(); | 77 gfx::Point view_point = |
77 aura::Window::ConvertPointToWindow(aura::Desktop::GetInstance(), | 78 aura::RootWindow::GetInstance()->last_mouse_location(); |
| 79 aura::Window::ConvertPointToWindow(aura::RootWindow::GetInstance(), |
78 native_widget_aura_->GetNativeView(), &view_point); | 80 native_widget_aura_->GetNativeView(), &view_point); |
79 View* target = GetViewUnderPoint(view_point); | 81 View* target = GetViewUnderPoint(view_point); |
80 if (target != view) | 82 if (target != view) |
81 return; | 83 return; |
82 if (target) { | 84 if (target) { |
83 View::ConvertPointFromWidget(view, &view_point); | 85 View::ConvertPointFromWidget(view, &view_point); |
84 if (!view->GetTooltipText(view_point, &tooltip_text_)) | 86 if (!view->GetTooltipText(view_point, &tooltip_text_)) |
85 tooltip_text_.clear(); | 87 tooltip_text_.clear(); |
86 } else { | 88 } else { |
87 tooltip_text_.clear(); | 89 tooltip_text_.clear(); |
(...skipping 10 matching lines...) Expand all Loading... |
98 void TooltipManagerAura::HideKeyboardTooltip() { | 100 void TooltipManagerAura::HideKeyboardTooltip() { |
99 NOTREACHED(); | 101 NOTREACHED(); |
100 } | 102 } |
101 | 103 |
102 View* TooltipManagerAura::GetViewUnderPoint(const gfx::Point& point) { | 104 View* TooltipManagerAura::GetViewUnderPoint(const gfx::Point& point) { |
103 View* root_view = native_widget_aura_->GetWidget()->GetRootView(); | 105 View* root_view = native_widget_aura_->GetWidget()->GetRootView(); |
104 return root_view->GetEventHandlerForPoint(point); | 106 return root_view->GetEventHandlerForPoint(point); |
105 } | 107 } |
106 | 108 |
107 } // namespace views. | 109 } // namespace views. |
OLD | NEW |