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

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

Issue 7764010: Get rid of last views dependency in RenderWidgetHostViewWin. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 // Need Win 7 headers for WM_GESTURE and ChangeWindowMessageFilterEx 5 // Need Win 7 headers for WM_GESTURE and ChangeWindowMessageFilterEx
6 // TODO(jschuh): See crbug.com/92941 for longterm fix. 6 // TODO(jschuh): See crbug.com/92941 for longterm fix.
7 #undef WINVER 7 #undef WINVER
8 #define WINVER _WIN32_WINNT_WIN7 8 #define WINVER _WIN32_WINNT_WIN7
9 #undef _WIN32_WINNT 9 #undef _WIN32_WINNT
10 #define _WIN32_WINNT _WIN32_WINNT_WIN7 10 #define _WIN32_WINNT _WIN32_WINNT_WIN7
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "ui/base/l10n/l10n_util_win.h" 46 #include "ui/base/l10n/l10n_util_win.h"
47 #include "ui/base/text/text_elider.h" 47 #include "ui/base/text/text_elider.h"
48 #include "ui/base/view_prop.h" 48 #include "ui/base/view_prop.h"
49 #include "ui/base/win/hwnd_util.h" 49 #include "ui/base/win/hwnd_util.h"
50 #include "ui/base/win/mouse_wheel_util.h" 50 #include "ui/base/win/mouse_wheel_util.h"
51 #include "ui/gfx/canvas.h" 51 #include "ui/gfx/canvas.h"
52 #include "ui/gfx/canvas_skia.h" 52 #include "ui/gfx/canvas_skia.h"
53 #include "ui/gfx/gdi_util.h" 53 #include "ui/gfx/gdi_util.h"
54 #include "ui/gfx/rect.h" 54 #include "ui/gfx/rect.h"
55 #include "ui/gfx/screen.h" 55 #include "ui/gfx/screen.h"
56 #include "views/focus/focus_manager.h"
57 #include "views/widget/widget.h"
58 #include "webkit/glue/webaccessibility.h" 56 #include "webkit/glue/webaccessibility.h"
59 #include "webkit/glue/webcursor.h" 57 #include "webkit/glue/webcursor.h"
60 #include "webkit/plugins/npapi/plugin_constants_win.h" 58 #include "webkit/plugins/npapi/plugin_constants_win.h"
61 #include "webkit/plugins/npapi/webplugin.h" 59 #include "webkit/plugins/npapi/webplugin.h"
62 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 60 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
63 61
64 using base::TimeDelta; 62 using base::TimeDelta;
65 using base::TimeTicks; 63 using base::TimeTicks;
66 using ui::ViewProp; 64 using ui::ViewProp;
67 using WebKit::WebInputEvent; 65 using WebKit::WebInputEvent;
(...skipping 13 matching lines...) Expand all
81 const int kMaxTooltipLength = 1024; 79 const int kMaxTooltipLength = 1024;
82 80
83 // A custom MSAA object id used to determine if a screen reader is actively 81 // A custom MSAA object id used to determine if a screen reader is actively
84 // listening for MSAA events. 82 // listening for MSAA events.
85 const int kIdCustom = 1; 83 const int kIdCustom = 1;
86 84
87 // The delay before the compositor host window is destroyed. This gives the GPU 85 // The delay before the compositor host window is destroyed. This gives the GPU
88 // process a grace period to stop referencing it. 86 // process a grace period to stop referencing it.
89 const int kDestroyCompositorHostWindowDelay = 10000; 87 const int kDestroyCompositorHostWindowDelay = 10000;
90 88
91 const char* const kRenderWidgetHostViewKey = "__RENDER_WIDGET_HOST_VIEW__";
jam 2011/08/26 22:23:37 this is also code from r38685 that's not being use
92
93 // A callback function for EnumThreadWindows to enumerate and dismiss 89 // A callback function for EnumThreadWindows to enumerate and dismiss
94 // any owned popop windows 90 // any owned popop windows
95 BOOL CALLBACK DismissOwnedPopups(HWND window, LPARAM arg) { 91 BOOL CALLBACK DismissOwnedPopups(HWND window, LPARAM arg) {
96 const HWND toplevel_hwnd = reinterpret_cast<HWND>(arg); 92 const HWND toplevel_hwnd = reinterpret_cast<HWND>(arg);
97 93
98 if (::IsWindowVisible(window)) { 94 if (::IsWindowVisible(window)) {
99 const HWND owner = ::GetWindow(window, GW_OWNER); 95 const HWND owner = ::GetWindow(window, GW_OWNER);
100 if (toplevel_hwnd == owner) { 96 if (toplevel_hwnd == owner) {
101 ::PostMessage(window, WM_CANCELMODE, 0, 0); 97 ::PostMessage(window, WM_CANCELMODE, 0, 0);
102 } 98 }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 // Popups should not be activated. 508 // Popups should not be activated.
513 return popup_type_ == WebKit::WebPopupTypeNone; 509 return popup_type_ == WebKit::WebPopupTypeNone;
514 } 510 }
515 511
516 void RenderWidgetHostViewWin::Focus() { 512 void RenderWidgetHostViewWin::Focus() {
517 if (IsWindow()) 513 if (IsWindow())
518 SetFocus(); 514 SetFocus();
519 } 515 }
520 516
521 void RenderWidgetHostViewWin::Blur() { 517 void RenderWidgetHostViewWin::Blur() {
522 views::Widget* widget = views::Widget::GetTopLevelWidgetForNativeView(m_hWnd); 518 NOTREACHED();
jam 2011/08/26 22:23:37 I couldn't find any place that called this code, a
523 if (widget) {
524 views::FocusManager* focus_manager = widget->GetFocusManager();
525 // We don't have a FocusManager if we are hidden.
526 if (focus_manager)
527 focus_manager->ClearFocus();
528 }
529 } 519 }
530 520
531 bool RenderWidgetHostViewWin::HasFocus() { 521 bool RenderWidgetHostViewWin::HasFocus() {
532 return ::GetFocus() == m_hWnd; 522 return ::GetFocus() == m_hWnd;
533 } 523 }
534 524
535 void RenderWidgetHostViewWin::Show() { 525 void RenderWidgetHostViewWin::Show() {
536 if (!is_fullscreen_) { 526 if (!is_fullscreen_) {
537 DCHECK(parent_hwnd_); 527 DCHECK(parent_hwnd_);
538 DCHECK(parent_hwnd_ != GetDesktopWindow()); 528 DCHECK(parent_hwnd_ != GetDesktopWindow());
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 /////////////////////////////////////////////////////////////////////////////// 791 ///////////////////////////////////////////////////////////////////////////////
802 // RenderWidgetHostViewWin, private: 792 // RenderWidgetHostViewWin, private:
803 793
804 LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) { 794 LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) {
805 // Call the WM_INPUTLANGCHANGE message handler to initialize the input locale 795 // Call the WM_INPUTLANGCHANGE message handler to initialize the input locale
806 // of a browser process. 796 // of a browser process.
807 OnInputLangChange(0, 0); 797 OnInputLangChange(0, 0);
808 // Marks that window as supporting mouse-wheel messages rerouting so it is 798 // Marks that window as supporting mouse-wheel messages rerouting so it is
809 // scrolled when under the mouse pointer even if inactive. 799 // scrolled when under the mouse pointer even if inactive.
810 props_.push_back(ui::SetWindowSupportsRerouteMouseWheel(m_hWnd)); 800 props_.push_back(ui::SetWindowSupportsRerouteMouseWheel(m_hWnd));
811 props_.push_back(new ViewProp(m_hWnd, kRenderWidgetHostViewKey,
812 static_cast<RenderWidgetHostView*>(this)));
813 801
814 return 0; 802 return 0;
815 } 803 }
816 804
817 void RenderWidgetHostViewWin::OnActivate(UINT action, BOOL minimized, 805 void RenderWidgetHostViewWin::OnActivate(UINT action, BOOL minimized,
818 HWND window) { 806 HWND window) {
819 // If the container is a popup, clicking elsewhere on screen should close the 807 // If the container is a popup, clicking elsewhere on screen should close the
820 // popup. 808 // popup.
821 if (close_on_deactivate_ && action == WA_INACTIVE) { 809 if (close_on_deactivate_ && action == WA_INACTIVE) {
822 // Send a windows message so that any derived classes 810 // Send a windows message so that any derived classes
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 return 1; 996 return 1;
1009 } 997 }
1010 998
1011 LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code, 999 LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code,
1012 UINT mouse_message_id) { 1000 UINT mouse_message_id) {
1013 UpdateCursorIfOverSelf(); 1001 UpdateCursorIfOverSelf();
1014 return 0; 1002 return 0;
1015 } 1003 }
1016 1004
1017 void RenderWidgetHostViewWin::OnSetFocus(HWND window) { 1005 void RenderWidgetHostViewWin::OnSetFocus(HWND window) {
1018 views::FocusManager::GetWidgetFocusManager()->OnWidgetFocusEvent(window,
jam 2011/08/26 22:23:37 this code, and below, were added in r49884 so that
1019 m_hWnd);
1020 if (browser_accessibility_manager_.get()) 1006 if (browser_accessibility_manager_.get())
1021 browser_accessibility_manager_->GotFocus(); 1007 browser_accessibility_manager_->GotFocus();
1022 if (render_widget_host_) 1008 if (render_widget_host_)
1023 render_widget_host_->GotFocus(); 1009 render_widget_host_->GotFocus();
1024 } 1010 }
1025 1011
1026 void RenderWidgetHostViewWin::OnKillFocus(HWND window) { 1012 void RenderWidgetHostViewWin::OnKillFocus(HWND window) {
1027 views::FocusManager::GetWidgetFocusManager()->OnWidgetFocusEvent(m_hWnd,
1028 window);
1029
1030 if (render_widget_host_) 1013 if (render_widget_host_)
1031 render_widget_host_->Blur(); 1014 render_widget_host_->Blur();
1032 } 1015 }
1033 1016
1034 void RenderWidgetHostViewWin::OnCaptureChanged(HWND window) { 1017 void RenderWidgetHostViewWin::OnCaptureChanged(HWND window) {
1035 if (render_widget_host_) 1018 if (render_widget_host_)
1036 render_widget_host_->LostCapture(); 1019 render_widget_host_->LostCapture();
1037 } 1020 }
1038 1021
1039 void RenderWidgetHostViewWin::OnCancelMode() { 1022 void RenderWidgetHostViewWin::OnCancelMode() {
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 DWORD ex_style) { 1836 DWORD ex_style) {
1854 parent_hwnd_ = parent_hwnd; 1837 parent_hwnd_ = parent_hwnd;
1855 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); 1838 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style);
1856 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); 1839 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE);
1857 // To show tooltip on popup window.(e.g. title in <select>) 1840 // To show tooltip on popup window.(e.g. title in <select>)
1858 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. 1841 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked.
1859 // Ensure the tooltip is created otherwise tooltips are never shown. 1842 // Ensure the tooltip is created otherwise tooltips are never shown.
1860 EnsureTooltip(); 1843 EnsureTooltip();
1861 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); 1844 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA);
1862 } 1845 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698