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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_win.cc

Issue 42624: Moving the mouse-wheel processing code out of the FocusManager (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « no previous file | chrome/views/focus/focus_manager.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_widget_host_view_win.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/gfx/gdi_util.h" 8 #include "base/gfx/gdi_util.h"
9 #include "base/gfx/rect.h" 9 #include "base/gfx/rect.h"
10 #include "base/histogram.h" 10 #include "base/histogram.h"
11 #include "base/win_util.h" 11 #include "base/win_util.h"
12 #include "chrome/browser/browser_accessibility.h" 12 #include "chrome/browser/browser_accessibility.h"
13 #include "chrome/browser/browser_accessibility_manager.h" 13 #include "chrome/browser/browser_accessibility_manager.h"
14 #include "chrome/browser/browser_trial.h" 14 #include "chrome/browser/browser_trial.h"
15 #include "chrome/browser/renderer_host/backing_store.h" 15 #include "chrome/browser/renderer_host/backing_store.h"
16 #include "chrome/browser/renderer_host/render_process_host.h" 16 #include "chrome/browser/renderer_host/render_process_host.h"
17 #include "chrome/browser/renderer_host/render_widget_host.h" 17 #include "chrome/browser/renderer_host/render_widget_host.h"
18 #include "chrome/common/chrome_constants.h" 18 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/gfx/chrome_canvas.h" 20 #include "chrome/common/gfx/chrome_canvas.h"
21 #include "chrome/common/l10n_util.h" 21 #include "chrome/common/l10n_util.h"
22 #include "chrome/common/l10n_util_win.h" 22 #include "chrome/common/l10n_util_win.h"
23 #include "chrome/common/native_web_keyboard_event.h" 23 #include "chrome/common/native_web_keyboard_event.h"
24 #include "chrome/common/plugin_messages.h" 24 #include "chrome/common/plugin_messages.h"
25 #include "chrome/common/render_messages.h" 25 #include "chrome/common/render_messages.h"
26 #include "chrome/common/resource_bundle.h" 26 #include "chrome/common/resource_bundle.h"
27 #include "chrome/common/win_util.h" 27 #include "chrome/common/win_util.h"
28 #include "chrome/views/focus/focus_util_win.h"
28 // Included for views::kReflectedMessage - TODO(beng): move this to win_util.h! 29 // Included for views::kReflectedMessage - TODO(beng): move this to win_util.h!
29 #include "chrome/views/widget/widget_win.h" 30 #include "chrome/views/widget/widget_win.h"
30 #include "grit/webkit_resources.h" 31 #include "grit/webkit_resources.h"
31 #include "webkit/glue/plugins/plugin_constants_win.h" 32 #include "webkit/glue/plugins/plugin_constants_win.h"
32 #include "webkit/glue/plugins/webplugin_delegate_impl.h" 33 #include "webkit/glue/plugins/webplugin_delegate_impl.h"
33 #include "webkit/glue/webcursor.h" 34 #include "webkit/glue/webcursor.h"
34 35
35 36
36 using base::TimeDelta; 37 using base::TimeDelta;
37 using base::TimeTicks; 38 using base::TimeTicks;
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 461 }
461 462
462 /////////////////////////////////////////////////////////////////////////////// 463 ///////////////////////////////////////////////////////////////////////////////
463 // RenderWidgetHostViewWin, private: 464 // RenderWidgetHostViewWin, private:
464 465
465 LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) { 466 LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) {
466 // Call the WM_INPUTLANGCHANGE message handler to initialize the input locale 467 // Call the WM_INPUTLANGCHANGE message handler to initialize the input locale
467 // of a browser process. 468 // of a browser process.
468 OnInputLangChange(0, 0); 469 OnInputLangChange(0, 0);
469 TRACK_HWND_CREATION(m_hWnd); 470 TRACK_HWND_CREATION(m_hWnd);
471 // Marks that window as supporting mouse-wheel messages rerouting so it is
472 // scrolled when under the mouse pointer even if inactive.
473 views::SetWindowSupportsRerouteMouseWheel(m_hWnd);
470 return 0; 474 return 0;
471 } 475 }
472 476
473 void RenderWidgetHostViewWin::OnActivate(UINT action, BOOL minimized, 477 void RenderWidgetHostViewWin::OnActivate(UINT action, BOOL minimized,
474 HWND window) { 478 HWND window) {
475 // If the container is a popup, clicking elsewhere on screen should close the 479 // If the container is a popup, clicking elsewhere on screen should close the
476 // popup. 480 // popup.
477 if (close_on_deactivate_ && action == WA_INACTIVE) { 481 if (close_on_deactivate_ && action == WA_INACTIVE) {
478 // Send a windows message so that any derived classes 482 // Send a windows message so that any derived classes
479 // will get a change to override the default handling 483 // will get a change to override the default handling
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 // messages even if we are not in the foreground. So here we check if 866 // messages even if we are not in the foreground. So here we check if
863 // we have any owned popup windows in the foreground and dismiss them. 867 // we have any owned popup windows in the foreground and dismiss them.
864 if (m_hWnd != GetForegroundWindow()) { 868 if (m_hWnd != GetForegroundWindow()) {
865 HWND toplevel_hwnd = ::GetAncestor(m_hWnd, GA_ROOT); 869 HWND toplevel_hwnd = ::GetAncestor(m_hWnd, GA_ROOT);
866 EnumThreadWindows( 870 EnumThreadWindows(
867 GetCurrentThreadId(), 871 GetCurrentThreadId(),
868 DismissOwnedPopups, 872 DismissOwnedPopups,
869 reinterpret_cast<LPARAM>(toplevel_hwnd)); 873 reinterpret_cast<LPARAM>(toplevel_hwnd));
870 } 874 }
871 875
876 // Forward the mouse-wheel message to the window under the mouse if it belongs
877 // to us.
878 if (message == WM_MOUSEWHEEL &&
879 views::RerouteMouseWheel(m_hWnd, wparam, lparam)) {
880 handled = TRUE;
881 return 0;
882 }
883
872 // This is a bit of a hack, but will work for now since we don't want to 884 // This is a bit of a hack, but will work for now since we don't want to
873 // pollute this object with WebContents-specific functionality... 885 // pollute this object with WebContents-specific functionality...
874 bool handled_by_webcontents = false; 886 bool handled_by_webcontents = false;
875 if (GetParent()) { 887 if (GetParent()) {
876 // Use a special reflected message to break recursion. If we send 888 // Use a special reflected message to break recursion. If we send
877 // WM_MOUSEWHEEL, the focus manager subclass of web contents will 889 // WM_MOUSEWHEEL, the focus manager subclass of web contents will
878 // route it back here. 890 // route it back here.
879 MSG new_message = {0}; 891 MSG new_message = {0};
880 new_message.hwnd = m_hWnd; 892 new_message.hwnd = m_hWnd;
881 new_message.message = message; 893 new_message.message = message;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 // WM_LBUTTONDOWN. 1075 // WM_LBUTTONDOWN.
1064 SetFocus(); 1076 SetFocus();
1065 } 1077 }
1066 } 1078 }
1067 1079
1068 void RenderWidgetHostViewWin::ShutdownHost() { 1080 void RenderWidgetHostViewWin::ShutdownHost() {
1069 shutdown_factory_.RevokeAll(); 1081 shutdown_factory_.RevokeAll();
1070 render_widget_host_->Shutdown(); 1082 render_widget_host_->Shutdown();
1071 // Do not touch any members at this point, |this| has been deleted. 1083 // Do not touch any members at this point, |this| has been deleted.
1072 } 1084 }
OLDNEW
« no previous file with comments | « no previous file | chrome/views/focus/focus_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698