Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: ui/views/widget/tooltip_manager_win.cc

Issue 14061025: ui: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/native_widget_win_unittest.cc ('k') | ui/views/win/hwnd_message_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
365 screen_point.y() + focused_bounds.height() + 365 screen_point.y() + focused_bounds.height() +
366 line_count * tooltip_height_ }; 366 line_count * tooltip_height_ };
367 gfx::Rect monitor_bounds = 367 gfx::Rect monitor_bounds =
368 views::GetMonitorBoundsForRect(gfx::Rect(rect_bounds)); 368 views::GetMonitorBoundsForRect(gfx::Rect(rect_bounds));
369 gfx::Rect fitted_bounds = gfx::Rect(rect_bounds); 369 gfx::Rect fitted_bounds = gfx::Rect(rect_bounds);
370 fitted_bounds.AdjustToFit(monitor_bounds); 370 fitted_bounds.AdjustToFit(monitor_bounds);
371 rect_bounds = fitted_bounds.ToRECT(); 371 rect_bounds = fitted_bounds.ToRECT();
372 ::SetWindowPos(keyboard_tooltip_hwnd_, NULL, rect_bounds.left, 372 ::SetWindowPos(keyboard_tooltip_hwnd_, NULL, rect_bounds.left,
373 rect_bounds.top, 0, 0, 373 rect_bounds.top, 0, 0,
374 SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); 374 SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
375 MessageLoop::current()->PostDelayedTask( 375 base::MessageLoop::current()->PostDelayedTask(
376 FROM_HERE, 376 FROM_HERE,
377 base::Bind(&TooltipManagerWin::DestroyKeyboardTooltipWindow, 377 base::Bind(&TooltipManagerWin::DestroyKeyboardTooltipWindow,
378 keyboard_tooltip_factory_.GetWeakPtr(), 378 keyboard_tooltip_factory_.GetWeakPtr(),
379 keyboard_tooltip_hwnd_), 379 keyboard_tooltip_hwnd_),
380 base::TimeDelta::FromMilliseconds(kDefaultTimeout)); 380 base::TimeDelta::FromMilliseconds(kDefaultTimeout));
381 } 381 }
382 382
383 void TooltipManagerWin::HideKeyboardTooltip() { 383 void TooltipManagerWin::HideKeyboardTooltip() {
384 if (keyboard_tooltip_hwnd_ != NULL) { 384 if (keyboard_tooltip_hwnd_ != NULL) {
385 SendMessage(keyboard_tooltip_hwnd_, WM_CLOSE, 0, 0); 385 SendMessage(keyboard_tooltip_hwnd_, WM_CLOSE, 0, 0);
386 keyboard_tooltip_hwnd_ = NULL; 386 keyboard_tooltip_hwnd_ = NULL;
387 } 387 }
388 } 388 }
389 389
390 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { 390 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) {
391 if (keyboard_tooltip_hwnd_ == window_to_destroy) 391 if (keyboard_tooltip_hwnd_ == window_to_destroy)
392 HideKeyboardTooltip(); 392 HideKeyboardTooltip();
393 } 393 }
394 394
395 } // namespace views 395 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_win_unittest.cc ('k') | ui/views/win/hwnd_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698