| 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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 return; | 1012 return; |
| 1013 --render_widget_host_view->pending_thumbnail_tasks_; | 1013 --render_widget_host_view->pending_thumbnail_tasks_; |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { | 1016 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { |
| 1017 RenderWidgetHostViewBase::SetBackground(background); | 1017 RenderWidgetHostViewBase::SetBackground(background); |
| 1018 host_->SetBackground(background); | 1018 host_->SetBackground(background); |
| 1019 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); | 1019 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 void RenderWidgetHostViewAura::ScrollOffsetChanged( |
| 1023 const gfx::Vector2d& offset) { |
| 1024 aura::client::CursorClient* cursor_client = |
| 1025 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 1026 if (cursor_client && !cursor_client->IsCursorVisible()) |
| 1027 cursor_client->DisableMouseEvents(); |
| 1028 } |
| 1029 |
| 1022 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { | 1030 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { |
| 1023 GetScreenInfoForWindow(results, window_); | 1031 GetScreenInfoForWindow(results, window_); |
| 1024 } | 1032 } |
| 1025 | 1033 |
| 1026 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { | 1034 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { |
| 1027 return window_->GetToplevelWindow()->GetBoundsInScreen(); | 1035 return window_->GetToplevelWindow()->GetBoundsInScreen(); |
| 1028 } | 1036 } |
| 1029 | 1037 |
| 1030 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1038 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
| 1031 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { | 1039 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 return false; | 1079 return false; |
| 1072 | 1080 |
| 1073 if (mouse_locked_) | 1081 if (mouse_locked_) |
| 1074 return true; | 1082 return true; |
| 1075 | 1083 |
| 1076 mouse_locked_ = true; | 1084 mouse_locked_ = true; |
| 1077 window_->SetCapture(); | 1085 window_->SetCapture(); |
| 1078 aura::client::CursorClient* cursor_client = | 1086 aura::client::CursorClient* cursor_client = |
| 1079 aura::client::GetCursorClient(root_window); | 1087 aura::client::GetCursorClient(root_window); |
| 1080 if (cursor_client) | 1088 if (cursor_client) |
| 1081 cursor_client->DisableMouseEvents(); | 1089 cursor_client->HideCursor(); |
| 1082 synthetic_move_sent_ = true; | 1090 synthetic_move_sent_ = true; |
| 1083 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); | 1091 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); |
| 1084 if (aura::client::GetTooltipClient(root_window)) | 1092 if (aura::client::GetTooltipClient(root_window)) |
| 1085 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); | 1093 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); |
| 1086 return true; | 1094 return true; |
| 1087 } | 1095 } |
| 1088 | 1096 |
| 1089 void RenderWidgetHostViewAura::UnlockMouse() { | 1097 void RenderWidgetHostViewAura::UnlockMouse() { |
| 1090 aura::RootWindow* root_window = window_->GetRootWindow(); | 1098 aura::RootWindow* root_window = window_->GetRootWindow(); |
| 1091 if (!mouse_locked_ || !root_window) | 1099 if (!mouse_locked_ || !root_window) |
| 1092 return; | 1100 return; |
| 1093 | 1101 |
| 1094 mouse_locked_ = false; | 1102 mouse_locked_ = false; |
| 1095 | 1103 |
| 1096 window_->ReleaseCapture(); | 1104 window_->ReleaseCapture(); |
| 1097 window_->MoveCursorTo(unlocked_mouse_position_); | 1105 window_->MoveCursorTo(unlocked_mouse_position_); |
| 1098 aura::client::CursorClient* cursor_client = | 1106 aura::client::CursorClient* cursor_client = |
| 1099 aura::client::GetCursorClient(root_window); | 1107 aura::client::GetCursorClient(root_window); |
| 1100 if (cursor_client) | 1108 if (cursor_client) |
| 1101 cursor_client->EnableMouseEvents(); | 1109 cursor_client->ShowCursor(); |
| 1102 if (aura::client::GetTooltipClient(root_window)) | 1110 if (aura::client::GetTooltipClient(root_window)) |
| 1103 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); | 1111 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); |
| 1104 | 1112 |
| 1105 host_->LostMouseLock(); | 1113 host_->LostMouseLock(); |
| 1106 } | 1114 } |
| 1107 | 1115 |
| 1108 //////////////////////////////////////////////////////////////////////////////// | 1116 //////////////////////////////////////////////////////////////////////////////// |
| 1109 // RenderWidgetHostViewAura, ui::TextInputClient implementation: | 1117 // RenderWidgetHostViewAura, ui::TextInputClient implementation: |
| 1110 void RenderWidgetHostViewAura::SetCompositionText( | 1118 void RenderWidgetHostViewAura::SetCompositionText( |
| 1111 const ui::CompositionText& composition) { | 1119 const ui::CompositionText& composition) { |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 RenderWidgetHost* widget) { | 2004 RenderWidgetHost* widget) { |
| 1997 return new RenderWidgetHostViewAura(widget); | 2005 return new RenderWidgetHostViewAura(widget); |
| 1998 } | 2006 } |
| 1999 | 2007 |
| 2000 // static | 2008 // static |
| 2001 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2009 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2002 GetScreenInfoForWindow(results, NULL); | 2010 GetScreenInfoForWindow(results, NULL); |
| 2003 } | 2011 } |
| 2004 | 2012 |
| 2005 } // namespace content | 2013 } // namespace content |
| OLD | NEW |