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

Side by Side Diff: ui/keyboard/keyboard_controller.cc

Issue 195793004: Implement overscroll support for the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix work area resize when virtual keyboard is shown. 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/keyboard/keyboard_controller.h" 5 #include "ui/keyboard/keyboard_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "content/public/browser/render_widget_host.h"
10 #include "content/public/browser/render_widget_host_iterator.h"
11 #include "content/public/browser/render_widget_host_view.h"
9 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
10 #include "ui/aura/window_delegate.h" 13 #include "ui/aura/window_delegate.h"
11 #include "ui/base/cursor/cursor.h" 14 #include "ui/base/cursor/cursor.h"
12 #include "ui/base/hit_test.h" 15 #include "ui/base/hit_test.h"
13 #include "ui/base/ime/input_method.h" 16 #include "ui/base/ime/input_method.h"
14 #include "ui/base/ime/text_input_client.h" 17 #include "ui/base/ime/text_input_client.h"
15 #include "ui/compositor/layer_animation_observer.h" 18 #include "ui/compositor/layer_animation_observer.h"
16 #include "ui/compositor/scoped_layer_animation_settings.h" 19 #include "ui/compositor/scoped_layer_animation_settings.h"
17 #include "ui/gfx/path.h" 20 #include "ui/gfx/path.h"
18 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return container_.get(); 230 return container_.get();
228 } 231 }
229 232
230 void KeyboardController::NotifyKeyboardBoundsChanging( 233 void KeyboardController::NotifyKeyboardBoundsChanging(
231 const gfx::Rect& new_bounds) { 234 const gfx::Rect& new_bounds) {
232 current_keyboard_bounds_ = new_bounds; 235 current_keyboard_bounds_ = new_bounds;
233 if (proxy_->HasKeyboardWindow() && proxy_->GetKeyboardWindow()->IsVisible()) { 236 if (proxy_->HasKeyboardWindow() && proxy_->GetKeyboardWindow()->IsVisible()) {
234 FOR_EACH_OBSERVER(KeyboardControllerObserver, 237 FOR_EACH_OBSERVER(KeyboardControllerObserver,
235 observer_list_, 238 observer_list_,
236 OnKeyboardBoundsChanging(new_bounds)); 239 OnKeyboardBoundsChanging(new_bounds));
240 if (keyboard::IsKeyboardOverscrollEnabled()) {
241 // Adjust the height of the viewport for visible windows on the primary
242 // display.
243 scoped_ptr<content::RenderWidgetHostIterator> widgets(
244 content::RenderWidgetHost::GetRenderWidgetHosts());
245 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) {
246 content::RenderWidgetHostView* view = widget->GetView();
247 view->SetKeyboardBounds(new_bounds);
248 }
249 }
237 } 250 }
238 } 251 }
239 252
240 void KeyboardController::HideKeyboard(HideReason reason) { 253 void KeyboardController::HideKeyboard(HideReason reason) {
241 keyboard_visible_ = false; 254 keyboard_visible_ = false;
242 ToggleTouchEventLogging(true); 255 ToggleTouchEventLogging(true);
243 256
244 keyboard::LogKeyboardControlEvent( 257 keyboard::LogKeyboardControlEvent(
245 reason == HIDE_REASON_AUTOMATIC ? 258 reason == HIDE_REASON_AUTOMATIC ?
246 keyboard::KEYBOARD_CONTROL_HIDE_AUTO : 259 keyboard::KEYBOARD_CONTROL_HIDE_AUTO :
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 // background during animation. 432 // background during animation.
420 NotifyKeyboardBoundsChanging(proxy_->GetKeyboardWindow()->bounds()); 433 NotifyKeyboardBoundsChanging(proxy_->GetKeyboardWindow()->bounds());
421 proxy_->EnsureCaretInWorkArea(); 434 proxy_->EnsureCaretInWorkArea();
422 } 435 }
423 436
424 void KeyboardController::HideAnimationFinished() { 437 void KeyboardController::HideAnimationFinished() {
425 proxy_->HideKeyboardContainer(container_.get()); 438 proxy_->HideKeyboardContainer(container_.get());
426 } 439 }
427 440
428 } // namespace keyboard 441 } // namespace keyboard
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698