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

Side by Side Diff: views/widget/native_widget_win.cc

Issue 7253016: Merge 88897 - Disables tooltips if we can't create the tooltip window. I still don't (Closed) Base URL: svn://svn.chromium.org/chrome/branches/782/src/
Patch Set: 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 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/system_monitor/system_monitor.h" 10 #include "base/system_monitor/system_monitor.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 662
663 // Windows special DWM window frame requires a special tooltip manager so 663 // Windows special DWM window frame requires a special tooltip manager so
664 // that window controls in Chrome windows don't flicker when you move your 664 // that window controls in Chrome windows don't flicker when you move your
665 // mouse over them. See comment in aero_tooltip_manager.h. 665 // mouse over them. See comment in aero_tooltip_manager.h.
666 Window* window = GetWidget()->GetContainingWindow(); 666 Window* window = GetWidget()->GetContainingWindow();
667 if (window && window->ShouldUseNativeFrame()) { 667 if (window && window->ShouldUseNativeFrame()) {
668 tooltip_manager_.reset(new AeroTooltipManager(GetWidget())); 668 tooltip_manager_.reset(new AeroTooltipManager(GetWidget()));
669 } else { 669 } else {
670 tooltip_manager_.reset(new TooltipManagerWin(GetWidget())); 670 tooltip_manager_.reset(new TooltipManagerWin(GetWidget()));
671 } 671 }
672 if (!tooltip_manager_->Init()) {
673 // There was a problem creating the TooltipManager. Common error is 127.
674 // See 82193 for details.
675 LOG_GETLASTERROR(WARNING) << "tooltip creation failed, disabling tooltips";
676 tooltip_manager_.reset();
677 }
672 678
673 // This message initializes the window so that focus border are shown for 679 // This message initializes the window so that focus border are shown for
674 // windows. 680 // windows.
675 SendMessage( 681 SendMessage(
676 hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0); 682 hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
677 683
678 // Bug 964884: detach the IME attached to this window. 684 // Bug 964884: detach the IME attached to this window.
679 // We should attach IMEs only when we need to input CJK strings. 685 // We should attach IMEs only when we need to input CJK strings.
680 ImmAssociateContextEx(hwnd(), NULL, 0); 686 ImmAssociateContextEx(hwnd(), NULL, 0);
681 687
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 } 872 }
867 873
868 LRESULT NativeWidgetWin::OnMouseRange(UINT message, 874 LRESULT NativeWidgetWin::OnMouseRange(UINT message,
869 WPARAM w_param, 875 WPARAM w_param,
870 LPARAM l_param) { 876 LPARAM l_param) {
871 MSG msg = { hwnd(), message, w_param, l_param, 0, 877 MSG msg = { hwnd(), message, w_param, l_param, 0,
872 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; 878 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } };
873 MouseEvent event(msg); 879 MouseEvent event(msg);
874 880
875 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) 881 if (!(event.flags() & ui::EF_IS_NON_CLIENT))
876 tooltip_manager_->OnMouse(message, w_param, l_param); 882 if (tooltip_manager_.get())
883 tooltip_manager_->OnMouse(message, w_param, l_param);
877 884
878 if (event.type() == ui::ET_MOUSE_MOVED && !HasMouseCapture()) { 885 if (event.type() == ui::ET_MOUSE_MOVED && !HasMouseCapture()) {
879 // Windows only fires WM_MOUSELEAVE events if the application begins 886 // Windows only fires WM_MOUSELEAVE events if the application begins
880 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events. 887 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events.
881 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. 888 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE.
882 TrackMouseEvents((message == WM_NCMOUSEMOVE) ? 889 TrackMouseEvents((message == WM_NCMOUSEMOVE) ?
883 TME_NONCLIENT | TME_LEAVE : TME_LEAVE); 890 TME_NONCLIENT | TME_LEAVE : TME_LEAVE);
884 } else if (event.type() == ui::ET_MOUSE_EXITED) { 891 } else if (event.type() == ui::ET_MOUSE_EXITED) {
885 // Reset our tracking flags so future mouse movement over this 892 // Reset our tracking flags so future mouse movement over this
886 // NativeWidgetWin results in a new tracking session. Fall through for 893 // NativeWidgetWin results in a new tracking session. Fall through for
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 1401
1395 // And now, notify them that they have a brand new parent. 1402 // And now, notify them that they have a brand new parent.
1396 for (NativeWidgets::iterator it = widgets.begin(); 1403 for (NativeWidgets::iterator it = widgets.begin();
1397 it != widgets.end(); ++it) { 1404 it != widgets.end(); ++it) {
1398 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, 1405 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true,
1399 new_parent); 1406 new_parent);
1400 } 1407 }
1401 } 1408 }
1402 1409
1403 } // namespace views 1410 } // 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