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

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

Issue 11888003: Differentiate invisible cursor mode and disabled mouse events mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rewrote tests using EventGenerator Created 7 years, 11 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_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 return; 1005 return;
1006 --render_widget_host_view->pending_thumbnail_tasks_; 1006 --render_widget_host_view->pending_thumbnail_tasks_;
1007 } 1007 }
1008 1008
1009 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { 1009 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) {
1010 RenderWidgetHostViewBase::SetBackground(background); 1010 RenderWidgetHostViewBase::SetBackground(background);
1011 host_->SetBackground(background); 1011 host_->SetBackground(background);
1012 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); 1012 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque());
1013 } 1013 }
1014 1014
1015 void RenderWidgetHostViewAura::ScrollOffsetChanged(
1016 const gfx::Vector2d& offset) {
1017 aura::client::CursorClient* cursor_client =
1018 aura::client::GetCursorClient(window_->GetRootWindow());
1019 if (cursor_client && !cursor_client->IsCursorVisible())
1020 cursor_client->DisableMouseEvents();
1021 }
1022
1015 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { 1023 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) {
1016 GetScreenInfoForWindow(results, window_); 1024 GetScreenInfoForWindow(results, window_);
1017 } 1025 }
1018 1026
1019 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { 1027 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() {
1020 return window_->GetToplevelWindow()->GetBoundsInScreen(); 1028 return window_->GetToplevelWindow()->GetBoundsInScreen();
1021 } 1029 }
1022 1030
1023 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( 1031 void RenderWidgetHostViewAura::ProcessAckedTouchEvent(
1024 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { 1032 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 return false; 1072 return false;
1065 1073
1066 if (mouse_locked_) 1074 if (mouse_locked_)
1067 return true; 1075 return true;
1068 1076
1069 mouse_locked_ = true; 1077 mouse_locked_ = true;
1070 window_->SetCapture(); 1078 window_->SetCapture();
1071 aura::client::CursorClient* cursor_client = 1079 aura::client::CursorClient* cursor_client =
1072 aura::client::GetCursorClient(root_window); 1080 aura::client::GetCursorClient(root_window);
1073 if (cursor_client) 1081 if (cursor_client)
1074 cursor_client->DisableMouseEvents(); 1082 cursor_client->HideCursor();
1075 synthetic_move_sent_ = true; 1083 synthetic_move_sent_ = true;
1076 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); 1084 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint());
1077 if (aura::client::GetTooltipClient(root_window)) 1085 if (aura::client::GetTooltipClient(root_window))
1078 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); 1086 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false);
1079 return true; 1087 return true;
1080 } 1088 }
1081 1089
1082 void RenderWidgetHostViewAura::UnlockMouse() { 1090 void RenderWidgetHostViewAura::UnlockMouse() {
1083 aura::RootWindow* root_window = window_->GetRootWindow(); 1091 aura::RootWindow* root_window = window_->GetRootWindow();
1084 if (!mouse_locked_ || !root_window) 1092 if (!mouse_locked_ || !root_window)
1085 return; 1093 return;
1086 1094
1087 mouse_locked_ = false; 1095 mouse_locked_ = false;
1088 1096
1089 window_->ReleaseCapture(); 1097 window_->ReleaseCapture();
1090 window_->MoveCursorTo(unlocked_mouse_position_); 1098 window_->MoveCursorTo(unlocked_mouse_position_);
1091 aura::client::CursorClient* cursor_client = 1099 aura::client::CursorClient* cursor_client =
1092 aura::client::GetCursorClient(root_window); 1100 aura::client::GetCursorClient(root_window);
1093 if (cursor_client) 1101 if (cursor_client)
1094 cursor_client->EnableMouseEvents(); 1102 cursor_client->ShowCursor();
1095 if (aura::client::GetTooltipClient(root_window)) 1103 if (aura::client::GetTooltipClient(root_window))
1096 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); 1104 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true);
1097 1105
1098 host_->LostMouseLock(); 1106 host_->LostMouseLock();
1099 } 1107 }
1100 1108
1101 //////////////////////////////////////////////////////////////////////////////// 1109 ////////////////////////////////////////////////////////////////////////////////
1102 // RenderWidgetHostViewAura, ui::TextInputClient implementation: 1110 // RenderWidgetHostViewAura, ui::TextInputClient implementation:
1103 void RenderWidgetHostViewAura::SetCompositionText( 1111 void RenderWidgetHostViewAura::SetCompositionText(
1104 const ui::CompositionText& composition) { 1112 const ui::CompositionText& composition) {
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 RenderWidgetHost* widget) { 1997 RenderWidgetHost* widget) {
1990 return new RenderWidgetHostViewAura(widget); 1998 return new RenderWidgetHostViewAura(widget);
1991 } 1999 }
1992 2000
1993 // static 2001 // static
1994 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 2002 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1995 GetScreenInfoForWindow(results, NULL); 2003 GetScreenInfoForWindow(results, NULL);
1996 } 2004 }
1997 2005
1998 } // namespace content 2006 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698