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

Side by Side Diff: views/widget/native_widget_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: Merge to trunk and update 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 unified diff | Download patch | Annotate | Revision Log
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 "views/widget/native_widget_win.h" 5 #include "views/widget/native_widget_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 1155
1156 // Windows special DWM window frame requires a special tooltip manager so 1156 // Windows special DWM window frame requires a special tooltip manager so
1157 // that window controls in Chrome windows don't flicker when you move your 1157 // that window controls in Chrome windows don't flicker when you move your
1158 // mouse over them. See comment in aero_tooltip_manager.h. 1158 // mouse over them. See comment in aero_tooltip_manager.h.
1159 Window* window = GetWidget()->GetContainingWindow(); 1159 Window* window = GetWidget()->GetContainingWindow();
1160 if (window && window->ShouldUseNativeFrame()) { 1160 if (window && window->ShouldUseNativeFrame()) {
1161 tooltip_manager_.reset(new AeroTooltipManager(GetWidget())); 1161 tooltip_manager_.reset(new AeroTooltipManager(GetWidget()));
1162 } else { 1162 } else {
1163 tooltip_manager_.reset(new TooltipManagerWin(GetWidget())); 1163 tooltip_manager_.reset(new TooltipManagerWin(GetWidget()));
1164 } 1164 }
1165 if (!tooltip_manager_->Init()) {
Ben Goodger (Google) 2011/06/13 17:26:17 You might note the mystery of why this check exist
1166 LOG_GETLASTERROR(WARNING) << "tooltip creation failed, disabling tooltips";
1167 tooltip_manager_.reset();
1168 }
1165 1169
1166 // This message initializes the window so that focus border are shown for 1170 // This message initializes the window so that focus border are shown for
1167 // windows. 1171 // windows.
1168 SendMessage( 1172 SendMessage(
1169 hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); 1173 hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
1170 1174
1171 // Bug 964884: detach the IME attached to this window. 1175 // Bug 964884: detach the IME attached to this window.
1172 // We should attach IMEs only when we need to input CJK strings. 1176 // We should attach IMEs only when we need to input CJK strings.
1173 ImmAssociateContextEx(hwnd(), NULL, 0); 1177 ImmAssociateContextEx(hwnd(), NULL, 0);
1174 1178
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 DefWindowProc(GetNativeView(), WM_NCLBUTTONDOWN, w_param, l_param); 1475 DefWindowProc(GetNativeView(), WM_NCLBUTTONDOWN, w_param, l_param);
1472 SetMsgHandled(TRUE); 1476 SetMsgHandled(TRUE);
1473 } 1477 }
1474 */ 1478 */
1475 1479
1476 MSG msg = { hwnd(), message, w_param, l_param, 0, 1480 MSG msg = { hwnd(), message, w_param, l_param, 0,
1477 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; 1481 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } };
1478 MouseEvent event(msg); 1482 MouseEvent event(msg);
1479 1483
1480 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) 1484 if (!(event.flags() & ui::EF_IS_NON_CLIENT))
1481 tooltip_manager_->OnMouse(message, w_param, l_param); 1485 if (tooltip_manager_.get())
1486 tooltip_manager_->OnMouse(message, w_param, l_param);
1482 1487
1483 if (event.type() == ui::ET_MOUSE_MOVED && !HasMouseCapture()) { 1488 if (event.type() == ui::ET_MOUSE_MOVED && !HasMouseCapture()) {
1484 // Windows only fires WM_MOUSELEAVE events if the application begins 1489 // Windows only fires WM_MOUSELEAVE events if the application begins
1485 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. 1490 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events.
1486 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. 1491 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE.
1487 TrackMouseEvents((message == WM_NCMOUSEMOVE) ? 1492 TrackMouseEvents((message == WM_NCMOUSEMOVE) ?
1488 TME_NONCLIENT | TME_LEAVE : TME_LEAVE); 1493 TME_NONCLIENT | TME_LEAVE : TME_LEAVE);
1489 } else if (event.type() == ui::ET_MOUSE_EXITED) { 1494 } else if (event.type() == ui::ET_MOUSE_EXITED) {
1490 // Reset our tracking flags so future mouse movement over this 1495 // Reset our tracking flags so future mouse movement over this
1491 // NativeWidgetWin results in a new tracking session. Fall through for 1496 // NativeWidgetWin results in a new tracking session. Fall through for
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 2485
2481 // And now, notify them that they have a brand new parent. 2486 // And now, notify them that they have a brand new parent.
2482 for (NativeWidgets::iterator it = widgets.begin(); 2487 for (NativeWidgets::iterator it = widgets.begin();
2483 it != widgets.end(); ++it) { 2488 it != widgets.end(); ++it) {
2484 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, 2489 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true,
2485 new_parent); 2490 new_parent);
2486 } 2491 }
2487 } 2492 }
2488 2493
2489 } // namespace views 2494 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698