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

Unified Diff: views/widget/tooltip_manager_win.cc

Issue 6995157: Disables tooltips if we can't create the tooltip window. I still don't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved comments Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/widget/tooltip_manager_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/tooltip_manager_win.cc
diff --git a/views/widget/tooltip_manager_win.cc b/views/widget/tooltip_manager_win.cc
index 9158818072c6ca191e8ab3ec8397741818d6228a..68714b9d45c550baa72f43e1b6da352256bd099f 100644
--- a/views/widget/tooltip_manager_win.cc
+++ b/views/widget/tooltip_manager_win.cc
@@ -36,7 +36,8 @@ static gfx::Font DetermineDefaultFont() {
HWND window = CreateWindowEx(
WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(),
TOOLTIPS_CLASS, NULL, 0 , 0, 0, 0, 0, NULL, NULL, NULL, NULL);
- ui::CheckWindowCreated(window);
+ if (!window)
+ return gfx::Font();
HFONT hfont = reinterpret_cast<HFONT>(SendMessage(window, WM_GETFONT, 0, 0));
gfx::Font font = hfont ? gfx::Font(hfont) : gfx::Font();
DestroyWindow(window);
@@ -90,13 +91,14 @@ TooltipManagerWin::~TooltipManagerWin() {
DestroyWindow(keyboard_tooltip_hwnd_);
}
-void TooltipManagerWin::Init() {
+bool TooltipManagerWin::Init() {
// Create the tooltip control.
tooltip_hwnd_ = CreateWindowEx(
WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(),
TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0,
GetParent(), NULL, NULL, NULL);
- ui::CheckWindowCreated(tooltip_hwnd_);
+ if (!tooltip_hwnd_)
+ return false;
l10n_util::AdjustUIFontForWindow(tooltip_hwnd_);
@@ -117,6 +119,7 @@ void TooltipManagerWin::Init() {
toolinfo_.lpszText = LPSTR_TEXTCALLBACK;
SetRectEmpty(&toolinfo_.rect);
SendMessage(tooltip_hwnd_, TTM_ADDTOOL, 0, (LPARAM)&toolinfo_);
+ return true;
}
gfx::NativeView TooltipManagerWin::GetParent() {
@@ -335,7 +338,9 @@ void TooltipManagerWin::ShowKeyboardTooltip(View* focused_view) {
keyboard_tooltip_hwnd_ = CreateWindowEx(
WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(),
TOOLTIPS_CLASS, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
- ui::CheckWindowCreated(keyboard_tooltip_hwnd_);
+ if (!keyboard_tooltip_hwnd_)
+ return;
+
SendMessage(keyboard_tooltip_hwnd_, TTM_SETMAXTIPWIDTH, 0,
std::numeric_limits<short>::max());
int tooltip_width;
« no previous file with comments | « views/widget/tooltip_manager_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698