Chromium Code Reviews| 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" |
| 11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 13 #include "ui/gfx/screen.h" | 13 #include "ui/gfx/screen.h" |
| 14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 15 #include "ui/wm/public/tooltip_client.h" | 15 #include "ui/wm/public/tooltip_client.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 int TooltipManager::GetTooltipHeight() { | 20 int TooltipManager::GetTooltipHeight() { |
| 21 // Not used for linux and chromeos. | 21 // Not used for linux and chromeos. |
| 22 NOTIMPLEMENTED(); | 22 NOTIMPLEMENTED(); |
| 23 return 0; | 23 return 0; |
| 24 } | 24 } |
| 25 | 25 |
| 26 //////////////////////////////////////////////////////////////////////////////// | 26 //////////////////////////////////////////////////////////////////////////////// |
| 27 // TooltipManagerAura public: | 27 // TooltipManagerAura public: |
| 28 | 28 |
| 29 TooltipManagerAura::TooltipManagerAura(Widget* widget) : widget_(widget) { | 29 TooltipManagerAura::TooltipManagerAura(Widget* widget) |
|
sky
2014/06/02 15:39:47
Style here is fine, leave it.
| |
| 30 : widget_(widget) { | |
| 30 aura::client::SetTooltipText(GetWindow(), &tooltip_text_); | 31 aura::client::SetTooltipText(GetWindow(), &tooltip_text_); |
| 31 } | 32 } |
| 32 | 33 |
| 33 TooltipManagerAura::~TooltipManagerAura() { | 34 TooltipManagerAura::~TooltipManagerAura() { |
| 34 aura::client::SetTooltipText(GetWindow(), NULL); | 35 aura::client::SetTooltipText(GetWindow(), NULL); |
| 35 } | 36 } |
| 36 | 37 |
| 37 // static | 38 // static |
| 38 const gfx::FontList& TooltipManagerAura::GetDefaultFontList() { | 39 const gfx::FontList& TooltipManagerAura::GetDefaultFontList() { |
| 39 return ui::ResourceBundle::GetSharedInstance().GetFontList( | 40 return ui::ResourceBundle::GetSharedInstance().GetFontList( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 gfx::Point view_point = point; | 127 gfx::Point view_point = point; |
| 127 View::ConvertPointFromWidget(target, &view_point); | 128 View::ConvertPointFromWidget(target, &view_point); |
| 128 base::string16 new_tooltip_text; | 129 base::string16 new_tooltip_text; |
| 129 if (!target->GetTooltipText(view_point, &new_tooltip_text)) | 130 if (!target->GetTooltipText(view_point, &new_tooltip_text)) |
| 130 tooltip_text_.clear(); | 131 tooltip_text_.clear(); |
| 131 else | 132 else |
| 132 tooltip_text_ = new_tooltip_text; | 133 tooltip_text_ = new_tooltip_text; |
| 133 } else { | 134 } else { |
| 134 tooltip_text_.clear(); | 135 tooltip_text_.clear(); |
| 135 } | 136 } |
| 137 | |
| 138 aura::client::UpdateTooltipId(GetWindow(), target); | |
| 139 | |
| 136 aura::client::GetTooltipClient(root_window)->UpdateTooltip(GetWindow()); | 140 aura::client::GetTooltipClient(root_window)->UpdateTooltip(GetWindow()); |
| 137 } | 141 } |
| 138 | 142 |
| 139 aura::Window* TooltipManagerAura::GetWindow() { | 143 aura::Window* TooltipManagerAura::GetWindow() { |
| 140 return widget_->GetNativeView(); | 144 return widget_->GetNativeView(); |
| 141 } | 145 } |
| 142 | 146 |
| 143 } // namespace views. | 147 } // namespace views. |
| OLD | NEW |