| 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/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ui/views/corewm/tooltip.h" | 21 #include "ui/views/corewm/tooltip.h" |
| 22 #include "ui/views/widget/tooltip_manager.h" | 22 #include "ui/views/widget/tooltip_manager.h" |
| 23 #include "ui/wm/public/drag_drop_client.h" | 23 #include "ui/wm/public/drag_drop_client.h" |
| 24 | 24 |
| 25 namespace views { | 25 namespace views { |
| 26 namespace corewm { | 26 namespace corewm { |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 const int kTooltipTimeoutMs = 500; | 29 const int kTooltipTimeoutMs = 500; |
| 30 const int kDefaultTooltipShownTimeoutMs = 10000; | 30 const int kDefaultTooltipShownTimeoutMs = 10000; |
| 31 #if defined(OS_WIN) |
| 32 // Drawing a long word in tooltip is very slow on Windows. crbug.com/513693 |
| 33 const size_t kMaxTooltipLength = 1024; |
| 34 #else |
| 31 const size_t kMaxTooltipLength = 2048; | 35 const size_t kMaxTooltipLength = 2048; |
| 36 #endif |
| 32 | 37 |
| 33 // Returns true if |target| is a valid window to get the tooltip from. | 38 // Returns true if |target| is a valid window to get the tooltip from. |
| 34 // |event_target| is the original target from the event and |target| the window | 39 // |event_target| is the original target from the event and |target| the window |
| 35 // at the same location. | 40 // at the same location. |
| 36 bool IsValidTarget(aura::Window* event_target, aura::Window* target) { | 41 bool IsValidTarget(aura::Window* event_target, aura::Window* target) { |
| 37 if (!target || (event_target == target)) | 42 if (!target || (event_target == target)) |
| 38 return true; | 43 return true; |
| 39 | 44 |
| 40 void* event_target_grouping_id = event_target->GetNativeWindowProperty( | 45 void* event_target_grouping_id = event_target->GetNativeWindowProperty( |
| 41 TooltipManager::kGroupingPropertyKey); | 46 TooltipManager::kGroupingPropertyKey); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 return; | 371 return; |
| 367 if (tooltip_window_) | 372 if (tooltip_window_) |
| 368 tooltip_window_->RemoveObserver(this); | 373 tooltip_window_->RemoveObserver(this); |
| 369 tooltip_window_ = target; | 374 tooltip_window_ = target; |
| 370 if (tooltip_window_) | 375 if (tooltip_window_) |
| 371 tooltip_window_->AddObserver(this); | 376 tooltip_window_->AddObserver(this); |
| 372 } | 377 } |
| 373 | 378 |
| 374 } // namespace corewm | 379 } // namespace corewm |
| 375 } // namespace views | 380 } // namespace views |
| OLD | NEW |