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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "content/browser/renderer_host/backing_store_aura.h" | 15 #include "content/browser/renderer_host/backing_store_aura.h" |
16 #include "content/browser/renderer_host/dip_util.h" | 16 #include "content/browser/renderer_host/dip_util.h" |
17 #include "content/browser/renderer_host/image_transport_client.h" | 17 #include "content/browser/renderer_host/image_transport_client.h" |
18 #include "content/browser/renderer_host/render_widget_host_impl.h" | 18 #include "content/browser/renderer_host/render_widget_host_impl.h" |
19 #include "content/browser/renderer_host/web_input_event_aura.h" | 19 #include "content/browser/renderer_host/web_input_event_aura.h" |
20 #include "content/common/gpu/client/gl_helper.h" | 20 #include "content/common/gpu/client/gl_helper.h" |
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/user_metrics.h" | 24 #include "content/public/browser/user_metrics.h" |
25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
29 #include "ui/aura/client/aura_constants.h" | 29 #include "ui/aura/client/aura_constants.h" |
| 30 #include "ui/aura/client/cursor_client.h" |
30 #include "ui/aura/client/tooltip_client.h" | 31 #include "ui/aura/client/tooltip_client.h" |
31 #include "ui/aura/client/window_types.h" | 32 #include "ui/aura/client/window_types.h" |
32 #include "ui/aura/cursor_manager.h" | |
33 #include "ui/aura/env.h" | 33 #include "ui/aura/env.h" |
34 #include "ui/aura/event.h" | 34 #include "ui/aura/event.h" |
35 #include "ui/aura/root_window.h" | 35 #include "ui/aura/root_window.h" |
36 #include "ui/aura/window.h" | 36 #include "ui/aura/window.h" |
37 #include "ui/aura/window_observer.h" | 37 #include "ui/aura/window_observer.h" |
38 #include "ui/base/gestures/gesture_recognizer.h" | 38 #include "ui/base/gestures/gesture_recognizer.h" |
39 #include "ui/base/hit_test.h" | 39 #include "ui/base/hit_test.h" |
40 #include "ui/base/ime/input_method.h" | 40 #include "ui/base/ime/input_method.h" |
41 #include "ui/base/ui_base_types.h" | 41 #include "ui/base/ui_base_types.h" |
42 #include "ui/compositor/compositor.h" | 42 #include "ui/compositor/compositor.h" |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 bool RenderWidgetHostViewAura::LockMouse() { | 710 bool RenderWidgetHostViewAura::LockMouse() { |
711 aura::RootWindow* root_window = window_->GetRootWindow(); | 711 aura::RootWindow* root_window = window_->GetRootWindow(); |
712 if (!root_window) | 712 if (!root_window) |
713 return false; | 713 return false; |
714 | 714 |
715 if (mouse_locked_) | 715 if (mouse_locked_) |
716 return true; | 716 return true; |
717 | 717 |
718 mouse_locked_ = true; | 718 mouse_locked_ = true; |
719 window_->SetCapture(); | 719 window_->SetCapture(); |
720 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); | 720 aura::client::CursorClient* cursor_client = |
| 721 aura::client::GetCursorClient(root_window); |
| 722 if (cursor_client) |
| 723 cursor_client->ShowCursor(false); |
721 synthetic_move_sent_ = true; | 724 synthetic_move_sent_ = true; |
722 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); | 725 window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint()); |
723 if (aura::client::GetTooltipClient(root_window)) | 726 if (aura::client::GetTooltipClient(root_window)) |
724 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); | 727 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); |
725 return true; | 728 return true; |
726 } | 729 } |
727 | 730 |
728 void RenderWidgetHostViewAura::UnlockMouse() { | 731 void RenderWidgetHostViewAura::UnlockMouse() { |
729 aura::RootWindow* root_window = window_->GetRootWindow(); | 732 aura::RootWindow* root_window = window_->GetRootWindow(); |
730 if (!mouse_locked_ || !root_window) | 733 if (!mouse_locked_ || !root_window) |
731 return; | 734 return; |
732 | 735 |
733 mouse_locked_ = false; | 736 mouse_locked_ = false; |
734 | 737 |
735 window_->ReleaseCapture(); | 738 window_->ReleaseCapture(); |
736 window_->MoveCursorTo(unlocked_mouse_position_); | 739 window_->MoveCursorTo(unlocked_mouse_position_); |
737 aura::Env::GetInstance()->cursor_manager()->ShowCursor(true); | 740 aura::client::CursorClient* cursor_client = |
| 741 aura::client::GetCursorClient(root_window); |
| 742 if (cursor_client) |
| 743 cursor_client->ShowCursor(true); |
738 if (aura::client::GetTooltipClient(root_window)) | 744 if (aura::client::GetTooltipClient(root_window)) |
739 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); | 745 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true); |
740 | 746 |
741 host_->LostMouseLock(); | 747 host_->LostMouseLock(); |
742 } | 748 } |
743 | 749 |
744 //////////////////////////////////////////////////////////////////////////////// | 750 //////////////////////////////////////////////////////////////////////////////// |
745 // RenderWidgetHostViewAura, ui::TextInputClient implementation: | 751 // RenderWidgetHostViewAura, ui::TextInputClient implementation: |
746 void RenderWidgetHostViewAura::SetCompositionText( | 752 void RenderWidgetHostViewAura::SetCompositionText( |
747 const ui::CompositionText& composition) { | 753 const ui::CompositionText& composition) { |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 1430 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
1425 RenderWidgetHost* widget) { | 1431 RenderWidgetHost* widget) { |
1426 return new RenderWidgetHostViewAura(widget); | 1432 return new RenderWidgetHostViewAura(widget); |
1427 } | 1433 } |
1428 | 1434 |
1429 // static | 1435 // static |
1430 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 1436 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
1431 WebKit::WebScreenInfo* results) { | 1437 WebKit::WebScreenInfo* results) { |
1432 GetScreenInfoForWindow(results, NULL); | 1438 GetScreenInfoForWindow(results, NULL); |
1433 } | 1439 } |
OLD | NEW |