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

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

Issue 7474021: Set a minimum tooltip auto-pop timeout of 10 seconds on web content tooltips (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0, m_hWnd, NULL, 1736 TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0, m_hWnd, NULL,
1737 NULL, NULL); 1737 NULL, NULL);
1738 if (!tooltip_hwnd_) { 1738 if (!tooltip_hwnd_) {
1739 // Tooltip creation can inexplicably fail. See bug 82913 for details. 1739 // Tooltip creation can inexplicably fail. See bug 82913 for details.
1740 LOG_GETLASTERROR(WARNING) << 1740 LOG_GETLASTERROR(WARNING) <<
1741 "Tooltip creation failed, tooltips won't work"; 1741 "Tooltip creation failed, tooltips won't work";
1742 return; 1742 return;
1743 } 1743 }
1744 ti.uFlags = TTF_TRANSPARENT; 1744 ti.uFlags = TTF_TRANSPARENT;
1745 ti.lpszText = LPSTR_TEXTCALLBACK; 1745 ti.lpszText = LPSTR_TEXTCALLBACK;
1746
1747 // Ensure web content tooltips are displayed for at least this amount of
1748 // time, to give users a chance to read longer messages.
1749 const int kMinimumAutopopDurationMs = 10 * 1000;
1750 int autopop_duration_ms =
1751 SendMessage(tooltip_hwnd_, TTM_GETDELAYTIME, TTDT_AUTOPOP, NULL);
1752 if (autopop_duration_ms < kMinimumAutopopDurationMs) {
1753 SendMessage(tooltip_hwnd_, TTM_SETDELAYTIME, TTDT_AUTOPOP,
1754 kMinimumAutopopDurationMs);
1755 }
1746 } 1756 }
1747 1757
1748 CRect cr; 1758 CRect cr;
1749 GetClientRect(&ti.rect); 1759 GetClientRect(&ti.rect);
1750 SendMessage(tooltip_hwnd_, message, NULL, reinterpret_cast<LPARAM>(&ti)); 1760 SendMessage(tooltip_hwnd_, message, NULL, reinterpret_cast<LPARAM>(&ti));
1751 } 1761 }
1752 1762
1753 void RenderWidgetHostViewWin::ResetTooltip() { 1763 void RenderWidgetHostViewWin::ResetTooltip() {
1754 if (::IsWindow(tooltip_hwnd_)) 1764 if (::IsWindow(tooltip_hwnd_))
1755 ::DestroyWindow(tooltip_hwnd_); 1765 ::DestroyWindow(tooltip_hwnd_);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 DWORD ex_style) { 1829 DWORD ex_style) {
1820 parent_hwnd_ = parent_hwnd; 1830 parent_hwnd_ = parent_hwnd;
1821 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); 1831 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style);
1822 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); 1832 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE);
1823 // To show tooltip on popup window.(e.g. title in <select>) 1833 // To show tooltip on popup window.(e.g. title in <select>)
1824 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. 1834 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked.
1825 // Ensure the tooltip is created otherwise tooltips are never shown. 1835 // Ensure the tooltip is created otherwise tooltips are never shown.
1826 EnsureTooltip(); 1836 EnsureTooltip();
1827 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); 1837 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA);
1828 } 1838 }
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