Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: ui/views/widget/tooltip_manager_aura.cc

Issue 10827145: Convert Aura to use ui::Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/logging.h" 5 #include "base/logging.h"
6 #include "ui/aura/client/tooltip_client.h" 6 #include "ui/aura/client/tooltip_client.h"
7 #include "ui/aura/root_window.h" 7 #include "ui/aura/root_window.h"
8 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/gfx/font.h" 9 #include "ui/gfx/font.h"
10 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 //////////////////////////////////////////////////////////////////////////////// 50 ////////////////////////////////////////////////////////////////////////////////
51 // TooltipManagerAura, TooltipManager implementation: 51 // TooltipManagerAura, TooltipManager implementation:
52 52
53 void TooltipManagerAura::UpdateTooltip() { 53 void TooltipManagerAura::UpdateTooltip() {
54 aura::Window* window = native_widget_aura_->GetNativeView(); 54 aura::Window* window = native_widget_aura_->GetNativeView();
55 aura::RootWindow* root_window = window->GetRootWindow(); 55 aura::RootWindow* root_window = window->GetRootWindow();
56 if (aura::client::GetTooltipClient(root_window)) { 56 if (aura::client::GetTooltipClient(root_window)) {
57 gfx::Point view_point = root_window->GetLastMouseLocationInRoot(); 57 gfx::Point view_point = root_window->GetLastMouseLocationInRoot();
58 aura::Window::ConvertPointToWindow(root_window, window, &view_point); 58 aura::Window::ConvertPointToTarget(root_window, window, &view_point);
59 View* view = GetViewUnderPoint(view_point); 59 View* view = GetViewUnderPoint(view_point);
60 if (view) { 60 if (view) {
61 View::ConvertPointFromWidget(view, &view_point); 61 View::ConvertPointFromWidget(view, &view_point);
62 if (!view->GetTooltipText(view_point, &tooltip_text_)) 62 if (!view->GetTooltipText(view_point, &tooltip_text_))
63 tooltip_text_.clear(); 63 tooltip_text_.clear();
64 } else { 64 } else {
65 tooltip_text_.clear(); 65 tooltip_text_.clear();
66 } 66 }
67 aura::client::GetTooltipClient(root_window)->UpdateTooltip(window); 67 aura::client::GetTooltipClient(root_window)->UpdateTooltip(window);
68 } 68 }
69 } 69 }
70 70
71 void TooltipManagerAura::TooltipTextChanged(View* view) { 71 void TooltipManagerAura::TooltipTextChanged(View* view) {
72 aura::Window* window = native_widget_aura_->GetNativeView(); 72 aura::Window* window = native_widget_aura_->GetNativeView();
73 aura::RootWindow* root_window = window->GetRootWindow(); 73 aura::RootWindow* root_window = window->GetRootWindow();
74 if (aura::client::GetTooltipClient(root_window)) { 74 if (aura::client::GetTooltipClient(root_window)) {
75 gfx::Point view_point = root_window->GetLastMouseLocationInRoot(); 75 gfx::Point view_point = root_window->GetLastMouseLocationInRoot();
76 aura::Window::ConvertPointToWindow(root_window, window, &view_point); 76 aura::Window::ConvertPointToTarget(root_window, window, &view_point);
77 View* target = GetViewUnderPoint(view_point); 77 View* target = GetViewUnderPoint(view_point);
78 if (target != view) 78 if (target != view)
79 return; 79 return;
80 if (target) { 80 if (target) {
81 View::ConvertPointFromWidget(view, &view_point); 81 View::ConvertPointFromWidget(view, &view_point);
82 if (!view->GetTooltipText(view_point, &tooltip_text_)) 82 if (!view->GetTooltipText(view_point, &tooltip_text_))
83 tooltip_text_.clear(); 83 tooltip_text_.clear();
84 } else { 84 } else {
85 tooltip_text_.clear(); 85 tooltip_text_.clear();
86 } 86 }
87 aura::client::GetTooltipClient(root_window)->UpdateTooltip(window); 87 aura::client::GetTooltipClient(root_window)->UpdateTooltip(window);
88 } 88 }
89 } 89 }
90 90
91 void TooltipManagerAura::ShowKeyboardTooltip(View* view) { 91 void TooltipManagerAura::ShowKeyboardTooltip(View* view) {
92 NOTREACHED(); 92 NOTREACHED();
93 } 93 }
94 94
95 void TooltipManagerAura::HideKeyboardTooltip() { 95 void TooltipManagerAura::HideKeyboardTooltip() {
96 NOTREACHED(); 96 NOTREACHED();
97 } 97 }
98 98
99 View* TooltipManagerAura::GetViewUnderPoint(const gfx::Point& point) { 99 View* TooltipManagerAura::GetViewUnderPoint(const gfx::Point& point) {
100 View* root_view = native_widget_aura_->GetWidget()->GetRootView(); 100 View* root_view = native_widget_aura_->GetWidget()->GetRootView();
101 return root_view->GetEventHandlerForPoint(point); 101 return root_view->GetEventHandlerForPoint(point);
102 } 102 }
103 103
104 } // namespace views. 104 } // namespace views.
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_aura_unittest.cc ('k') | ui/views/widget/widget_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698