| 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "media/base/video_util.h" | 46 #include "media/base/video_util.h" |
| 47 #include "skia/ext/image_operations.h" | 47 #include "skia/ext/image_operations.h" |
| 48 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 48 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
| 49 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 49 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
| 50 #include "third_party/WebKit/public/web/WebInputEvent.h" | 50 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 51 #include "ui/aura/client/activation_client.h" | 51 #include "ui/aura/client/activation_client.h" |
| 52 #include "ui/aura/client/aura_constants.h" | 52 #include "ui/aura/client/aura_constants.h" |
| 53 #include "ui/aura/client/cursor_client.h" | 53 #include "ui/aura/client/cursor_client.h" |
| 54 #include "ui/aura/client/cursor_client_observer.h" | 54 #include "ui/aura/client/cursor_client_observer.h" |
| 55 #include "ui/aura/client/focus_client.h" | 55 #include "ui/aura/client/focus_client.h" |
| 56 #include "ui/aura/client/scoped_tooltip_disabler.h" |
| 56 #include "ui/aura/client/screen_position_client.h" | 57 #include "ui/aura/client/screen_position_client.h" |
| 57 #include "ui/aura/client/tooltip_client.h" | 58 #include "ui/aura/client/tooltip_client.h" |
| 58 #include "ui/aura/client/window_tree_client.h" | 59 #include "ui/aura/client/window_tree_client.h" |
| 59 #include "ui/aura/env.h" | 60 #include "ui/aura/env.h" |
| 60 #include "ui/aura/root_window.h" | 61 #include "ui/aura/root_window.h" |
| 61 #include "ui/aura/window.h" | 62 #include "ui/aura/window.h" |
| 62 #include "ui/aura/window_observer.h" | 63 #include "ui/aura/window_observer.h" |
| 63 #include "ui/aura/window_tracker.h" | 64 #include "ui/aura/window_tracker.h" |
| 64 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 65 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 65 #include "ui/base/hit_test.h" | 66 #include "ui/base/hit_test.h" |
| (...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2172 aura::client::GetCursorClient(root_window); | 2173 aura::client::GetCursorClient(root_window); |
| 2173 if (cursor_client) { | 2174 if (cursor_client) { |
| 2174 cursor_client->HideCursor(); | 2175 cursor_client->HideCursor(); |
| 2175 cursor_client->LockCursor(); | 2176 cursor_client->LockCursor(); |
| 2176 } | 2177 } |
| 2177 | 2178 |
| 2178 if (ShouldMoveToCenter()) { | 2179 if (ShouldMoveToCenter()) { |
| 2179 synthetic_move_sent_ = true; | 2180 synthetic_move_sent_ = true; |
| 2180 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); | 2181 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); |
| 2181 } | 2182 } |
| 2182 if (aura::client::GetTooltipClient(root_window)) | 2183 tooltip_disabler_.reset(new aura::client::ScopedTooltipDisabler(root_window)); |
| 2183 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); | |
| 2184 | 2184 |
| 2185 root_window->GetDispatcher()->host()->ConfineCursorToRootWindow(); | 2185 root_window->GetDispatcher()->host()->ConfineCursorToRootWindow(); |
| 2186 return true; | 2186 return true; |
| 2187 } | 2187 } |
| 2188 | 2188 |
| 2189 void RenderWidgetHostViewAura::UnlockMouse() { | 2189 void RenderWidgetHostViewAura::UnlockMouse() { |
| 2190 tooltip_disabler_.reset(); |
| 2191 |
| 2190 aura::Window* root_window = window_->GetRootWindow(); | 2192 aura::Window* root_window = window_->GetRootWindow(); |
| 2191 if (!mouse_locked_ || !root_window) | 2193 if (!mouse_locked_ || !root_window) |
| 2192 return; | 2194 return; |
| 2193 | 2195 |
| 2194 mouse_locked_ = false; | 2196 mouse_locked_ = false; |
| 2195 | 2197 |
| 2196 #if !defined(OS_WIN) | 2198 #if !defined(OS_WIN) |
| 2197 window_->ReleaseCapture(); | 2199 window_->ReleaseCapture(); |
| 2198 #endif | 2200 #endif |
| 2199 window_->MoveCursorTo(unlocked_mouse_position_); | 2201 window_->MoveCursorTo(unlocked_mouse_position_); |
| 2200 aura::client::CursorClient* cursor_client = | 2202 aura::client::CursorClient* cursor_client = |
| 2201 aura::client::GetCursorClient(root_window); | 2203 aura::client::GetCursorClient(root_window); |
| 2202 if (cursor_client) { | 2204 if (cursor_client) { |
| 2203 cursor_client->UnlockCursor(); | 2205 cursor_client->UnlockCursor(); |
| 2204 cursor_client->ShowCursor(); | 2206 cursor_client->ShowCursor(); |
| 2205 } | 2207 } |
| 2206 | 2208 |
| 2207 if (aura::client::GetTooltipClient(root_window)) | |
| 2208 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); | |
| 2209 | |
| 2210 host_->LostMouseLock(); | 2209 host_->LostMouseLock(); |
| 2211 root_window->GetDispatcher()->host()->UnConfineCursor(); | 2210 root_window->GetDispatcher()->host()->UnConfineCursor(); |
| 2212 } | 2211 } |
| 2213 | 2212 |
| 2214 //////////////////////////////////////////////////////////////////////////////// | 2213 //////////////////////////////////////////////////////////////////////////////// |
| 2215 // RenderWidgetHostViewAura, ui::TextInputClient implementation: | 2214 // RenderWidgetHostViewAura, ui::TextInputClient implementation: |
| 2216 void RenderWidgetHostViewAura::SetCompositionText( | 2215 void RenderWidgetHostViewAura::SetCompositionText( |
| 2217 const ui::CompositionText& composition) { | 2216 const ui::CompositionText& composition) { |
| 2218 if (!host_) | 2217 if (!host_) |
| 2219 return; | 2218 return; |
| (...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3488 RenderWidgetHost* widget) { | 3487 RenderWidgetHost* widget) { |
| 3489 return new RenderWidgetHostViewAura(widget); | 3488 return new RenderWidgetHostViewAura(widget); |
| 3490 } | 3489 } |
| 3491 | 3490 |
| 3492 // static | 3491 // static |
| 3493 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3492 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3494 GetScreenInfoForWindow(results, NULL); | 3493 GetScreenInfoForWindow(results, NULL); |
| 3495 } | 3494 } |
| 3496 | 3495 |
| 3497 } // namespace content | 3496 } // namespace content |
| OLD | NEW |