| 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/corewm/tooltip_controller.h" | 5 #include "ui/views/corewm/tooltip_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
| 11 #include "ui/aura/client/drag_drop_client.h" | 11 #include "ui/aura/client/drag_drop_client.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/root_window.h" | |
| 14 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 15 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
| 16 #include "ui/gfx/font.h" | 15 #include "ui/gfx/font.h" |
| 17 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 18 #include "ui/views/corewm/tooltip.h" | 17 #include "ui/views/corewm/tooltip.h" |
| 19 #include "ui/views/widget/tooltip_manager.h" | 18 #include "ui/views/widget/tooltip_manager.h" |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 const int kTooltipTimeoutMs = 500; | 22 const int kTooltipTimeoutMs = 500; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 if (!tooltip_window_) | 226 if (!tooltip_window_) |
| 228 return false; | 227 return false; |
| 229 aura::client::DragDropClient* client = | 228 aura::client::DragDropClient* client = |
| 230 aura::client::GetDragDropClient(tooltip_window_->GetRootWindow()); | 229 aura::client::GetDragDropClient(tooltip_window_->GetRootWindow()); |
| 231 return client && client->IsDragDropInProgress(); | 230 return client && client->IsDragDropInProgress(); |
| 232 } | 231 } |
| 233 | 232 |
| 234 bool TooltipController::IsCursorVisible() { | 233 bool TooltipController::IsCursorVisible() { |
| 235 if (!tooltip_window_) | 234 if (!tooltip_window_) |
| 236 return false; | 235 return false; |
| 237 aura::RootWindow* root = tooltip_window_->GetRootWindow(); | 236 aura::Window* root = tooltip_window_->GetRootWindow(); |
| 238 if (!root) | 237 if (!root) |
| 239 return false; | 238 return false; |
| 240 aura::client::CursorClient* cursor_client = | 239 aura::client::CursorClient* cursor_client = |
| 241 aura::client::GetCursorClient(root); | 240 aura::client::GetCursorClient(root); |
| 242 // |cursor_client| may be NULL in tests, treat NULL as always visible. | 241 // |cursor_client| may be NULL in tests, treat NULL as always visible. |
| 243 return !cursor_client || cursor_client->IsCursorVisible(); | 242 return !cursor_client || cursor_client->IsCursorVisible(); |
| 244 } | 243 } |
| 245 | 244 |
| 246 int TooltipController::GetTooltipShownTimeout() { | 245 int TooltipController::GetTooltipShownTimeout() { |
| 247 std::map<aura::Window*, int>::const_iterator it = | 246 std::map<aura::Window*, int>::const_iterator it = |
| 248 tooltip_shown_timeout_map_.find(tooltip_window_); | 247 tooltip_shown_timeout_map_.find(tooltip_window_); |
| 249 if (it == tooltip_shown_timeout_map_.end()) | 248 if (it == tooltip_shown_timeout_map_.end()) |
| 250 return kDefaultTooltipShownTimeoutMs; | 249 return kDefaultTooltipShownTimeoutMs; |
| 251 return it->second; | 250 return it->second; |
| 252 } | 251 } |
| 253 | 252 |
| 254 } // namespace corewm | 253 } // namespace corewm |
| 255 } // namespace views | 254 } // namespace views |
| OLD | NEW |