Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 195793004: Implement overscroll support for the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add OVERRIDE Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after
3087 if (cursor_client) { 3101 if (cursor_client) {
3088 cursor_client->AddObserver(this); 3102 cursor_client->AddObserver(this);
3089 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); 3103 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible());
3090 } 3104 }
3091 if (HasFocus()) { 3105 if (HasFocus()) {
3092 ui::InputMethod* input_method = GetInputMethod(); 3106 ui::InputMethod* input_method = GetInputMethod();
3093 if (input_method) 3107 if (input_method)
3094 input_method->SetFocusedTextInputClient(this); 3108 input_method->SetFocusedTextInputClient(this);
3095 } 3109 }
3096 3110
3111 keyboard::KeyboardController* keyboard_controller =
3112 keyboard::KeyboardController::GetInstance();
3113 if (keyboard_controller)
3114 keyboard_controller->AddObserver(this);
3115
3097 #if defined(OS_WIN) 3116 #if defined(OS_WIN)
3098 // The parent may have changed here. Ensure that the legacy window is 3117 // The parent may have changed here. Ensure that the legacy window is
3099 // reparented accordingly. 3118 // reparented accordingly.
3100 if (legacy_render_widget_host_HWND_) 3119 if (legacy_render_widget_host_HWND_)
3101 legacy_render_widget_host_HWND_->UpdateParent( 3120 legacy_render_widget_host_HWND_->UpdateParent(
3102 reinterpret_cast<HWND>(GetNativeViewId())); 3121 reinterpret_cast<HWND>(GetNativeViewId()));
3103 #endif 3122 #endif
3104 3123
3105 ui::Compositor* compositor = GetCompositor(); 3124 ui::Compositor* compositor = GetCompositor();
3106 if (compositor) { 3125 if (compositor) {
3107 DCHECK(!vsync_manager_); 3126 DCHECK(!vsync_manager_);
3108 vsync_manager_ = compositor->vsync_manager(); 3127 vsync_manager_ = compositor->vsync_manager();
3109 vsync_manager_->AddObserver(this); 3128 vsync_manager_->AddObserver(this);
3110 } 3129 }
3111 } 3130 }
3112 3131
3113 void RenderWidgetHostViewAura::RemovingFromRootWindow() { 3132 void RenderWidgetHostViewAura::RemovingFromRootWindow() {
3114 aura::client::CursorClient* cursor_client = 3133 aura::client::CursorClient* cursor_client =
3115 aura::client::GetCursorClient(window_->GetRootWindow()); 3134 aura::client::GetCursorClient(window_->GetRootWindow());
3116 if (cursor_client) 3135 if (cursor_client)
3117 cursor_client->RemoveObserver(this); 3136 cursor_client->RemoveObserver(this);
3118 3137
3119 DetachFromInputMethod(); 3138 DetachFromInputMethod();
3120 3139
3140 keyboard::KeyboardController* keyboard_controller =
3141 keyboard::KeyboardController::GetInstance();
3142 if (keyboard_controller)
3143 keyboard_controller->RemoveObserver(this);
3144
3121 window_->GetHost()->RemoveObserver(this); 3145 window_->GetHost()->RemoveObserver(this);
3122 RunOnCommitCallbacks(); 3146 RunOnCommitCallbacks();
3123 resize_lock_.reset(); 3147 resize_lock_.reset();
3124 host_->WasResized(); 3148 host_->WasResized();
3125 ui::Compositor* compositor = GetCompositor(); 3149 ui::Compositor* compositor = GetCompositor();
3126 if (compositor && compositor->HasObserver(this)) 3150 if (compositor && compositor->HasObserver(this))
3127 compositor->RemoveObserver(this); 3151 compositor->RemoveObserver(this);
3128 3152
3129 #if defined(OS_WIN) 3153 #if defined(OS_WIN)
3130 // Update the legacy window's parent temporarily to the desktop window. It 3154 // Update the legacy window's parent temporarily to the desktop window. It
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
3201 // The new_layer is the one that will be used by our Window, so that's the one 3225 // The new_layer is the one that will be used by our Window, so that's the one
3202 // that should keep our frame. old_layer will be returned to the 3226 // that should keep our frame. old_layer will be returned to the
3203 // RecreateLayer caller, and should have a copy. 3227 // RecreateLayer caller, and should have a copy.
3204 if (frame_provider_.get()) { 3228 if (frame_provider_.get()) {
3205 new_layer->SetShowDelegatedContent(frame_provider_.get(), 3229 new_layer->SetShowDelegatedContent(frame_provider_.get(),
3206 current_frame_size_in_dip_); 3230 current_frame_size_in_dip_);
3207 } 3231 }
3208 } 3232 }
3209 3233
3210 //////////////////////////////////////////////////////////////////////////////// 3234 ////////////////////////////////////////////////////////////////////////////////
3235 // RenderWidgetHostViewAura, keyboard::KeyboardControllerObserver
3236 // implementation:
3237
3238 void RenderWidgetHostViewAura::OnKeyboardBoundsChanging(
3239 const gfx::Rect& new_bounds) {
3240 #if defined(OS_CHROMEOS)
3241 if (!keyboard::IsKeyboardOverscrollEnabled())
3242 return;
3243 if (virtual_keyboard_bounds_ != new_bounds) {
3244 virtual_keyboard_bounds_ = new_bounds;
3245 host_->WasResized();
3246 }
3247 #endif
3248 }
3249
3250 ////////////////////////////////////////////////////////////////////////////////
3211 // RenderWidgetHostView, public: 3251 // RenderWidgetHostView, public:
3212 3252
3213 // static 3253 // static
3214 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( 3254 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
3215 RenderWidgetHost* widget) { 3255 RenderWidgetHost* widget) {
3216 return new RenderWidgetHostViewAura(widget); 3256 return new RenderWidgetHostViewAura(widget);
3217 } 3257 }
3218 3258
3219 // static 3259 // static
3220 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3260 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3221 GetScreenInfoForWindow(results, NULL); 3261 GetScreenInfoForWindow(results, NULL);
3222 } 3262 }
3223 3263
3224 } // namespace content 3264 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698