OLD | NEW |
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 |
11 #include <windows.h> | 11 #include <windows.h> |
12 | 12 |
13 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 13 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
14 | 14 |
15 #include <algorithm> | 15 #include <algorithm> |
16 | 16 |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/i18n/rtl.h" | 18 #include "base/i18n/rtl.h" |
19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
20 #include "base/process_util.h" | 20 #include "base/process_util.h" |
21 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
22 #include "base/win/scoped_comptr.h" | 22 #include "base/win/scoped_comptr.h" |
23 #include "base/win/scoped_gdi_object.h" | 23 #include "base/win/scoped_gdi_object.h" |
24 #include "base/win/wrapped_window_proc.h" | 24 #include "base/win/wrapped_window_proc.h" |
25 #include "chrome/browser/browser_trial.h" | |
26 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" | |
27 #include "chrome/common/chrome_constants.h" | |
28 #include "chrome/common/chrome_switches.h" | |
29 #include "chrome/common/render_messages.h" | |
30 #include "content/browser/accessibility/browser_accessibility_manager.h" | 25 #include "content/browser/accessibility/browser_accessibility_manager.h" |
31 #include "content/browser/accessibility/browser_accessibility_state.h" | 26 #include "content/browser/accessibility/browser_accessibility_state.h" |
32 #include "content/browser/accessibility/browser_accessibility_win.h" | 27 #include "content/browser/accessibility/browser_accessibility_win.h" |
33 #include "content/browser/browser_thread.h" | 28 #include "content/browser/browser_thread.h" |
| 29 #include "content/browser/content_browser_client.h" |
34 #include "content/browser/plugin_process_host.h" | 30 #include "content/browser/plugin_process_host.h" |
35 #include "content/browser/renderer_host/backing_store.h" | 31 #include "content/browser/renderer_host/backing_store.h" |
36 #include "content/browser/renderer_host/backing_store_win.h" | 32 #include "content/browser/renderer_host/backing_store_win.h" |
37 #include "content/browser/renderer_host/render_process_host.h" | 33 #include "content/browser/renderer_host/render_process_host.h" |
38 #include "content/browser/renderer_host/render_widget_host.h" | 34 #include "content/browser/renderer_host/render_widget_host.h" |
| 35 #include "content/common/content_switches.h" |
39 #include "content/common/native_web_keyboard_event.h" | 36 #include "content/common/native_web_keyboard_event.h" |
40 #include "content/common/notification_service.h" | 37 #include "content/common/notification_service.h" |
41 #include "content/common/plugin_messages.h" | 38 #include "content/common/plugin_messages.h" |
42 #include "content/common/view_messages.h" | 39 #include "content/common/view_messages.h" |
43 #include "grit/webkit_resources.h" | |
44 #include "skia/ext/skia_utils_win.h" | 40 #include "skia/ext/skia_utils_win.h" |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
46 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
47 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFact
ory.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFact
ory.h" |
48 #include "ui/base/ime/composition_text.h" | 44 #include "ui/base/ime/composition_text.h" |
49 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
50 #include "ui/base/l10n/l10n_util_win.h" | 46 #include "ui/base/l10n/l10n_util_win.h" |
51 #include "ui/base/resource/resource_bundle.h" | 47 #include "ui/base/resource/resource_bundle.h" |
52 #include "ui/base/text/text_elider.h" | 48 #include "ui/base/text/text_elider.h" |
53 #include "ui/base/view_prop.h" | 49 #include "ui/base/view_prop.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // Must be dynamically loaded to avoid startup failures on Win XP. | 217 // Must be dynamically loaded to avoid startup failures on Win XP. |
222 typedef BOOL (WINAPI *ChangeWindowMessageFilterExFunction)( | 218 typedef BOOL (WINAPI *ChangeWindowMessageFilterExFunction)( |
223 HWND hwnd, | 219 HWND hwnd, |
224 UINT message, | 220 UINT message, |
225 DWORD action, | 221 DWORD action, |
226 PCHANGEFILTERSTRUCT change_filter_struct); | 222 PCHANGEFILTERSTRUCT change_filter_struct); |
227 ChangeWindowMessageFilterExFunction g_ChangeWindowMessageFilterEx; | 223 ChangeWindowMessageFilterExFunction g_ChangeWindowMessageFilterEx; |
228 | 224 |
229 } // namespace | 225 } // namespace |
230 | 226 |
231 // RenderWidgetHostView -------------------------------------------------------- | |
232 | |
233 // static | |
234 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | |
235 RenderWidgetHost* widget) { | |
236 if (views::Widget::IsPureViews()) | |
237 return new RenderWidgetHostViewViews(widget); | |
238 return new RenderWidgetHostViewWin(widget); | |
239 } | |
240 | |
241 /////////////////////////////////////////////////////////////////////////////// | 227 /////////////////////////////////////////////////////////////////////////////// |
242 // RenderWidgetHostViewWin, public: | 228 // RenderWidgetHostViewWin, public: |
243 | 229 |
244 RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) | 230 RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) |
245 : render_widget_host_(widget), | 231 : render_widget_host_(widget), |
246 compositor_host_window_(NULL), | 232 compositor_host_window_(NULL), |
247 hide_compositor_window_at_next_paint_(false), | 233 hide_compositor_window_at_next_paint_(false), |
248 track_mouse_leave_(false), | 234 track_mouse_leave_(false), |
249 ime_notification_(false), | 235 ime_notification_(false), |
250 capture_enter_key_(false), | 236 capture_enter_key_(false), |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 } | 578 } |
593 | 579 |
594 void RenderWidgetHostViewWin::UpdateCursor(const WebCursor& cursor) { | 580 void RenderWidgetHostViewWin::UpdateCursor(const WebCursor& cursor) { |
595 current_cursor_ = cursor; | 581 current_cursor_ = cursor; |
596 UpdateCursorIfOverSelf(); | 582 UpdateCursorIfOverSelf(); |
597 } | 583 } |
598 | 584 |
599 void RenderWidgetHostViewWin::UpdateCursorIfOverSelf() { | 585 void RenderWidgetHostViewWin::UpdateCursorIfOverSelf() { |
600 static HCURSOR kCursorArrow = LoadCursor(NULL, IDC_ARROW); | 586 static HCURSOR kCursorArrow = LoadCursor(NULL, IDC_ARROW); |
601 static HCURSOR kCursorAppStarting = LoadCursor(NULL, IDC_APPSTARTING); | 587 static HCURSOR kCursorAppStarting = LoadCursor(NULL, IDC_APPSTARTING); |
602 static HINSTANCE module_handle = | 588 static HINSTANCE module_handle = GetModuleHandle( |
603 GetModuleHandle(chrome::kBrowserResourcesDll); | 589 content::GetContentClient()->browser()->GetResourceDllName()); |
604 | 590 |
605 // If the mouse is over our HWND, then update the cursor state immediately. | 591 // If the mouse is over our HWND, then update the cursor state immediately. |
606 CPoint pt; | 592 CPoint pt; |
607 GetCursorPos(&pt); | 593 GetCursorPos(&pt); |
608 if (WindowFromPoint(pt) == m_hWnd) { | 594 if (WindowFromPoint(pt) == m_hWnd) { |
609 BOOL result = ::ScreenToClient(m_hWnd, &pt); | 595 BOOL result = ::ScreenToClient(m_hWnd, &pt); |
610 DCHECK(result); | 596 DCHECK(result); |
611 // We cannot pass in NULL as the module handle as this would only work for | 597 // We cannot pass in NULL as the module handle as this would only work for |
612 // standard win32 cursors. We can also receive cursor types which are | 598 // standard win32 cursors. We can also receive cursor types which are |
613 // defined as webkit resources. We need to specify the module handle of | 599 // defined as webkit resources. We need to specify the module handle of |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 DWORD ex_style) { | 1856 DWORD ex_style) { |
1871 parent_hwnd_ = parent_hwnd; | 1857 parent_hwnd_ = parent_hwnd; |
1872 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); | 1858 Create(parent_hwnd_, NULL, NULL, WS_POPUP, ex_style); |
1873 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); | 1859 MoveWindow(pos.x(), pos.y(), pos.width(), pos.height(), TRUE); |
1874 // To show tooltip on popup window.(e.g. title in <select>) | 1860 // To show tooltip on popup window.(e.g. title in <select>) |
1875 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. | 1861 // Popups default to showing, which means |DidBecomeSelected()| isn't invoked. |
1876 // Ensure the tooltip is created otherwise tooltips are never shown. | 1862 // Ensure the tooltip is created otherwise tooltips are never shown. |
1877 EnsureTooltip(); | 1863 EnsureTooltip(); |
1878 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); | 1864 ShowWindow(IsActivatable() ? SW_SHOW : SW_SHOWNA); |
1879 } | 1865 } |
OLD | NEW |