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

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

Issue 11412315: Make the cursor have separate mode for disabled mouse events and invisible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years 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 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 return false; 1088 return false;
1089 1089
1090 if (mouse_locked_) 1090 if (mouse_locked_)
1091 return true; 1091 return true;
1092 1092
1093 mouse_locked_ = true; 1093 mouse_locked_ = true;
1094 window_->SetCapture(); 1094 window_->SetCapture();
1095 aura::client::CursorClient* cursor_client = 1095 aura::client::CursorClient* cursor_client =
1096 aura::client::GetCursorClient(root_window); 1096 aura::client::GetCursorClient(root_window);
1097 if (cursor_client) 1097 if (cursor_client)
1098 cursor_client->ShowCursor(false); 1098 cursor_client->EnableCursor(false);
1099 synthetic_move_sent_ = true; 1099 synthetic_move_sent_ = true;
1100 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); 1100 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint());
1101 if (aura::client::GetTooltipClient(root_window)) 1101 if (aura::client::GetTooltipClient(root_window))
1102 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); 1102 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false);
1103 return true; 1103 return true;
1104 } 1104 }
1105 1105
1106 void RenderWidgetHostViewAura::UnlockMouse() { 1106 void RenderWidgetHostViewAura::UnlockMouse() {
1107 aura::RootWindow* root_window = window_->GetRootWindow(); 1107 aura::RootWindow* root_window = window_->GetRootWindow();
1108 if (!mouse_locked_ || !root_window) 1108 if (!mouse_locked_ || !root_window)
1109 return; 1109 return;
1110 1110
1111 mouse_locked_ = false; 1111 mouse_locked_ = false;
1112 1112
1113 window_->ReleaseCapture(); 1113 window_->ReleaseCapture();
1114 window_->MoveCursorTo(unlocked_mouse_position_); 1114 window_->MoveCursorTo(unlocked_mouse_position_);
1115 aura::client::CursorClient* cursor_client = 1115 aura::client::CursorClient* cursor_client =
1116 aura::client::GetCursorClient(root_window); 1116 aura::client::GetCursorClient(root_window);
1117 if (cursor_client) 1117 if (cursor_client)
1118 cursor_client->ShowCursor(true); 1118 cursor_client->EnableCursor(true);
1119 if (aura::client::GetTooltipClient(root_window)) 1119 if (aura::client::GetTooltipClient(root_window))
1120 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); 1120 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true);
1121 1121
1122 host_->LostMouseLock(); 1122 host_->LostMouseLock();
1123 } 1123 }
1124 1124
1125 //////////////////////////////////////////////////////////////////////////////// 1125 ////////////////////////////////////////////////////////////////////////////////
1126 // RenderWidgetHostViewAura, ui::TextInputClient implementation: 1126 // RenderWidgetHostViewAura, ui::TextInputClient implementation:
1127 void RenderWidgetHostViewAura::SetCompositionText( 1127 void RenderWidgetHostViewAura::SetCompositionText(
1128 const ui::CompositionText& composition) { 1128 const ui::CompositionText& composition) {
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 } 1501 }
1502 1502
1503 ui::EventResult RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { 1503 ui::EventResult RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) {
1504 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); 1504 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent");
1505 1505
1506 if (mouse_locked_) { 1506 if (mouse_locked_) {
1507 // Hide the cursor if someone else has shown it. 1507 // Hide the cursor if someone else has shown it.
1508 aura::client::CursorClient* cursor_client = 1508 aura::client::CursorClient* cursor_client =
1509 aura::client::GetCursorClient(window_->GetRootWindow()); 1509 aura::client::GetCursorClient(window_->GetRootWindow());
1510 if (cursor_client && cursor_client->IsCursorVisible()) 1510 if (cursor_client && cursor_client->IsCursorVisible())
1511 cursor_client->ShowCursor(false); 1511 cursor_client->EnableCursor(false);
1512 1512
1513 WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); 1513 WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event);
1514 gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); 1514 gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint());
1515 1515
1516 bool is_move_to_center_event = (event->type() == ui::ET_MOUSE_MOVED || 1516 bool is_move_to_center_event = (event->type() == ui::ET_MOUSE_MOVED ||
1517 event->type() == ui::ET_MOUSE_DRAGGED) && 1517 event->type() == ui::ET_MOUSE_DRAGGED) &&
1518 mouse_event.x == center.x() && mouse_event.y == center.y(); 1518 mouse_event.x == center.x() && mouse_event.y == center.y();
1519 1519
1520 ModifyEventMovementAndCoords(&mouse_event); 1520 ModifyEventMovementAndCoords(&mouse_event);
1521 1521
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 RenderWidgetHost* widget) { 1992 RenderWidgetHost* widget) {
1993 return new RenderWidgetHostViewAura(widget); 1993 return new RenderWidgetHostViewAura(widget);
1994 } 1994 }
1995 1995
1996 // static 1996 // static
1997 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1997 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1998 GetScreenInfoForWindow(results, NULL); 1998 GetScreenInfoForWindow(results, NULL);
1999 } 1999 }
2000 2000
2001 } // namespace content 2001 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698