OLD | NEW |
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 Loading... |
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->DisableMouseEvents(); |
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->EnableMouseEvents(); |
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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 } | 1503 } |
1504 | 1504 |
1505 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { | 1505 void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { |
1506 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); | 1506 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnMouseEvent"); |
1507 | 1507 |
1508 if (mouse_locked_) { | 1508 if (mouse_locked_) { |
1509 // Hide the cursor if someone else has shown it. | 1509 // Hide the cursor if someone else has shown it. |
1510 aura::client::CursorClient* cursor_client = | 1510 aura::client::CursorClient* cursor_client = |
1511 aura::client::GetCursorClient(window_->GetRootWindow()); | 1511 aura::client::GetCursorClient(window_->GetRootWindow()); |
1512 if (cursor_client && cursor_client->IsCursorVisible()) | 1512 if (cursor_client && cursor_client->IsCursorVisible()) |
1513 cursor_client->ShowCursor(false); | 1513 cursor_client->DisableMouseEvents(); |
1514 | 1514 |
1515 WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); | 1515 WebKit::WebMouseEvent mouse_event = MakeWebMouseEvent(event); |
1516 gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); | 1516 gfx::Point center(gfx::Rect(window_->bounds().size()).CenterPoint()); |
1517 | 1517 |
1518 bool is_move_to_center_event = (event->type() == ui::ET_MOUSE_MOVED || | 1518 bool is_move_to_center_event = (event->type() == ui::ET_MOUSE_MOVED || |
1519 event->type() == ui::ET_MOUSE_DRAGGED) && | 1519 event->type() == ui::ET_MOUSE_DRAGGED) && |
1520 mouse_event.x == center.x() && mouse_event.y == center.y(); | 1520 mouse_event.x == center.x() && mouse_event.y == center.y(); |
1521 | 1521 |
1522 ModifyEventMovementAndCoords(&mouse_event); | 1522 ModifyEventMovementAndCoords(&mouse_event); |
1523 | 1523 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 RenderWidgetHost* widget) { | 1996 RenderWidgetHost* widget) { |
1997 return new RenderWidgetHostViewAura(widget); | 1997 return new RenderWidgetHostViewAura(widget); |
1998 } | 1998 } |
1999 | 1999 |
2000 // static | 2000 // static |
2001 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2001 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
2002 GetScreenInfoForWindow(results, NULL); | 2002 GetScreenInfoForWindow(results, NULL); |
2003 } | 2003 } |
2004 | 2004 |
2005 } // namespace content | 2005 } // namespace content |
OLD | NEW |