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

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

Issue 10905122: Initial NPAPI plugin support in Win Aura. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_win.h" 5 #include "content/browser/renderer_host/render_widget_host_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <peninputpanel_i.c> 9 #include <peninputpanel_i.c>
10 #include <stack> 10 #include <stack>
(...skipping 10 matching lines...) Expand all
21 #include "base/win/scoped_comptr.h" 21 #include "base/win/scoped_comptr.h"
22 #include "base/win/scoped_gdi_object.h" 22 #include "base/win/scoped_gdi_object.h"
23 #include "base/win/win_util.h" 23 #include "base/win/win_util.h"
24 #include "base/win/windows_version.h" 24 #include "base/win/windows_version.h"
25 #include "base/win/wrapped_window_proc.h" 25 #include "base/win/wrapped_window_proc.h"
26 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 26 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
27 #include "content/browser/accessibility/browser_accessibility_win.h" 27 #include "content/browser/accessibility/browser_accessibility_win.h"
28 #include "content/browser/gpu/gpu_data_manager_impl.h" 28 #include "content/browser/gpu/gpu_data_manager_impl.h"
29 #include "content/browser/gpu/gpu_process_host.h" 29 #include "content/browser/gpu/gpu_process_host.h"
30 #include "content/browser/gpu/gpu_process_host_ui_shim.h" 30 #include "content/browser/gpu/gpu_process_host_ui_shim.h"
31 #include "content/browser/plugin_process_host.h"
32 #include "content/browser/renderer_host/backing_store.h" 31 #include "content/browser/renderer_host/backing_store.h"
33 #include "content/browser/renderer_host/backing_store_win.h" 32 #include "content/browser/renderer_host/backing_store_win.h"
34 #include "content/browser/renderer_host/render_process_host_impl.h" 33 #include "content/browser/renderer_host/render_process_host_impl.h"
35 #include "content/browser/renderer_host/render_widget_host_impl.h" 34 #include "content/browser/renderer_host/render_widget_host_impl.h"
36 #include "content/common/accessibility_messages.h" 35 #include "content/common/accessibility_messages.h"
37 #include "content/common/gpu/gpu_messages.h" 36 #include "content/common/gpu/gpu_messages.h"
38 #include "content/common/plugin_messages.h" 37 #include "content/common/plugin_messages.h"
39 #include "content/common/view_messages.h" 38 #include "content/common/view_messages.h"
40 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
41 #include "content/public/browser/child_process_data.h" 40 #include "content/public/browser/child_process_data.h"
(...skipping 11 matching lines...) Expand all
53 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFact ory.h" 52 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebInputEventFact ory.h"
54 #include "ui/base/events/event.h" 53 #include "ui/base/events/event.h"
55 #include "ui/base/ime/composition_text.h" 54 #include "ui/base/ime/composition_text.h"
56 #include "ui/base/l10n/l10n_util_win.h" 55 #include "ui/base/l10n/l10n_util_win.h"
57 #include "ui/base/text/text_elider.h" 56 #include "ui/base/text/text_elider.h"
58 #include "ui/base/ui_base_switches.h" 57 #include "ui/base/ui_base_switches.h"
59 #include "ui/base/view_prop.h" 58 #include "ui/base/view_prop.h"
60 #include "ui/base/win/hwnd_util.h" 59 #include "ui/base/win/hwnd_util.h"
61 #include "ui/base/win/mouse_wheel_util.h" 60 #include "ui/base/win/mouse_wheel_util.h"
62 #include "ui/gfx/canvas.h" 61 #include "ui/gfx/canvas.h"
63 #include "ui/gfx/gdi_util.h"
64 #include "ui/gfx/rect.h" 62 #include "ui/gfx/rect.h"
65 #include "ui/gfx/screen.h" 63 #include "ui/gfx/screen.h"
66 #include "webkit/glue/webcursor.h" 64 #include "webkit/glue/webcursor.h"
67 #include "webkit/plugins/npapi/plugin_constants_win.h" 65 #include "webkit/plugins/npapi/plugin_constants_win.h"
68 #include "webkit/plugins/npapi/webplugin.h" 66 #include "webkit/plugins/npapi/webplugin.h"
69 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 67 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
70 68
71 using base::TimeDelta; 69 using base::TimeDelta;
72 using base::TimeTicks; 70 using base::TimeTicks;
73 using ui::ViewProp; 71 using ui::ViewProp;
74 using WebKit::WebInputEvent; 72 using WebKit::WebInputEvent;
75 using WebKit::WebInputEventFactory; 73 using WebKit::WebInputEventFactory;
76 using WebKit::WebMouseEvent; 74 using WebKit::WebMouseEvent;
77 using WebKit::WebTextDirection; 75 using WebKit::WebTextDirection;
78 using webkit::npapi::WebPluginGeometry;
79 76
80 namespace content { 77 namespace content {
81 namespace { 78 namespace {
82 79
83 // Tooltips will wrap after this width. Yes, wrap. Imagine that! 80 // Tooltips will wrap after this width. Yes, wrap. Imagine that!
84 const int kTooltipMaxWidthPixels = 300; 81 const int kTooltipMaxWidthPixels = 300;
85 82
86 // Maximum number of characters we allow in a tooltip. 83 // Maximum number of characters we allow in a tooltip.
87 const int kMaxTooltipLength = 1024; 84 const int kMaxTooltipLength = 1024;
88 85
(...skipping 29 matching lines...) Expand all
118 if (::IsWindowVisible(window)) { 115 if (::IsWindowVisible(window)) {
119 const HWND owner = ::GetWindow(window, GW_OWNER); 116 const HWND owner = ::GetWindow(window, GW_OWNER);
120 if (toplevel_hwnd == owner) { 117 if (toplevel_hwnd == owner) {
121 ::PostMessage(window, WM_CANCELMODE, 0, 0); 118 ::PostMessage(window, WM_CANCELMODE, 0, 0);
122 } 119 }
123 } 120 }
124 121
125 return TRUE; 122 return TRUE;
126 } 123 }
127 124
128 // |window| is the plugin HWND, created and destroyed in the plugin process.
129 // |parent| is the parent HWND, created and destroyed on the browser UI thread.
130 void NotifyPluginProcessHostHelper(HWND window, HWND parent, int tries) {
131 // How long to wait between each try.
132 static const int kTryDelayMs = 200;
133
134 DWORD plugin_process_id;
135 bool found_starting_plugin_process = false;
136 GetWindowThreadProcessId(window, &plugin_process_id);
137 for (PluginProcessHostIterator iter; !iter.Done(); ++iter) {
138 if (!iter.GetData().handle) {
139 found_starting_plugin_process = true;
140 continue;
141 }
142 if (base::GetProcId(iter.GetData().handle) == plugin_process_id) {
143 iter->AddWindow(parent);
144 return;
145 }
146 }
147
148 if (found_starting_plugin_process) {
149 // A plugin process has started but we don't have its handle yet. Since
150 // it's most likely the one for this plugin, try a few more times after a
151 // delay.
152 if (tries > 0) {
153 MessageLoop::current()->PostDelayedTask(
154 FROM_HERE,
155 base::Bind(&NotifyPluginProcessHostHelper, window, parent, tries - 1),
156 base::TimeDelta::FromMilliseconds(kTryDelayMs));
157 return;
158 }
159 }
160
161 // The plugin process might have died in the time to execute the task, don't
162 // leak the HWND.
163 PostMessage(parent, WM_CLOSE, 0, 0);
164 }
165
166 // Windows callback for OnDestroy to detach the plugin windows. 125 // Windows callback for OnDestroy to detach the plugin windows.
167 BOOL CALLBACK DetachPluginWindowsCallback(HWND window, LPARAM param) { 126 BOOL CALLBACK DetachPluginWindowsCallback(HWND window, LPARAM param) {
168 if (webkit::npapi::WebPluginDelegateImpl::IsPluginDelegateWindow(window) && 127 if (webkit::npapi::WebPluginDelegateImpl::IsPluginDelegateWindow(window) &&
169 !IsHungAppWindow(window)) { 128 !IsHungAppWindow(window)) {
170 ::ShowWindow(window, SW_HIDE); 129 ::ShowWindow(window, SW_HIDE);
171 SetParent(window, NULL); 130 SetParent(window, NULL);
172 } 131 }
173 return TRUE; 132 return TRUE;
174 } 133 }
175 134
176 // The plugin wrapper window which lives in the browser process has this proc
177 // as its window procedure. We only handle the WM_PARENTNOTIFY message sent by
178 // windowed plugins for mouse input. This is forwarded off to the wrappers
179 // parent which is typically the RVH window which turns on user gesture.
180 LRESULT CALLBACK PluginWrapperWindowProc(HWND window, unsigned int message,
181 WPARAM wparam, LPARAM lparam) {
182 if (message == WM_PARENTNOTIFY) {
183 switch (LOWORD(wparam)) {
184 case WM_LBUTTONDOWN:
185 case WM_RBUTTONDOWN:
186 case WM_MBUTTONDOWN:
187 ::SendMessage(GetParent(window), message, wparam, lparam);
188 return 0;
189 default:
190 break;
191 }
192 }
193 return ::DefWindowProc(window, message, wparam, lparam);
194 }
195
196 void SendToGpuProcessHost(int gpu_host_id, scoped_ptr<IPC::Message> message) { 135 void SendToGpuProcessHost(int gpu_host_id, scoped_ptr<IPC::Message> message) {
197 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id); 136 GpuProcessHost* gpu_process_host = GpuProcessHost::FromID(gpu_host_id);
198 if (!gpu_process_host) 137 if (!gpu_process_host)
199 return; 138 return;
200 139
201 gpu_process_host->Send(message.release()); 140 gpu_process_host->Send(message.release());
202 } 141 }
203 142
204 void PostTaskOnIOThread(const tracked_objects::Location& from_here, 143 void PostTaskOnIOThread(const tracked_objects::Location& from_here,
205 base::Closure task) { 144 base::Closure task) {
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 SetBrowserAccessibilityManager( 643 SetBrowserAccessibilityManager(
705 BrowserAccessibilityManager::CreateEmptyDocument( 644 BrowserAccessibilityManager::CreateEmptyDocument(
706 m_hWnd, busy_state, this)); 645 m_hWnd, busy_state, this));
707 } 646 }
708 647
709 return GetBrowserAccessibilityManager()->GetRoot()-> 648 return GetBrowserAccessibilityManager()->GetRoot()->
710 ToBrowserAccessibilityWin(); 649 ToBrowserAccessibilityWin();
711 } 650 }
712 651
713 void RenderWidgetHostViewWin::MovePluginWindows( 652 void RenderWidgetHostViewWin::MovePluginWindows(
714 const std::vector<WebPluginGeometry>& plugin_window_moves) { 653 const gfx::Point& scroll_offset,
715 if (plugin_window_moves.empty()) 654 const std::vector<webkit::npapi::WebPluginGeometry>& plugin_window_moves) {
716 return; 655 MovePluginWindowsHelper(m_hWnd, plugin_window_moves);
717
718 bool oop_plugins =
719 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) &&
720 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessPlugins);
721
722 HDWP defer_window_pos_info =
723 ::BeginDeferWindowPos(static_cast<int>(plugin_window_moves.size()));
724
725 if (!defer_window_pos_info) {
726 NOTREACHED();
727 return;
728 }
729
730 for (size_t i = 0; i < plugin_window_moves.size(); ++i) {
731 unsigned long flags = 0;
732 const WebPluginGeometry& move = plugin_window_moves[i];
733 HWND window = move.window;
734
735 // As the plugin parent window which lives on the browser UI thread is
736 // destroyed asynchronously, it is possible that we have a stale window
737 // sent in by the renderer for moving around.
738 // Note: get the parent before checking if the window is valid, to avoid a
739 // race condition where the window is destroyed after the check but before
740 // the GetParent call.
741 HWND parent = ::GetParent(window);
742 if (!::IsWindow(window))
743 continue;
744
745 if (oop_plugins) {
746 if (parent == m_hWnd) {
747 // The plugin window is a direct child of this window, add an
748 // intermediate window that lives on this thread to speed up scrolling.
749 // Note this only works with out of process plugins since we depend on
750 // PluginProcessHost to destroy the intermediate HWNDs.
751 parent = ReparentWindow(window);
752 ::ShowWindow(window, SW_SHOW); // Window was created hidden.
753 } else if (::GetParent(parent) != m_hWnd) {
754 // The renderer should only be trying to move windows that are children
755 // of its render widget window. However, this may happen as a result of
756 // a race condition, so we ignore it and not kill the plugin process.
757 continue;
758 }
759
760 // We move the intermediate parent window which doesn't result in cross-
761 // process synchronous Windows messages.
762 window = parent;
763 }
764
765 if (move.visible)
766 flags |= SWP_SHOWWINDOW;
767 else
768 flags |= SWP_HIDEWINDOW;
769
770 if (move.rects_valid) {
771 HRGN hrgn = ::CreateRectRgn(move.clip_rect.x(),
772 move.clip_rect.y(),
773 move.clip_rect.right(),
774 move.clip_rect.bottom());
775 gfx::SubtractRectanglesFromRegion(hrgn, move.cutout_rects);
776
777 // Note: System will own the hrgn after we call SetWindowRgn,
778 // so we don't need to call DeleteObject(hrgn)
779 ::SetWindowRgn(window, hrgn, !move.clip_rect.IsEmpty());
780 } else {
781 flags |= SWP_NOMOVE;
782 flags |= SWP_NOSIZE;
783 }
784
785 defer_window_pos_info = ::DeferWindowPos(defer_window_pos_info,
786 window, NULL,
787 move.window_rect.x(),
788 move.window_rect.y(),
789 move.window_rect.width(),
790 move.window_rect.height(), flags);
791 if (!defer_window_pos_info) {
792 DCHECK(false) << "DeferWindowPos failed, so all plugin moves ignored.";
793 return;
794 }
795 }
796
797 ::EndDeferWindowPos(defer_window_pos_info);
798 }
799
800 HWND RenderWidgetHostViewWin::ReparentWindow(HWND window) {
801 static ATOM atom = 0;
802 static HMODULE instance = NULL;
803 if (!atom) {
804 WNDCLASSEX window_class;
805 base::win::InitializeWindowClass(
806 webkit::npapi::kWrapperNativeWindowClassName,
807 &base::win::WrappedWindowProc<PluginWrapperWindowProc>,
808 CS_DBLCLKS,
809 0,
810 0,
811 NULL,
812 reinterpret_cast<HBRUSH>(COLOR_WINDOW+1),
813 NULL,
814 NULL,
815 NULL,
816 &window_class);
817 instance = window_class.hInstance;
818 atom = RegisterClassEx(&window_class);
819 }
820 DCHECK(atom);
821
822 HWND orig_parent = ::GetParent(window);
823 HWND parent = CreateWindowEx(
824 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR,
825 MAKEINTATOM(atom), 0,
826 WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
827 0, 0, 0, 0, orig_parent, 0, instance, 0);
828 ui::CheckWindowCreated(parent);
829 // If UIPI is enabled we need to add message filters for parents with
830 // children that cross process boundaries.
831 if (::GetPropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp)) {
832 // Process-wide message filters required on Vista must be added to:
833 // chrome_content_client.cc ChromeContentClient::SandboxPlugin
834 ChangeWindowMessageFilterEx(parent, WM_MOUSEWHEEL, MSGFLT_ALLOW, NULL);
835 ChangeWindowMessageFilterEx(parent, WM_GESTURE, MSGFLT_ALLOW, NULL);
836 ChangeWindowMessageFilterEx(parent, WM_APPCOMMAND, MSGFLT_ALLOW, NULL);
837 ::RemovePropW(orig_parent, webkit::npapi::kNativeWindowClassFilterProp);
838 }
839 ::SetParent(window, parent);
840 // How many times we try to find a PluginProcessHost whose process matches
841 // the HWND.
842 static const int kMaxTries = 5;
843 BrowserThread::PostTask(
844 BrowserThread::IO,
845 FROM_HERE,
846 base::Bind(&NotifyPluginProcessHostHelper, window, parent, kMaxTries));
847 return parent;
848 } 656 }
849 657
850 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) { 658 static BOOL CALLBACK AddChildWindowToVector(HWND hwnd, LPARAM lparam) {
851 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam); 659 std::vector<HWND>* vector = reinterpret_cast<std::vector<HWND>*>(lparam);
852 vector->push_back(hwnd); 660 vector->push_back(hwnd);
853 return TRUE; 661 return TRUE;
854 } 662 }
855 663
856 void RenderWidgetHostViewWin::CleanupCompositorWindow() { 664 void RenderWidgetHostViewWin::CleanupCompositorWindow() {
857 if (!compositor_host_window_) 665 if (!compositor_host_window_)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 ime_input_.CancelIME(m_hWnd); 801 ime_input_.CancelIME(m_hWnd);
994 } 802 }
995 803
996 void RenderWidgetHostViewWin::ImeCompositionRangeChanged( 804 void RenderWidgetHostViewWin::ImeCompositionRangeChanged(
997 const ui::Range& range, 805 const ui::Range& range,
998 const std::vector<gfx::Rect>& character_bounds) { 806 const std::vector<gfx::Rect>& character_bounds) {
999 composition_range_ = range; 807 composition_range_ = range;
1000 composition_character_bounds_ = character_bounds; 808 composition_character_bounds_ = character_bounds;
1001 } 809 }
1002 810
1003 BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lparam) {
1004 if (!webkit::npapi::WebPluginDelegateImpl::IsPluginDelegateWindow(hwnd))
1005 return TRUE;
1006
1007 gfx::Rect* rect = reinterpret_cast<gfx::Rect*>(lparam);
1008 static UINT msg = RegisterWindowMessage(webkit::npapi::kPaintMessageName);
1009 WPARAM wparam = rect->x() << 16 | rect->y();
1010 lparam = rect->width() << 16 | rect->height();
1011
1012 // SendMessage gets the message across much quicker than PostMessage, since it
1013 // doesn't get queued. When the plugin thread calls PeekMessage or other
1014 // Win32 APIs, sent messages are dispatched automatically.
1015 SendNotifyMessage(hwnd, msg, wparam, lparam);
1016
1017 return TRUE;
1018 }
1019
1020 void RenderWidgetHostViewWin::Redraw() { 811 void RenderWidgetHostViewWin::Redraw() {
1021 RECT damage_bounds; 812 RECT damage_bounds;
1022 GetUpdateRect(&damage_bounds, FALSE); 813 GetUpdateRect(&damage_bounds, FALSE);
1023 814
1024 base::win::ScopedGDIObject<HRGN> damage_region(CreateRectRgn(0, 0, 0, 0)); 815 base::win::ScopedGDIObject<HRGN> damage_region(CreateRectRgn(0, 0, 0, 0));
1025 GetUpdateRgn(damage_region, FALSE); 816 GetUpdateRgn(damage_region, FALSE);
1026 817
1027 // Paint the invalid region synchronously. Our caller will not paint again 818 // Paint the invalid region synchronously. Our caller will not paint again
1028 // until we return, so by painting to the screen here, we ensure effective 819 // until we return, so by painting to the screen here, we ensure effective
1029 // rate-limiting of backing store updates. This helps a lot on pages that 820 // rate-limiting of backing store updates. This helps a lot on pages that
1030 // have animations or fairly expensive layout (e.g., google maps). 821 // have animations or fairly expensive layout (e.g., google maps).
1031 // 822 //
1032 // We paint this window synchronously, however child windows (i.e. plugins) 823 // We paint this window synchronously, however child windows (i.e. plugins)
1033 // are painted asynchronously. By avoiding synchronous cross-process window 824 // are painted asynchronously. By avoiding synchronous cross-process window
1034 // message dispatching we allow scrolling to be smooth, and also avoid the 825 // message dispatching we allow scrolling to be smooth, and also avoid the
1035 // browser process locking up if the plugin process is hung. 826 // browser process locking up if the plugin process is hung.
1036 // 827 //
1037 RedrawWindow(NULL, damage_region, RDW_UPDATENOW | RDW_NOCHILDREN); 828 RedrawWindow(NULL, damage_region, RDW_UPDATENOW | RDW_NOCHILDREN);
1038 829
1039 // Send the invalid rect in screen coordinates. 830 // Send the invalid rect in screen coordinates.
1040 gfx::Rect screen_rect = GetViewBounds(); 831 gfx::Rect screen_rect = GetViewBounds();
1041 gfx::Rect invalid_screen_rect(damage_bounds); 832 gfx::Rect invalid_screen_rect(damage_bounds);
1042 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); 833 invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y());
1043 834
1044 LPARAM lparam = reinterpret_cast<LPARAM>(&invalid_screen_rect); 835 PaintPluginWindowsHelper(m_hWnd, invalid_screen_rect);
1045 EnumChildWindows(m_hWnd, EnumChildProc, lparam);
1046 } 836 }
1047 837
1048 void RenderWidgetHostViewWin::DidUpdateBackingStore( 838 void RenderWidgetHostViewWin::DidUpdateBackingStore(
1049 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, 839 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy,
1050 const std::vector<gfx::Rect>& copy_rects) { 840 const std::vector<gfx::Rect>& copy_rects) {
1051 if (is_hidden_) 841 if (is_hidden_)
1052 return; 842 return;
1053 843
1054 // Schedule invalidations first so that the ScrollWindowEx call is closer to 844 // Schedule invalidations first so that the ScrollWindowEx call is closer to
1055 // Redraw. That minimizes chances of "flicker" resulting if the screen 845 // Redraw. That minimizes chances of "flicker" resulting if the screen
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 2482
2693 // On Vista and later we present directly to the view window rather than a 2483 // On Vista and later we present directly to the view window rather than a
2694 // child window. 2484 // child window.
2695 if (GpuDataManagerImpl::GetInstance()->IsUsingAcceleratedSurface()) { 2485 if (GpuDataManagerImpl::GetInstance()->IsUsingAcceleratedSurface()) {
2696 if (!accelerated_surface_.get()) 2486 if (!accelerated_surface_.get())
2697 accelerated_surface_.reset(new AcceleratedSurface(m_hWnd)); 2487 accelerated_surface_.reset(new AcceleratedSurface(m_hWnd));
2698 return gfx::GLSurfaceHandle(m_hWnd, true); 2488 return gfx::GLSurfaceHandle(m_hWnd, true);
2699 } 2489 }
2700 2490
2701 // On XP we need a child window that can be resized independently of the 2491 // On XP we need a child window that can be resized independently of the
2702 // partent. 2492 // parent.
2703 static ATOM atom = 0; 2493 static ATOM atom = 0;
2704 static HMODULE instance = NULL; 2494 static HMODULE instance = NULL;
2705 if (!atom) { 2495 if (!atom) {
2706 WNDCLASSEX window_class; 2496 WNDCLASSEX window_class;
2707 base::win::InitializeWindowClass( 2497 base::win::InitializeWindowClass(
2708 L"CompositorHostWindowClass", 2498 L"CompositorHostWindowClass",
2709 &base::win::WrappedWindowProc<CompositorHostWindowProc>, 2499 &base::win::WrappedWindowProc<CompositorHostWindowProc>,
2710 0, 0, 0, NULL, NULL, NULL, NULL, NULL, 2500 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
2711 &window_class); 2501 &window_class);
2712 instance = window_class.hInstance; 2502 instance = window_class.hInstance;
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
3285 position->rcDocument = document_rect; 3075 position->rcDocument = document_rect;
3286 return 1; 3076 return 1;
3287 } 3077 }
3288 3078
3289 void RenderWidgetHostViewWin::UpdateIMEState() { 3079 void RenderWidgetHostViewWin::UpdateIMEState() {
3290 if (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE && 3080 if (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE &&
3291 text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD) { 3081 text_input_type_ != ui::TEXT_INPUT_TYPE_PASSWORD) {
3292 if (base::win::IsTsfAwareRequired()) { 3082 if (base::win::IsTsfAwareRequired()) {
3293 ui::TsfBridge::GetInstance()->EnableIME(); 3083 ui::TsfBridge::GetInstance()->EnableIME();
3294 } else { 3084 } else {
3295 ime_input_.EnableIME(m_hWnd); 3085 ime_input_.EnableIME(m_hWnd);
3296 } 3086 }
3297 } else { 3087 } else {
3298 if (base::win::IsTsfAwareRequired()) { 3088 if (base::win::IsTsfAwareRequired()) {
3299 ui::TsfBridge::GetInstance()->DisableIME(); 3089 ui::TsfBridge::GetInstance()->DisableIME();
3300 } else { 3090 } else {
3301 ime_input_.DisableIME(m_hWnd); 3091 ime_input_.DisableIME(m_hWnd);
3302 }
3303 } 3092 }
3304 } 3093 }
3094 }
3305 3095
3306 //////////////////////////////////////////////////////////////////////////////// 3096 ////////////////////////////////////////////////////////////////////////////////
3307 // RenderWidgetHostView, public: 3097 // RenderWidgetHostView, public:
3308 3098
3309 // static 3099 // static
3310 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( 3100 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
3311 RenderWidgetHost* widget) { 3101 RenderWidgetHost* widget) {
3312 return new RenderWidgetHostViewWin(widget); 3102 return new RenderWidgetHostViewWin(widget);
3313 } 3103 }
3314 3104
(...skipping 12 matching lines...) Expand all
3327 // receive a focus change in the context of a pointer down message, it means 3117 // receive a focus change in the context of a pointer down message, it means
3328 // that the pointer down message occurred on the edit field and we should 3118 // that the pointer down message occurred on the edit field and we should
3329 // display the on screen keyboard 3119 // display the on screen keyboard
3330 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) 3120 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_)
3331 DisplayOnScreenKeyboardIfNeeded(); 3121 DisplayOnScreenKeyboardIfNeeded();
3332 received_focus_change_after_pointer_down_ = false; 3122 received_focus_change_after_pointer_down_ = false;
3333 pointer_down_context_ = false; 3123 pointer_down_context_ = false;
3334 } 3124 }
3335 3125
3336 } // namespace content 3126 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.h ('k') | content/browser/renderer_host/test_render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698