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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 265003: Fix long tooltips flashing like crazy under Windows. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 2 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 | « no previous file | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_widget_host_view_win.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "app/l10n_util_win.h" 9 #include "app/l10n_util_win.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 // We've been told to destroy. 619 // We've been told to destroy.
620 // By clearing close_on_deactivate_, we prevent further deactivations 620 // By clearing close_on_deactivate_, we prevent further deactivations
621 // (caused by windows messages resulting from the DestroyWindow) from 621 // (caused by windows messages resulting from the DestroyWindow) from
622 // triggering further destructions. The deletion of this is handled by 622 // triggering further destructions. The deletion of this is handled by
623 // OnFinalMessage(); 623 // OnFinalMessage();
624 close_on_deactivate_ = false; 624 close_on_deactivate_ = false;
625 DestroyWindow(); 625 DestroyWindow();
626 } 626 }
627 627
628 void RenderWidgetHostViewWin::SetTooltipText(const std::wstring& tooltip_text) { 628 void RenderWidgetHostViewWin::SetTooltipText(const std::wstring& tooltip_text) {
629 if (tooltip_text != tooltip_text_) { 629 // Clamp the tooltip length to kMaxTooltipLength so that we don't
630 tooltip_text_ = tooltip_text; 630 // accidentally DOS the user with a mega tooltip (since Windows doesn't seem
631 // to do this itself).
632 const std::wstring& new_tooltip_text =
633 l10n_util::TruncateString(tooltip_text, kMaxTooltipLength);
631 634
632 // Clamp the tooltip length to kMaxTooltipLength so that we don't 635 if (new_tooltip_text != tooltip_text_) {
633 // accidentally DOS the user with a mega tooltip (since Windows doesn't seem 636 tooltip_text_ = new_tooltip_text;
634 // to do this itself).
635 if (tooltip_text_.length() > kMaxTooltipLength)
636 tooltip_text_ = tooltip_text_.substr(0, kMaxTooltipLength);
637 637
638 // Need to check if the tooltip is already showing so that we don't 638 // Need to check if the tooltip is already showing so that we don't
639 // immediately show the tooltip with no delay when we move the mouse from 639 // immediately show the tooltip with no delay when we move the mouse from
640 // a region with no tooltip to a region with a tooltip. 640 // a region with no tooltip to a region with a tooltip.
641 if (::IsWindow(tooltip_hwnd_) && tooltip_showing_) { 641 if (::IsWindow(tooltip_hwnd_) && tooltip_showing_) {
642 ::SendMessage(tooltip_hwnd_, TTM_POP, 0, 0); 642 ::SendMessage(tooltip_hwnd_, TTM_POP, 0, 0);
643 ::SendMessage(tooltip_hwnd_, TTM_POPUP, 0, 0); 643 ::SendMessage(tooltip_hwnd_, TTM_POPUP, 0, 0);
644 } 644 }
645 } else { 645 } else {
646 // Make sure the tooltip gets closed after TTN_POP gets sent. For some 646 // Make sure the tooltip gets closed after TTN_POP gets sent. For some
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 // WM_LBUTTONDOWN. 1324 // WM_LBUTTONDOWN.
1325 SetFocus(); 1325 SetFocus();
1326 } 1326 }
1327 } 1327 }
1328 1328
1329 void RenderWidgetHostViewWin::ShutdownHost() { 1329 void RenderWidgetHostViewWin::ShutdownHost() {
1330 shutdown_factory_.RevokeAll(); 1330 shutdown_factory_.RevokeAll();
1331 render_widget_host_->Shutdown(); 1331 render_widget_host_->Shutdown();
1332 // Do not touch any members at this point, |this| has been deleted. 1332 // Do not touch any members at this point, |this| has been deleted.
1333 } 1333 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698