| 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 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 return; | 1025 return; |
| 1026 --render_widget_host_view->pending_thumbnail_tasks_; | 1026 --render_widget_host_view->pending_thumbnail_tasks_; |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { | 1029 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { |
| 1030 RenderWidgetHostViewBase::SetBackground(background); | 1030 RenderWidgetHostViewBase::SetBackground(background); |
| 1031 host_->SetBackground(background); | 1031 host_->SetBackground(background); |
| 1032 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); | 1032 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 void RenderWidgetHostViewAura::ScrollOffsetChanged() { |
| 1036 aura::RootWindow* root = window_->GetRootWindow(); |
| 1037 if (!root) |
| 1038 return; |
| 1039 aura::client::CursorClient* cursor_client = |
| 1040 aura::client::GetCursorClient(root); |
| 1041 if (cursor_client && !cursor_client->IsCursorVisible()) |
| 1042 cursor_client->DisableMouseEvents(); |
| 1043 } |
| 1044 |
| 1035 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { | 1045 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { |
| 1036 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); | 1046 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); |
| 1037 } | 1047 } |
| 1038 | 1048 |
| 1039 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { | 1049 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { |
| 1040 return window_->GetToplevelWindow()->GetBoundsInScreen(); | 1050 return window_->GetToplevelWindow()->GetBoundsInScreen(); |
| 1041 } | 1051 } |
| 1042 | 1052 |
| 1043 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1053 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
| 1044 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { | 1054 const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 return false; | 1094 return false; |
| 1085 | 1095 |
| 1086 if (mouse_locked_) | 1096 if (mouse_locked_) |
| 1087 return true; | 1097 return true; |
| 1088 | 1098 |
| 1089 mouse_locked_ = true; | 1099 mouse_locked_ = true; |
| 1090 window_->SetCapture(); | 1100 window_->SetCapture(); |
| 1091 aura::client::CursorClient* cursor_client = | 1101 aura::client::CursorClient* cursor_client = |
| 1092 aura::client::GetCursorClient(root_window); | 1102 aura::client::GetCursorClient(root_window); |
| 1093 if (cursor_client) | 1103 if (cursor_client) |
| 1094 cursor_client->DisableMouseEvents(); | 1104 cursor_client->HideCursor(); |
| 1095 synthetic_move_sent_ = true; | 1105 synthetic_move_sent_ = true; |
| 1096 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); | 1106 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); |
| 1097 if (aura::client::GetTooltipClient(root_window)) | 1107 if (aura::client::GetTooltipClient(root_window)) |
| 1098 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); | 1108 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); |
| 1099 return true; | 1109 return true; |
| 1100 } | 1110 } |
| 1101 | 1111 |
| 1102 void RenderWidgetHostViewAura::UnlockMouse() { | 1112 void RenderWidgetHostViewAura::UnlockMouse() { |
| 1103 aura::RootWindow* root_window = window_->GetRootWindow(); | 1113 aura::RootWindow* root_window = window_->GetRootWindow(); |
| 1104 if (!mouse_locked_ || !root_window) | 1114 if (!mouse_locked_ || !root_window) |
| 1105 return; | 1115 return; |
| 1106 | 1116 |
| 1107 mouse_locked_ = false; | 1117 mouse_locked_ = false; |
| 1108 | 1118 |
| 1109 window_->ReleaseCapture(); | 1119 window_->ReleaseCapture(); |
| 1110 window_->MoveCursorTo(unlocked_mouse_position_); | 1120 window_->MoveCursorTo(unlocked_mouse_position_); |
| 1111 aura::client::CursorClient* cursor_client = | 1121 aura::client::CursorClient* cursor_client = |
| 1112 aura::client::GetCursorClient(root_window); | 1122 aura::client::GetCursorClient(root_window); |
| 1113 if (cursor_client) | 1123 if (cursor_client) |
| 1114 cursor_client->EnableMouseEvents(); | 1124 cursor_client->ShowCursor(); |
| 1115 if (aura::client::GetTooltipClient(root_window)) | 1125 if (aura::client::GetTooltipClient(root_window)) |
| 1116 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); | 1126 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); |
| 1117 | 1127 |
| 1118 host_->LostMouseLock(); | 1128 host_->LostMouseLock(); |
| 1119 } | 1129 } |
| 1120 | 1130 |
| 1121 //////////////////////////////////////////////////////////////////////////////// | 1131 //////////////////////////////////////////////////////////////////////////////// |
| 1122 // RenderWidgetHostViewAura, ui::TextInputClient implementation: | 1132 // RenderWidgetHostViewAura, ui::TextInputClient implementation: |
| 1123 void RenderWidgetHostViewAura::SetCompositionText( | 1133 void RenderWidgetHostViewAura::SetCompositionText( |
| 1124 const ui::CompositionText& composition) { | 1134 const ui::CompositionText& composition) { |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2033 RenderWidgetHost* widget) { | 2043 RenderWidgetHost* widget) { |
| 2034 return new RenderWidgetHostViewAura(widget); | 2044 return new RenderWidgetHostViewAura(widget); |
| 2035 } | 2045 } |
| 2036 | 2046 |
| 2037 // static | 2047 // static |
| 2038 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2048 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2039 GetScreenInfoForWindow(results, NULL); | 2049 GetScreenInfoForWindow(results, NULL); |
| 2040 } | 2050 } |
| 2041 | 2051 |
| 2042 } // namespace content | 2052 } // namespace content |
| OLD | NEW |