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

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

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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
« no previous file with comments | « ui/views/widget/tooltip_manager_aura.h ('k') | ui/views/widget/widget_interactive_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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/tooltip_client.h" 8 #include "ui/aura/client/tooltip_client.h"
9 #include "ui/aura/root_window.h" 9 #include "ui/aura/root_window.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 //////////////////////////////////////////////////////////////////////////////// 43 ////////////////////////////////////////////////////////////////////////////////
44 // TooltipManagerAura, TooltipManager implementation: 44 // TooltipManagerAura, TooltipManager implementation:
45 45
46 const gfx::FontList& TooltipManagerAura::GetFontList() const { 46 const gfx::FontList& TooltipManagerAura::GetFontList() const {
47 return GetDefaultFontList(); 47 return GetDefaultFontList();
48 } 48 }
49 49
50 void TooltipManagerAura::UpdateTooltip() { 50 void TooltipManagerAura::UpdateTooltip() {
51 aura::RootWindow* root_window = window_->GetRootWindow(); 51 aura::Window* root_window = window_->GetRootWindow();
52 if (aura::client::GetTooltipClient(root_window)) { 52 if (aura::client::GetTooltipClient(root_window)) {
53 gfx::Point view_point = root_window->GetLastMouseLocationInRoot(); 53 gfx::Point view_point =
54 root_window->GetDispatcher()->GetLastMouseLocationInRoot();
54 aura::Window::ConvertPointToTarget(root_window, window_, &view_point); 55 aura::Window::ConvertPointToTarget(root_window, window_, &view_point);
55 View* view = GetViewUnderPoint(view_point); 56 View* view = GetViewUnderPoint(view_point);
56 UpdateTooltipForTarget(view, view_point, root_window); 57 UpdateTooltipForTarget(view, view_point, root_window);
57 } 58 }
58 } 59 }
59 60
60 void TooltipManagerAura::TooltipTextChanged(View* view) { 61 void TooltipManagerAura::TooltipTextChanged(View* view) {
61 aura::RootWindow* root_window = window_->GetRootWindow(); 62 aura::Window* root_window = window_->GetRootWindow();
62 if (aura::client::GetTooltipClient(root_window)) { 63 if (aura::client::GetTooltipClient(root_window)) {
63 gfx::Point view_point = root_window->GetLastMouseLocationInRoot(); 64 gfx::Point view_point =
65 root_window->GetDispatcher()->GetLastMouseLocationInRoot();
64 aura::Window::ConvertPointToTarget(root_window, window_, &view_point); 66 aura::Window::ConvertPointToTarget(root_window, window_, &view_point);
65 View* target = GetViewUnderPoint(view_point); 67 View* target = GetViewUnderPoint(view_point);
66 if (target != view) 68 if (target != view)
67 return; 69 return;
68 UpdateTooltipForTarget(view, view_point, root_window); 70 UpdateTooltipForTarget(view, view_point, root_window);
69 } 71 }
70 } 72 }
71 73
72 View* TooltipManagerAura::GetViewUnderPoint(const gfx::Point& point) { 74 View* TooltipManagerAura::GetViewUnderPoint(const gfx::Point& point) {
73 View* root_view = widget_->GetRootView(); 75 View* root_view = widget_->GetRootView();
74 if (root_view) 76 if (root_view)
75 return root_view->GetTooltipHandlerForPoint(point); 77 return root_view->GetTooltipHandlerForPoint(point);
76 return NULL; 78 return NULL;
77 } 79 }
78 80
79 void TooltipManagerAura::UpdateTooltipForTarget(View* target, 81 void TooltipManagerAura::UpdateTooltipForTarget(View* target,
80 const gfx::Point& point, 82 const gfx::Point& point,
81 aura::RootWindow* root_window) { 83 aura::Window* root_window) {
82 if (target) { 84 if (target) {
83 gfx::Point view_point = point; 85 gfx::Point view_point = point;
84 View::ConvertPointFromWidget(target, &view_point); 86 View::ConvertPointFromWidget(target, &view_point);
85 string16 new_tooltip_text; 87 string16 new_tooltip_text;
86 if (!target->GetTooltipText(view_point, &new_tooltip_text)) 88 if (!target->GetTooltipText(view_point, &new_tooltip_text))
87 tooltip_text_.clear(); 89 tooltip_text_.clear();
88 else 90 else
89 tooltip_text_ = new_tooltip_text; 91 tooltip_text_ = new_tooltip_text;
90 } else { 92 } else {
91 tooltip_text_.clear(); 93 tooltip_text_.clear();
92 } 94 }
93 aura::client::GetTooltipClient(root_window)->UpdateTooltip(window_); 95 aura::client::GetTooltipClient(root_window)->UpdateTooltip(window_);
94 } 96 }
95 97
96 } // namespace views. 98 } // namespace views.
OLDNEW
« no previous file with comments | « ui/views/widget/tooltip_manager_aura.h ('k') | ui/views/widget/widget_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698