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/root_window.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 |
19 int TooltipManager::GetTooltipHeight() { | 19 int TooltipManager::GetTooltipHeight() { |
20 // Not used for linux and chromeos. | 20 // Not used for linux and chromeos. |
21 NOTIMPLEMENTED(); | 21 NOTIMPLEMENTED(); |
22 return 0; | 22 return 0; |
23 } | 23 } |
24 | 24 |
25 // static | 25 // static |
26 gfx::Font TooltipManager::GetDefaultFont() { | 26 gfx::Font TooltipManager::GetDefaultFont() { |
27 return aura::TooltipClient::GetDefaultFont(); | 27 return ui::ResourceBundle::GetSharedInstance().GetFont( |
| 28 ui::ResourceBundle::BaseFont); |
28 } | 29 } |
29 | 30 |
30 // static | 31 // static |
31 int TooltipManager::GetMaxWidth(int x, int y) { | 32 int TooltipManager::GetMaxWidth(int x, int y) { |
32 return aura::TooltipClient::GetMaxWidth(x, y); | 33 gfx::Rect monitor_bounds = |
| 34 gfx::Screen::GetMonitorAreaNearestPoint(gfx::Point(x, y)); |
| 35 return (monitor_bounds.width() + 1) / 2; |
33 } | 36 } |
34 | 37 |
35 //////////////////////////////////////////////////////////////////////////////// | 38 //////////////////////////////////////////////////////////////////////////////// |
36 // TooltipManagerAura public: | 39 // TooltipManagerAura public: |
37 | 40 |
38 TooltipManagerAura::TooltipManagerAura(NativeWidgetAura* native_widget_aura) | 41 TooltipManagerAura::TooltipManagerAura(NativeWidgetAura* native_widget_aura) |
39 : native_widget_aura_(native_widget_aura) { | 42 : native_widget_aura_(native_widget_aura) { |
40 native_widget_aura_->GetNativeView()->SetProperty(aura::kTooltipTextKey, | 43 native_widget_aura_->GetNativeView()->SetProperty(aura::kTooltipTextKey, |
41 &tooltip_text_); | 44 &tooltip_text_); |
42 } | 45 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void TooltipManagerAura::HideKeyboardTooltip() { | 103 void TooltipManagerAura::HideKeyboardTooltip() { |
101 NOTREACHED(); | 104 NOTREACHED(); |
102 } | 105 } |
103 | 106 |
104 View* TooltipManagerAura::GetViewUnderPoint(const gfx::Point& point) { | 107 View* TooltipManagerAura::GetViewUnderPoint(const gfx::Point& point) { |
105 View* root_view = native_widget_aura_->GetWidget()->GetRootView(); | 108 View* root_view = native_widget_aura_->GetWidget()->GetRootView(); |
106 return root_view->GetEventHandlerForPoint(point); | 109 return root_view->GetEventHandlerForPoint(point); |
107 } | 110 } |
108 | 111 |
109 } // namespace views. | 112 } // namespace views. |
OLD | NEW |