OLD | NEW |
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 Loading... |
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 aura::Window *keyboard_window = proxy_->GetKeyboardWindow(); |
| 246 aura::Window *root_window = keyboard_window->GetRootWindow(); |
| 247 gfx::Insets insets(0, 0, new_bounds.height(), 0); |
| 248 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { |
| 249 content::RenderWidgetHostView* view = widget->GetView(); |
| 250 aura::Window *window = view->GetNativeView(); |
| 251 if (window != keyboard_window && window->GetRootWindow() == root_window) |
| 252 view->SetInsets(insets); |
| 253 } |
| 254 } |
237 } | 255 } |
238 } | 256 } |
239 | 257 |
240 void KeyboardController::HideKeyboard(HideReason reason) { | 258 void KeyboardController::HideKeyboard(HideReason reason) { |
241 keyboard_visible_ = false; | 259 keyboard_visible_ = false; |
242 ToggleTouchEventLogging(true); | 260 ToggleTouchEventLogging(true); |
243 | 261 |
244 keyboard::LogKeyboardControlEvent( | 262 keyboard::LogKeyboardControlEvent( |
245 reason == HIDE_REASON_AUTOMATIC ? | 263 reason == HIDE_REASON_AUTOMATIC ? |
246 keyboard::KEYBOARD_CONTROL_HIDE_AUTO : | 264 keyboard::KEYBOARD_CONTROL_HIDE_AUTO : |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // background during animation. | 437 // background during animation. |
420 NotifyKeyboardBoundsChanging(proxy_->GetKeyboardWindow()->bounds()); | 438 NotifyKeyboardBoundsChanging(proxy_->GetKeyboardWindow()->bounds()); |
421 proxy_->EnsureCaretInWorkArea(); | 439 proxy_->EnsureCaretInWorkArea(); |
422 } | 440 } |
423 | 441 |
424 void KeyboardController::HideAnimationFinished() { | 442 void KeyboardController::HideAnimationFinished() { |
425 proxy_->HideKeyboardContainer(container_.get()); | 443 proxy_->HideKeyboardContainer(container_.get()); |
426 } | 444 } |
427 | 445 |
428 } // namespace keyboard | 446 } // namespace keyboard |
OLD | NEW |