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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 KeyboardController::KeyboardController(KeyboardControllerProxy* proxy) | 238 KeyboardController::KeyboardController(KeyboardControllerProxy* proxy) |
239 : proxy_(proxy), | 239 : proxy_(proxy), |
240 input_method_(NULL), | 240 input_method_(NULL), |
241 keyboard_visible_(false), | 241 keyboard_visible_(false), |
242 show_on_resize_(false), | 242 show_on_resize_(false), |
243 lock_keyboard_(false), | 243 lock_keyboard_(false), |
244 type_(ui::TEXT_INPUT_TYPE_NONE), | 244 type_(ui::TEXT_INPUT_TYPE_NONE), |
245 weak_factory_(this) { | 245 weak_factory_(this) { |
246 CHECK(proxy); | 246 CHECK(proxy); |
247 input_method_ = proxy_->GetInputMethod(); | 247 input_method_ = proxy_->GetInputMethod(); |
248 input_method_->SetSupportsOnScreenKeyboard(true); | |
248 input_method_->AddObserver(this); | 249 input_method_->AddObserver(this); |
249 window_bounds_observer_.reset(new WindowBoundsChangeObserver()); | 250 window_bounds_observer_.reset(new WindowBoundsChangeObserver()); |
250 } | 251 } |
251 | 252 |
252 KeyboardController::~KeyboardController() { | 253 KeyboardController::~KeyboardController() { |
253 if (container_) | 254 if (container_) |
254 container_->RemoveObserver(this); | 255 container_->RemoveObserver(this); |
255 if (input_method_) | 256 if (input_method_) |
256 input_method_->RemoveObserver(this); | 257 input_method_->RemoveObserver(this); |
257 ResetWindowInsets(); | 258 ResetWindowInsets(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 keyboard::MarkKeyboardLoadStarted(); | 472 keyboard::MarkKeyboardLoadStarted(); |
472 aura::Window* keyboard = proxy_->GetKeyboardWindow(); | 473 aura::Window* keyboard = proxy_->GetKeyboardWindow(); |
473 keyboard->Show(); | 474 keyboard->Show(); |
474 container_->AddChild(keyboard); | 475 container_->AddChild(keyboard); |
475 keyboard->set_owned_by_parent(false); | 476 keyboard->set_owned_by_parent(false); |
476 } | 477 } |
477 | 478 |
478 proxy_->ReloadKeyboardIfNeeded(); | 479 proxy_->ReloadKeyboardIfNeeded(); |
479 | 480 |
480 if (keyboard_visible_) { | 481 if (keyboard_visible_) { |
482 proxy_->GetInputMethod()->GetTextInputClient()->OnKeyboardBoundsUnchanged(); | |
Shu Chen
2014/12/31 02:02:28
should this be moved to ShowAnimationFinished?
please use gerrit instead
2015/01/02 20:41:28
ShowAnimationFinished() triggers ScrollFocusedElem
| |
481 return; | 483 return; |
482 } else if (proxy_->GetKeyboardWindow()->bounds().height() == 0) { | 484 } else if (proxy_->GetKeyboardWindow()->bounds().height() == 0) { |
483 show_on_resize_ = true; | 485 show_on_resize_ = true; |
484 return; | 486 return; |
485 } | 487 } |
486 | 488 |
487 keyboard_visible_ = true; | 489 keyboard_visible_ = true; |
488 | 490 |
489 // If the controller is in the process of hiding the keyboard, do not log | 491 // If the controller is in the process of hiding the keyboard, do not log |
490 // the stat here since the keyboard will not actually be shown. | 492 // the stat here since the keyboard will not actually be shown. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
564 proxy_->HideKeyboardContainer(container_.get()); | 566 proxy_->HideKeyboardContainer(container_.get()); |
565 } | 567 } |
566 | 568 |
567 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { | 569 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { |
568 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; | 570 aura::Window* target_window = window ? window->GetToplevelWindow() : nullptr; |
569 if (target_window) | 571 if (target_window) |
570 window_bounds_observer_->AddObservedWindow(target_window); | 572 window_bounds_observer_->AddObservedWindow(target_window); |
571 } | 573 } |
572 | 574 |
573 } // namespace keyboard | 575 } // namespace keyboard |
OLD | NEW |