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 10 matching lines...) Expand all Loading... |
21 #include "content/common/gpu/gpu_messages.h" | 21 #include "content/common/gpu/gpu_messages.h" |
22 #include "content/port/browser/render_widget_host_view_port.h" | 22 #include "content/port/browser/render_widget_host_view_port.h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
26 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
30 #include "ui/aura/client/aura_constants.h" | 30 #include "ui/aura/client/aura_constants.h" |
| 31 #include "ui/aura/client/cursor_client.h" |
31 #include "ui/aura/client/screen_position_client.h" | 32 #include "ui/aura/client/screen_position_client.h" |
32 #include "ui/aura/client/tooltip_client.h" | 33 #include "ui/aura/client/tooltip_client.h" |
33 #include "ui/aura/client/window_types.h" | 34 #include "ui/aura/client/window_types.h" |
34 #include "ui/aura/cursor_manager.h" | |
35 #include "ui/aura/env.h" | 35 #include "ui/aura/env.h" |
36 #include "ui/aura/event.h" | 36 #include "ui/aura/event.h" |
37 #include "ui/aura/root_window.h" | 37 #include "ui/aura/root_window.h" |
38 #include "ui/aura/window.h" | 38 #include "ui/aura/window.h" |
39 #include "ui/aura/window_observer.h" | 39 #include "ui/aura/window_observer.h" |
40 #include "ui/base/gestures/gesture_recognizer.h" | 40 #include "ui/base/gestures/gesture_recognizer.h" |
41 #include "ui/base/hit_test.h" | 41 #include "ui/base/hit_test.h" |
42 #include "ui/base/ime/input_method.h" | 42 #include "ui/base/ime/input_method.h" |
43 #include "ui/base/ui_base_types.h" | 43 #include "ui/base/ui_base_types.h" |
44 #include "ui/compositor/compositor.h" | 44 #include "ui/compositor/compositor.h" |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 bool RenderWidgetHostViewAura::LockMouse() { | 737 bool RenderWidgetHostViewAura::LockMouse() { |
738 aura::RootWindow* root_window = window_->GetRootWindow(); | 738 aura::RootWindow* root_window = window_->GetRootWindow(); |
739 if (!root_window) | 739 if (!root_window) |
740 return false; | 740 return false; |
741 | 741 |
742 if (mouse_locked_) | 742 if (mouse_locked_) |
743 return true; | 743 return true; |
744 | 744 |
745 mouse_locked_ = true; | 745 mouse_locked_ = true; |
746 window_->SetCapture(); | 746 window_->SetCapture(); |
747 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); | 747 aura::client::CursorClient* cursor_client = |
| 748 aura::client::GetCursorClient(root_window); |
| 749 if (cursor_client) |
| 750 cursor_client->ShowCursor(false); |
748 synthetic_move_sent_ = true; | 751 synthetic_move_sent_ = true; |
749 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); | 752 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); |
750 if (aura::client::GetTooltipClient(root_window)) | 753 if (aura::client::GetTooltipClient(root_window)) |
751 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); | 754 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); |
752 return true; | 755 return true; |
753 } | 756 } |
754 | 757 |
755 void RenderWidgetHostViewAura::UnlockMouse() { | 758 void RenderWidgetHostViewAura::UnlockMouse() { |
756 aura::RootWindow* root_window = window_->GetRootWindow(); | 759 aura::RootWindow* root_window = window_->GetRootWindow(); |
757 if (!mouse_locked_ || !root_window) | 760 if (!mouse_locked_ || !root_window) |
758 return; | 761 return; |
759 | 762 |
760 mouse_locked_ = false; | 763 mouse_locked_ = false; |
761 | 764 |
762 window_->ReleaseCapture(); | 765 window_->ReleaseCapture(); |
763 window_->MoveCursorTo(unlocked_mouse_position_); | 766 window_->MoveCursorTo(unlocked_mouse_position_); |
764 aura::Env::GetInstance()->cursor_manager()->ShowCursor(true); | 767 aura::client::CursorClient* cursor_client = |
| 768 aura::client::GetCursorClient(root_window); |
| 769 if (cursor_client) |
| 770 cursor_client->ShowCursor(true); |
765 if (aura::client::GetTooltipClient(root_window)) | 771 if (aura::client::GetTooltipClient(root_window)) |
766 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); | 772 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); |
767 | 773 |
768 host_->LostMouseLock(); | 774 host_->LostMouseLock(); |
769 } | 775 } |
770 | 776 |
771 //////////////////////////////////////////////////////////////////////////////// | 777 //////////////////////////////////////////////////////////////////////////////// |
772 // RenderWidgetHostViewAura, ui::TextInputClient implementation: | 778 // RenderWidgetHostViewAura, ui::TextInputClient implementation: |
773 void RenderWidgetHostViewAura::SetCompositionText( | 779 void RenderWidgetHostViewAura::SetCompositionText( |
774 const ui::CompositionText& composition) { | 780 const ui::CompositionText& composition) { |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1494 RenderWidgetHost* widget) { | 1500 RenderWidgetHost* widget) { |
1495 return new RenderWidgetHostViewAura(widget); | 1501 return new RenderWidgetHostViewAura(widget); |
1496 } | 1502 } |
1497 | 1503 |
1498 // static | 1504 // static |
1499 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1505 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1500 GetScreenInfoForWindow(results, NULL); | 1506 GetScreenInfoForWindow(results, NULL); |
1501 } | 1507 } |
1502 | 1508 |
1503 } // namespace content | 1509 } // namespace content |
OLD | NEW |