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

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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/widget/native_widget_win.h ('k') | views/widget/tooltip_manager_win.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) 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()) {
1166 // There was a problem creating the TooltipManager. Common error is 127.
1167 // See 82193 for details.
1168 LOG_GETLASTERROR(WARNING) << "tooltip creation failed, disabling tooltips";
1169 tooltip_manager_.reset();
1170 }
1165 1171
1166 // This message initializes the window so that focus border are shown for 1172 // This message initializes the window so that focus border are shown for
1167 // windows. 1173 // windows.
1168 SendMessage( 1174 SendMessage(
1169 hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); 1175 hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
1170 1176
1171 // Bug 964884: detach the IME attached to this window. 1177 // Bug 964884: detach the IME attached to this window.
1172 // We should attach IMEs only when we need to input CJK strings. 1178 // We should attach IMEs only when we need to input CJK strings.
1173 ImmAssociateContextEx(hwnd(), NULL, 0); 1179 ImmAssociateContextEx(hwnd(), NULL, 0);
1174 1180
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 DefWindowProc(GetNativeView(), WM_NCLBUTTONDOWN, w_param, l_param); 1477 DefWindowProc(GetNativeView(), WM_NCLBUTTONDOWN, w_param, l_param);
1472 SetMsgHandled(TRUE); 1478 SetMsgHandled(TRUE);
1473 } 1479 }
1474 */ 1480 */
1475 1481
1476 MSG msg = { hwnd(), message, w_param, l_param, 0, 1482 MSG msg = { hwnd(), message, w_param, l_param, 0,
1477 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; 1483 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } };
1478 MouseEvent event(msg); 1484 MouseEvent event(msg);
1479 1485
1480 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) 1486 if (!(event.flags() & ui::EF_IS_NON_CLIENT))
1481 tooltip_manager_->OnMouse(message, w_param, l_param); 1487 if (tooltip_manager_.get())
1488 tooltip_manager_->OnMouse(message, w_param, l_param);
1482 1489
1483 if (event.type() == ui::ET_MOUSE_MOVED && !HasMouseCapture()) { 1490 if (event.type() == ui::ET_MOUSE_MOVED && !HasMouseCapture()) {
1484 // Windows only fires WM_MOUSELEAVE events if the application begins 1491 // Windows only fires WM_MOUSELEAVE events if the application begins
1485 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. 1492 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events.
1486 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. 1493 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE.
1487 TrackMouseEvents((message == WM_NCMOUSEMOVE) ? 1494 TrackMouseEvents((message == WM_NCMOUSEMOVE) ?
1488 TME_NONCLIENT | TME_LEAVE : TME_LEAVE); 1495 TME_NONCLIENT | TME_LEAVE : TME_LEAVE);
1489 } else if (event.type() == ui::ET_MOUSE_EXITED) { 1496 } else if (event.type() == ui::ET_MOUSE_EXITED) {
1490 // Reset our tracking flags so future mouse movement over this 1497 // Reset our tracking flags so future mouse movement over this
1491 // NativeWidgetWin results in a new tracking session. Fall through for 1498 // NativeWidgetWin results in a new tracking session. Fall through for
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 2487
2481 // And now, notify them that they have a brand new parent. 2488 // And now, notify them that they have a brand new parent.
2482 for (NativeWidgets::iterator it = widgets.begin(); 2489 for (NativeWidgets::iterator it = widgets.begin();
2483 it != widgets.end(); ++it) { 2490 it != widgets.end(); ++it) {
2484 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, 2491 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true,
2485 new_parent); 2492 new_parent);
2486 } 2493 }
2487 } 2494 }
2488 2495
2489 } // namespace views 2496 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/native_widget_win.h ('k') | views/widget/tooltip_manager_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698