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

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

Issue 7753025: Move the mouse wheel utils from views to ui\base\win, to get rid of some views dependencies in co... (Closed) Base URL: svn://chrome-svn/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 | « views/views.gyp ('k') | 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 "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"
11 #include "base/system_monitor/system_monitor.h" 11 #include "base/system_monitor/system_monitor.h"
12 #include "base/win/scoped_gdi_object.h" 12 #include "base/win/scoped_gdi_object.h"
13 #include "base/win/win_util.h" 13 #include "base/win/win_util.h"
14 #include "base/win/windows_version.h" 14 #include "base/win/windows_version.h"
15 #include "ui/base/dragdrop/drag_drop_types.h" 15 #include "ui/base/dragdrop/drag_drop_types.h"
16 #include "ui/base/dragdrop/drag_source.h" 16 #include "ui/base/dragdrop/drag_source.h"
17 #include "ui/base/dragdrop/os_exchange_data.h" 17 #include "ui/base/dragdrop/os_exchange_data.h"
18 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" 18 #include "ui/base/dragdrop/os_exchange_data_provider_win.h"
19 #include "ui/base/keycodes/keyboard_code_conversion_win.h" 19 #include "ui/base/keycodes/keyboard_code_conversion_win.h"
20 #include "ui/base/l10n/l10n_util_win.h" 20 #include "ui/base/l10n/l10n_util_win.h"
21 #include "ui/base/theme_provider.h" 21 #include "ui/base/theme_provider.h"
22 #include "ui/base/view_prop.h" 22 #include "ui/base/view_prop.h"
23 #include "ui/base/win/hwnd_util.h" 23 #include "ui/base/win/hwnd_util.h"
24 #include "ui/base/win/mouse_wheel_util.h"
24 #include "ui/gfx/canvas_skia.h" 25 #include "ui/gfx/canvas_skia.h"
25 #include "ui/gfx/canvas_skia_paint.h" 26 #include "ui/gfx/canvas_skia_paint.h"
26 #include "ui/gfx/compositor/compositor.h" 27 #include "ui/gfx/compositor/compositor.h"
27 #include "ui/gfx/icon_util.h" 28 #include "ui/gfx/icon_util.h"
28 #include "ui/gfx/native_theme_win.h" 29 #include "ui/gfx/native_theme_win.h"
29 #include "ui/gfx/path.h" 30 #include "ui/gfx/path.h"
30 #include "ui/gfx/screen.h" 31 #include "ui/gfx/screen.h"
31 #include "views/accessibility/native_view_accessibility_win.h" 32 #include "views/accessibility/native_view_accessibility_win.h"
32 #include "views/controls/native_control_win.h" 33 #include "views/controls/native_control_win.h"
33 #include "views/controls/textfield/native_textfield_views.h" 34 #include "views/controls/textfield/native_textfield_views.h"
34 #include "views/focus/accelerator_handler.h" 35 #include "views/focus/accelerator_handler.h"
35 #include "views/focus/focus_util_win.h"
36 #include "views/focus/view_storage.h" 36 #include "views/focus/view_storage.h"
37 #include "views/ime/input_method_win.h" 37 #include "views/ime/input_method_win.h"
38 #include "views/views_delegate.h" 38 #include "views/views_delegate.h"
39 #include "views/widget/aero_tooltip_manager.h" 39 #include "views/widget/aero_tooltip_manager.h"
40 #include "views/widget/child_window_message_processor.h" 40 #include "views/widget/child_window_message_processor.h"
41 #include "views/widget/drop_target_win.h" 41 #include "views/widget/drop_target_win.h"
42 #include "views/widget/native_widget_delegate.h" 42 #include "views/widget/native_widget_delegate.h"
43 #include "views/widget/native_widget_views.h" 43 #include "views/widget/native_widget_views.h"
44 #include "views/widget/root_view.h" 44 #include "views/widget/root_view.h"
45 #include "views/widget/widget_delegate.h" 45 #include "views/widget/widget_delegate.h"
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 LRESULT NativeWidgetWin::OnCreate(CREATESTRUCT* create_struct) { 1192 LRESULT NativeWidgetWin::OnCreate(CREATESTRUCT* create_struct) {
1193 SetNativeWindowProperty(kNativeWidgetKey, this); 1193 SetNativeWindowProperty(kNativeWidgetKey, this);
1194 CHECK_EQ(this, GetNativeWidgetForNativeView(hwnd())); 1194 CHECK_EQ(this, GetNativeWidgetForNativeView(hwnd()));
1195 1195
1196 use_layered_buffer_ = !!(window_ex_style() & WS_EX_LAYERED); 1196 use_layered_buffer_ = !!(window_ex_style() & WS_EX_LAYERED);
1197 1197
1198 // Attempt to detect screen readers by sending an event with our custom id. 1198 // Attempt to detect screen readers by sending an event with our custom id.
1199 if (!IsAccessibleWidget()) 1199 if (!IsAccessibleWidget())
1200 NotifyWinEvent(EVENT_SYSTEM_ALERT, hwnd(), kCustomObjectID, CHILDID_SELF); 1200 NotifyWinEvent(EVENT_SYSTEM_ALERT, hwnd(), kCustomObjectID, CHILDID_SELF);
1201 1201
1202 props_.push_back(SetWindowSupportsRerouteMouseWheel(hwnd())); 1202 props_.push_back(ui::SetWindowSupportsRerouteMouseWheel(hwnd()));
1203 1203
1204 drop_target_ = new DropTargetWin( 1204 drop_target_ = new DropTargetWin(
1205 static_cast<internal::RootView*>(GetWidget()->GetRootView())); 1205 static_cast<internal::RootView*>(GetWidget()->GetRootView()));
1206 1206
1207 // We need to add ourselves as a message loop observer so that we can repaint 1207 // We need to add ourselves as a message loop observer so that we can repaint
1208 // aggressively if the contents of our window become invalid. Unfortunately 1208 // aggressively if the contents of our window become invalid. Unfortunately
1209 // WM_PAINT messages are starved and we get flickery redrawing when resizing 1209 // WM_PAINT messages are starved and we get flickery redrawing when resizing
1210 // if we do not do this. 1210 // if we do not do this.
1211 MessageLoopForUI::current()->AddObserver(this); 1211 MessageLoopForUI::current()->AddObserver(this);
1212 1212
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE. 1535 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE.
1536 TrackMouseEvents((message == WM_NCMOUSEMOVE) ? 1536 TrackMouseEvents((message == WM_NCMOUSEMOVE) ?
1537 TME_NONCLIENT | TME_LEAVE : TME_LEAVE); 1537 TME_NONCLIENT | TME_LEAVE : TME_LEAVE);
1538 } else if (event.type() == ui::ET_MOUSE_EXITED) { 1538 } else if (event.type() == ui::ET_MOUSE_EXITED) {
1539 // Reset our tracking flags so future mouse movement over this 1539 // Reset our tracking flags so future mouse movement over this
1540 // NativeWidgetWin results in a new tracking session. Fall through for 1540 // NativeWidgetWin results in a new tracking session. Fall through for
1541 // OnMouseEvent. 1541 // OnMouseEvent.
1542 active_mouse_tracking_flags_ = 0; 1542 active_mouse_tracking_flags_ = 0;
1543 } else if (event.type() == ui::ET_MOUSEWHEEL) { 1543 } else if (event.type() == ui::ET_MOUSEWHEEL) {
1544 // Reroute the mouse wheel to the window under the pointer if applicable. 1544 // Reroute the mouse wheel to the window under the pointer if applicable.
1545 return (views::RerouteMouseWheel(hwnd(), w_param, l_param) || 1545 return (ui::RerouteMouseWheel(hwnd(), w_param, l_param) ||
1546 delegate_->OnMouseEvent(MouseWheelEvent(msg))) ? 0 : 1; 1546 delegate_->OnMouseEvent(MouseWheelEvent(msg))) ? 0 : 1;
1547 } 1547 }
1548 1548
1549 SetMsgHandled(delegate_->OnMouseEvent(event)); 1549 SetMsgHandled(delegate_->OnMouseEvent(event));
1550 return 0; 1550 return 0;
1551 } 1551 }
1552 1552
1553 void NativeWidgetWin::OnMove(const CPoint& point) { 1553 void NativeWidgetWin::OnMove(const CPoint& point) {
1554 // TODO(beng): move to Widget. 1554 // TODO(beng): move to Widget.
1555 GetWidget()->widget_delegate()->OnWidgetMove(); 1555 GetWidget()->widget_delegate()->OnWidgetMove();
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
2530 return (GetKeyState(VK_LBUTTON) & 0x80) || 2530 return (GetKeyState(VK_LBUTTON) & 0x80) ||
2531 (GetKeyState(VK_RBUTTON) & 0x80) || 2531 (GetKeyState(VK_RBUTTON) & 0x80) ||
2532 (GetKeyState(VK_MBUTTON) & 0x80) || 2532 (GetKeyState(VK_MBUTTON) & 0x80) ||
2533 (GetKeyState(VK_XBUTTON1) & 0x80) || 2533 (GetKeyState(VK_XBUTTON1) & 0x80) ||
2534 (GetKeyState(VK_XBUTTON2) & 0x80); 2534 (GetKeyState(VK_XBUTTON2) & 0x80);
2535 } 2535 }
2536 2536
2537 } // namespace internal 2537 } // namespace internal
2538 2538
2539 } // namespace views 2539 } // namespace views
OLDNEW
« no previous file with comments | « views/views.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698