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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 #include "ui/compositor/layer.h" | 71 #include "ui/compositor/layer.h" |
72 #include "ui/events/event.h" | 72 #include "ui/events/event.h" |
73 #include "ui/events/event_utils.h" | 73 #include "ui/events/event_utils.h" |
74 #include "ui/events/gestures/gesture_recognizer.h" | 74 #include "ui/events/gestures/gesture_recognizer.h" |
75 #include "ui/gfx/canvas.h" | 75 #include "ui/gfx/canvas.h" |
76 #include "ui/gfx/display.h" | 76 #include "ui/gfx/display.h" |
77 #include "ui/gfx/rect_conversions.h" | 77 #include "ui/gfx/rect_conversions.h" |
78 #include "ui/gfx/screen.h" | 78 #include "ui/gfx/screen.h" |
79 #include "ui/gfx/size_conversions.h" | 79 #include "ui/gfx/size_conversions.h" |
80 #include "ui/gfx/skia_util.h" | 80 #include "ui/gfx/skia_util.h" |
81 #include "ui/keyboard/keyboard_controller.h" | |
82 #include "ui/keyboard/keyboard_util.h" | |
81 #include "ui/wm/public/activation_client.h" | 83 #include "ui/wm/public/activation_client.h" |
82 #include "ui/wm/public/scoped_tooltip_disabler.h" | 84 #include "ui/wm/public/scoped_tooltip_disabler.h" |
83 #include "ui/wm/public/tooltip_client.h" | 85 #include "ui/wm/public/tooltip_client.h" |
84 #include "ui/wm/public/transient_window_client.h" | 86 #include "ui/wm/public/transient_window_client.h" |
85 #include "ui/wm/public/window_types.h" | 87 #include "ui/wm/public/window_types.h" |
86 | 88 |
87 #if defined(OS_WIN) | 89 #if defined(OS_WIN) |
88 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 90 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
89 #include "content/browser/accessibility/browser_accessibility_win.h" | 91 #include "content/browser/accessibility/browser_accessibility_win.h" |
90 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" | 92 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1444 | 1446 |
1445 if (frame->software_frame_data) { | 1447 if (frame->software_frame_data) { |
1446 DLOG(ERROR) << "Unable to use software frame in aura"; | 1448 DLOG(ERROR) << "Unable to use software frame in aura"; |
1447 RecordAction( | 1449 RecordAction( |
1448 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); | 1450 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); |
1449 host_->GetProcess()->ReceivedBadMessage(); | 1451 host_->GetProcess()->ReceivedBadMessage(); |
1450 return; | 1452 return; |
1451 } | 1453 } |
1452 } | 1454 } |
1453 | 1455 |
1456 float RenderWidgetHostViewAura::GetOverdrawBottomHeight() const { | |
1457 float overdraw = 0.f; | |
1458 #if defined(OS_CHROMEOS) | |
1459 gfx::Rect window_bounds = window_->GetBoundsInScreen(); | |
1460 gfx::Rect intersect = gfx::IntersectRects(window_bounds, | |
1461 virtual_keyboard_bounds_); | |
1462 if (intersect.height() > 0 && intersect.height() < window_bounds.height()) | |
1463 overdraw = intersect.height(); | |
1464 #endif | |
1465 return overdraw; | |
1466 } | |
1467 | |
1454 #if defined(OS_WIN) | 1468 #if defined(OS_WIN) |
1455 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( | 1469 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( |
1456 gfx::NativeViewAccessible accessible_parent) { | 1470 gfx::NativeViewAccessible accessible_parent) { |
1457 if (GetBrowserAccessibilityManager()) { | 1471 if (GetBrowserAccessibilityManager()) { |
1458 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin() | 1472 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin() |
1459 ->set_parent_iaccessible(accessible_parent); | 1473 ->set_parent_iaccessible(accessible_parent); |
1460 } | 1474 } |
1461 } | 1475 } |
1462 | 1476 |
1463 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() | 1477 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3091 if (cursor_client) { | 3105 if (cursor_client) { |
3092 cursor_client->AddObserver(this); | 3106 cursor_client->AddObserver(this); |
3093 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 3107 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
3094 } | 3108 } |
3095 if (HasFocus()) { | 3109 if (HasFocus()) { |
3096 ui::InputMethod* input_method = GetInputMethod(); | 3110 ui::InputMethod* input_method = GetInputMethod(); |
3097 if (input_method) | 3111 if (input_method) |
3098 input_method->SetFocusedTextInputClient(this); | 3112 input_method->SetFocusedTextInputClient(this); |
3099 } | 3113 } |
3100 | 3114 |
3115 keyboard::KeyboardController* keyboard_controller = | |
3116 keyboard::KeyboardController::GetInstance(); | |
3117 if (keyboard_controller) | |
3118 keyboard_controller->AddObserver(this); | |
3119 | |
3101 #if defined(OS_WIN) | 3120 #if defined(OS_WIN) |
3102 // The parent may have changed here. Ensure that the legacy window is | 3121 // The parent may have changed here. Ensure that the legacy window is |
3103 // reparented accordingly. | 3122 // reparented accordingly. |
3104 if (legacy_render_widget_host_HWND_) | 3123 if (legacy_render_widget_host_HWND_) |
3105 legacy_render_widget_host_HWND_->UpdateParent( | 3124 legacy_render_widget_host_HWND_->UpdateParent( |
3106 reinterpret_cast<HWND>(GetNativeViewId())); | 3125 reinterpret_cast<HWND>(GetNativeViewId())); |
3107 #endif | 3126 #endif |
3108 | 3127 |
3109 ui::Compositor* compositor = GetCompositor(); | 3128 ui::Compositor* compositor = GetCompositor(); |
3110 if (compositor) { | 3129 if (compositor) { |
3111 DCHECK(!vsync_manager_); | 3130 DCHECK(!vsync_manager_); |
3112 vsync_manager_ = compositor->vsync_manager(); | 3131 vsync_manager_ = compositor->vsync_manager(); |
3113 vsync_manager_->AddObserver(this); | 3132 vsync_manager_->AddObserver(this); |
3114 } | 3133 } |
3115 } | 3134 } |
3116 | 3135 |
3117 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 3136 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
3118 aura::client::CursorClient* cursor_client = | 3137 aura::client::CursorClient* cursor_client = |
3119 aura::client::GetCursorClient(window_->GetRootWindow()); | 3138 aura::client::GetCursorClient(window_->GetRootWindow()); |
3120 if (cursor_client) | 3139 if (cursor_client) |
3121 cursor_client->RemoveObserver(this); | 3140 cursor_client->RemoveObserver(this); |
3122 | 3141 |
3123 DetachFromInputMethod(); | 3142 DetachFromInputMethod(); |
3124 | 3143 |
3144 keyboard::KeyboardController* keyboard_controller = | |
3145 keyboard::KeyboardController::GetInstance(); | |
3146 if (keyboard_controller) | |
3147 keyboard_controller->RemoveObserver(this); | |
3148 | |
3125 window_->GetHost()->RemoveObserver(this); | 3149 window_->GetHost()->RemoveObserver(this); |
3126 RunOnCommitCallbacks(); | 3150 RunOnCommitCallbacks(); |
3127 resize_lock_.reset(); | 3151 resize_lock_.reset(); |
3128 host_->WasResized(); | 3152 host_->WasResized(); |
3129 ui::Compositor* compositor = GetCompositor(); | 3153 ui::Compositor* compositor = GetCompositor(); |
3130 if (compositor && compositor->HasObserver(this)) | 3154 if (compositor && compositor->HasObserver(this)) |
3131 compositor->RemoveObserver(this); | 3155 compositor->RemoveObserver(this); |
3132 | 3156 |
3133 #if defined(OS_WIN) | 3157 #if defined(OS_WIN) |
3134 // Update the legacy window's parent temporarily to the desktop window. It | 3158 // Update the legacy window's parent temporarily to the desktop window. It |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3205 // The new_layer is the one that will be used by our Window, so that's the one | 3229 // The new_layer is the one that will be used by our Window, so that's the one |
3206 // that should keep our frame. old_layer will be returned to the | 3230 // that should keep our frame. old_layer will be returned to the |
3207 // RecreateLayer caller, and should have a copy. | 3231 // RecreateLayer caller, and should have a copy. |
3208 if (frame_provider_.get()) { | 3232 if (frame_provider_.get()) { |
3209 new_layer->SetShowDelegatedContent(frame_provider_.get(), | 3233 new_layer->SetShowDelegatedContent(frame_provider_.get(), |
3210 current_frame_size_in_dip_); | 3234 current_frame_size_in_dip_); |
3211 } | 3235 } |
3212 } | 3236 } |
3213 | 3237 |
3214 //////////////////////////////////////////////////////////////////////////////// | 3238 //////////////////////////////////////////////////////////////////////////////// |
3239 // RenderWidgetHostViewAura, aura::client::VirtualKeyboardObserver | |
sadrul
2014/04/10 18:27:27
keyboard::KeyboardControllerObserver
kevers
2014/04/14 18:47:45
Done.
| |
3240 // implementation: | |
3241 | |
3242 void RenderWidgetHostViewAura::OnKeyboardBoundsChanging( | |
3243 const gfx::Rect& new_bounds) { | |
3244 #if defined(OS_CHROMEOS) | |
3245 if (!keyboard::IsKeyboardOverscrollEnabled()) | |
3246 return; | |
3247 if (virtual_keyboard_bounds_ != new_bounds) { | |
3248 virtual_keyboard_bounds_ = new_bounds; | |
3249 host_->WasResized(); | |
3250 } | |
3251 #endif | |
3252 } | |
3253 | |
3254 //////////////////////////////////////////////////////////////////////////////// | |
3215 // RenderWidgetHostView, public: | 3255 // RenderWidgetHostView, public: |
3216 | 3256 |
3217 // static | 3257 // static |
3218 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( | 3258 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( |
3219 RenderWidgetHost* widget) { | 3259 RenderWidgetHost* widget) { |
3220 return new RenderWidgetHostViewAura(widget); | 3260 return new RenderWidgetHostViewAura(widget); |
3221 } | 3261 } |
3222 | 3262 |
3223 // static | 3263 // static |
3224 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3264 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3225 GetScreenInfoForWindow(results, NULL); | 3265 GetScreenInfoForWindow(results, NULL); |
3226 } | 3266 } |
3227 | 3267 |
3228 } // namespace content | 3268 } // namespace content |
OLD | NEW |