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_win.h" | 5 #include "ui/views/widget/tooltip_manager_win.h" |
6 | 6 |
7 #include <windowsx.h> | 7 #include <windowsx.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 views::GetMonitorBoundsForRect(gfx::Rect(rect_bounds)); | 365 views::GetMonitorBoundsForRect(gfx::Rect(rect_bounds)); |
366 rect_bounds = gfx::Rect(rect_bounds).AdjustToFit(monitor_bounds).ToRECT(); | 366 rect_bounds = gfx::Rect(rect_bounds).AdjustToFit(monitor_bounds).ToRECT(); |
367 ::SetWindowPos(keyboard_tooltip_hwnd_, NULL, rect_bounds.left, | 367 ::SetWindowPos(keyboard_tooltip_hwnd_, NULL, rect_bounds.left, |
368 rect_bounds.top, 0, 0, | 368 rect_bounds.top, 0, 0, |
369 SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); | 369 SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); |
370 MessageLoop::current()->PostDelayedTask( | 370 MessageLoop::current()->PostDelayedTask( |
371 FROM_HERE, | 371 FROM_HERE, |
372 base::Bind(&TooltipManagerWin::DestroyKeyboardTooltipWindow, | 372 base::Bind(&TooltipManagerWin::DestroyKeyboardTooltipWindow, |
373 keyboard_tooltip_factory_.GetWeakPtr(), | 373 keyboard_tooltip_factory_.GetWeakPtr(), |
374 keyboard_tooltip_hwnd_), | 374 keyboard_tooltip_hwnd_), |
375 kDefaultTimeout); | 375 base::TimeDelta::FromMilliseconds(kDefaultTimeout)); |
376 } | 376 } |
377 | 377 |
378 void TooltipManagerWin::HideKeyboardTooltip() { | 378 void TooltipManagerWin::HideKeyboardTooltip() { |
379 if (keyboard_tooltip_hwnd_ != NULL) { | 379 if (keyboard_tooltip_hwnd_ != NULL) { |
380 SendMessage(keyboard_tooltip_hwnd_, WM_CLOSE, 0, 0); | 380 SendMessage(keyboard_tooltip_hwnd_, WM_CLOSE, 0, 0); |
381 keyboard_tooltip_hwnd_ = NULL; | 381 keyboard_tooltip_hwnd_ = NULL; |
382 } | 382 } |
383 } | 383 } |
384 | 384 |
385 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { | 385 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { |
386 if (keyboard_tooltip_hwnd_ == window_to_destroy) | 386 if (keyboard_tooltip_hwnd_ == window_to_destroy) |
387 HideKeyboardTooltip(); | 387 HideKeyboardTooltip(); |
388 } | 388 } |
389 | 389 |
390 } // namespace views | 390 } // namespace views |
OLD | NEW |