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

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

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 8 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
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 <peninputpanel_i.c> 8 #include <peninputpanel_i.c>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 inline void SetTouchType(TOUCHINPUT* point, int type) { 300 inline void SetTouchType(TOUCHINPUT* point, int type) {
301 point->dwFlags = (point->dwFlags & kTouchMask) | type; 301 point->dwFlags = (point->dwFlags & kTouchMask) | type;
302 } 302 }
303 303
304 } // namespace 304 } // namespace
305 305
306 /////////////////////////////////////////////////////////////////////////////// 306 ///////////////////////////////////////////////////////////////////////////////
307 // RenderWidgetHostViewWin, public: 307 // RenderWidgetHostViewWin, public:
308 308
309 RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) 309 RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget)
310 : compositor_host_window_(NULL), 310 : render_widget_host_(RenderWidgetHostImpl::From(widget)),
311 compositor_host_window_(NULL),
311 hide_compositor_window_at_next_paint_(false), 312 hide_compositor_window_at_next_paint_(false),
312 track_mouse_leave_(false), 313 track_mouse_leave_(false),
313 ime_notification_(false), 314 ime_notification_(false),
314 capture_enter_key_(false), 315 capture_enter_key_(false),
315 is_hidden_(false), 316 is_hidden_(false),
316 about_to_validate_and_paint_(false), 317 about_to_validate_and_paint_(false),
317 close_on_deactivate_(false), 318 close_on_deactivate_(false),
318 being_destroyed_(false), 319 being_destroyed_(false),
319 tooltip_hwnd_(NULL), 320 tooltip_hwnd_(NULL),
320 tooltip_showing_(false), 321 tooltip_showing_(false),
321 weak_factory_(this), 322 weak_factory_(this),
322 parent_hwnd_(NULL), 323 parent_hwnd_(NULL),
323 is_loading_(false), 324 is_loading_(false),
324 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 325 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
325 is_fullscreen_(false), 326 is_fullscreen_(false),
326 ignore_mouse_movement_(true), 327 ignore_mouse_movement_(true),
327 composition_range_(ui::Range::InvalidRange()), 328 composition_range_(ui::Range::InvalidRange()),
328 touch_state_(this), 329 touch_state_(this),
329 pointer_down_context_(false), 330 pointer_down_context_(false),
330 focus_on_editable_field_(false), 331 focus_on_editable_field_(false),
331 received_focus_change_after_pointer_down_(false), 332 received_focus_change_after_pointer_down_(false),
332 transparent_region_(0), 333 transparent_region_(0),
333 touch_events_enabled_(false) { 334 touch_events_enabled_(false) {
334 render_widget_host_ = static_cast<RenderWidgetHostImpl*>(widget);
335 render_widget_host_->SetView(this); 335 render_widget_host_->SetView(this);
336 registrar_.Add(this, 336 registrar_.Add(this,
337 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 337 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
338 content::NotificationService::AllBrowserContextsAndSources()); 338 content::NotificationService::AllBrowserContextsAndSources());
339 registrar_.Add(this, 339 registrar_.Add(this,
340 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, 340 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE,
341 content::NotificationService::AllBrowserContextsAndSources()); 341 content::NotificationService::AllBrowserContextsAndSources());
342 } 342 }
343 343
344 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { 344 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() {
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 CleanupCompositorWindow(); 1029 CleanupCompositorWindow();
1030 1030
1031 ResetTooltip(); 1031 ResetTooltip();
1032 TrackMouseLeave(false); 1032 TrackMouseLeave(false);
1033 } 1033 }
1034 1034
1035 void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { 1035 void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) {
1036 if (!render_widget_host_) 1036 if (!render_widget_host_)
1037 return; 1037 return;
1038 1038
1039 DCHECK(render_widget_host_->process()->HasConnection()); 1039 DCHECK(render_widget_host_->GetProcess()->HasConnection());
1040 1040
1041 // If the GPU process is rendering directly into the View, compositing is 1041 // If the GPU process is rendering directly into the View, compositing is
1042 // already triggered by damage to compositor_host_window_, so all we need to 1042 // already triggered by damage to compositor_host_window_, so all we need to
1043 // do here is clear borders during resize. 1043 // do here is clear borders during resize.
1044 if (render_widget_host_->is_accelerated_compositing_active()) { 1044 if (render_widget_host_->is_accelerated_compositing_active()) {
1045 // We initialize paint_dc here so that BeginPaint()/EndPaint() 1045 // We initialize paint_dc here so that BeginPaint()/EndPaint()
1046 // get called to validate the region. 1046 // get called to validate the region.
1047 CPaintDC paint_dc(m_hWnd); 1047 CPaintDC paint_dc(m_hWnd);
1048 RECT host_rect, child_rect; 1048 RECT host_rect, child_rect;
1049 GetClientRect(&host_rect); 1049 GetClientRect(&host_rect);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 render_widget_host_->SetInputMethodActive(ime_status); 1306 render_widget_host_->SetInputMethodActive(ime_status);
1307 ime_notification_ = ime_status; 1307 ime_notification_ = ime_status;
1308 } 1308 }
1309 } 1309 }
1310 } 1310 }
1311 1311
1312 void RenderWidgetHostViewWin::OnThemeChanged() { 1312 void RenderWidgetHostViewWin::OnThemeChanged() {
1313 if (!render_widget_host_) 1313 if (!render_widget_host_)
1314 return; 1314 return;
1315 render_widget_host_->Send(new ViewMsg_ThemeChanged( 1315 render_widget_host_->Send(new ViewMsg_ThemeChanged(
1316 render_widget_host_->routing_id())); 1316 render_widget_host_->GetRoutingID()));
1317 } 1317 }
1318 1318
1319 LRESULT RenderWidgetHostViewWin::OnNotify(int w_param, NMHDR* header) { 1319 LRESULT RenderWidgetHostViewWin::OnNotify(int w_param, NMHDR* header) {
1320 if (tooltip_hwnd_ == NULL) 1320 if (tooltip_hwnd_ == NULL)
1321 return 0; 1321 return 0;
1322 1322
1323 switch (header->code) { 1323 switch (header->code) {
1324 case TTN_GETDISPINFO: { 1324 case TTN_GETDISPINFO: {
1325 NMTTDISPINFOW* tooltip_info = reinterpret_cast<NMTTDISPINFOW*>(header); 1325 NMTTDISPINFOW* tooltip_info = reinterpret_cast<NMTTDISPINFOW*>(header);
1326 tooltip_info->szText[0] = L'\0'; 1326 tooltip_info->szText[0] = L'\0';
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 DWORD error = GetLastError(); 1923 DWORD error = GetLastError();
1924 NOTREACHED() << "Unable to get gesture info. Error : " << error; 1924 NOTREACHED() << "Unable to get gesture info. Error : " << error;
1925 return 0; 1925 return 0;
1926 } 1926 }
1927 1927
1928 if (gi.dwID == GID_ZOOM) { 1928 if (gi.dwID == GID_ZOOM) {
1929 content::PageZoom zoom = content::PAGE_ZOOM_RESET; 1929 content::PageZoom zoom = content::PAGE_ZOOM_RESET;
1930 POINT zoom_center = {0}; 1930 POINT zoom_center = {0};
1931 if (DecodeZoomGesture(m_hWnd, gi, &zoom, &zoom_center)) { 1931 if (DecodeZoomGesture(m_hWnd, gi, &zoom, &zoom_center)) {
1932 handled = TRUE; 1932 handled = TRUE;
1933 Send(new ViewMsg_ZoomFactor(render_widget_host_->routing_id(), 1933 Send(new ViewMsg_ZoomFactor(render_widget_host_->GetRoutingID(),
1934 zoom, zoom_center.x, zoom_center.y)); 1934 zoom, zoom_center.x, zoom_center.y));
1935 } 1935 }
1936 } else if (gi.dwID == GID_PAN) { 1936 } else if (gi.dwID == GID_PAN) {
1937 // Right now we only decode scroll gestures and we forward to the page 1937 // Right now we only decode scroll gestures and we forward to the page
1938 // as scroll events. 1938 // as scroll events.
1939 POINT start; 1939 POINT start;
1940 POINT delta; 1940 POINT delta;
1941 if (DecodeScrollGesture(gi, &start, &delta)) { 1941 if (DecodeScrollGesture(gi, &start, &delta)) {
1942 handled = TRUE; 1942 handled = TRUE;
1943 render_widget_host_->ForwardWheelEvent( 1943 render_widget_host_->ForwardWheelEvent(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 focus_on_editable_field_ = *content::Details<bool>(details).ptr(); 2035 focus_on_editable_field_ = *content::Details<bool>(details).ptr();
2036 if (virtual_keyboard_) 2036 if (virtual_keyboard_)
2037 DisplayOnScreenKeyboardIfNeeded(); 2037 DisplayOnScreenKeyboardIfNeeded();
2038 } else { 2038 } else {
2039 // Get the RenderProcessHost that posted this notification, and exit 2039 // Get the RenderProcessHost that posted this notification, and exit
2040 // if it's not the one associated with this host view. 2040 // if it's not the one associated with this host view.
2041 content::RenderProcessHost* render_process_host = 2041 content::RenderProcessHost* render_process_host =
2042 content::Source<content::RenderProcessHost>(source).ptr(); 2042 content::Source<content::RenderProcessHost>(source).ptr();
2043 DCHECK(render_process_host); 2043 DCHECK(render_process_host);
2044 if (!render_widget_host_ || 2044 if (!render_widget_host_ ||
2045 render_process_host != render_widget_host_->process()) 2045 render_process_host != render_widget_host_->GetProcess())
2046 return; 2046 return;
2047 2047
2048 // If it was our RenderProcessHost that posted the notification, 2048 // If it was our RenderProcessHost that posted the notification,
2049 // clear the BrowserAccessibilityManager, because the renderer is 2049 // clear the BrowserAccessibilityManager, because the renderer is
2050 // dead and any accessibility information we have is now stale. 2050 // dead and any accessibility information we have is now stale.
2051 SetBrowserAccessibilityManager(NULL); 2051 SetBrowserAccessibilityManager(NULL);
2052 } 2052 }
2053 } 2053 }
2054 2054
2055 static void PaintCompositorHostWindow(HWND hWnd) { 2055 static void PaintCompositorHostWindow(HWND hWnd) {
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 void RenderWidgetHostViewWin::ResetPointerDownContext() { 2652 void RenderWidgetHostViewWin::ResetPointerDownContext() {
2653 // If the default focus on the page is on an edit field and we did not 2653 // If the default focus on the page is on an edit field and we did not
2654 // receive a focus change in the context of a pointer down message, it means 2654 // receive a focus change in the context of a pointer down message, it means
2655 // that the pointer down message occurred on the edit field and we should 2655 // that the pointer down message occurred on the edit field and we should
2656 // display the on screen keyboard 2656 // display the on screen keyboard
2657 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) 2657 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_)
2658 DisplayOnScreenKeyboardIfNeeded(); 2658 DisplayOnScreenKeyboardIfNeeded();
2659 received_focus_change_after_pointer_down_ = false; 2659 received_focus_change_after_pointer_down_ = false;
2660 pointer_down_context_ = false; 2660 pointer_down_context_ = false;
2661 } 2661 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698