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" |
11 #include "content/public/browser/render_widget_host.h" | 11 #include "content/public/browser/render_widget_host.h" |
12 #include "content/public/browser/render_widget_host_iterator.h" | 12 #include "content/public/browser/render_widget_host_iterator.h" |
13 #include "content/public/browser/render_widget_host_view.h" | 13 #include "content/public/browser/render_widget_host_view.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
15 #include "ui/aura/window_delegate.h" | 15 #include "ui/aura/window_delegate.h" |
16 #include "ui/aura/window_observer.h" | 16 #include "ui/aura/window_observer.h" |
17 #include "ui/base/cursor/cursor.h" | 17 #include "ui/base/cursor/cursor.h" |
18 #include "ui/base/hit_test.h" | 18 #include "ui/base/hit_test.h" |
19 #include "ui/base/ime/input_method.h" | 19 #include "ui/base/ime/input_method.h" |
20 #include "ui/base/ime/text_input_client.h" | 20 #include "ui/base/ime/text_input_client.h" |
21 #include "ui/compositor/layer_animation_observer.h" | 21 #include "ui/compositor/layer_animation_observer.h" |
22 #include "ui/compositor/scoped_layer_animation_settings.h" | 22 #include "ui/compositor/scoped_layer_animation_settings.h" |
23 #include "ui/gfx/path.h" | 23 #include "ui/gfx/path.h" |
24 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
25 #include "ui/gfx/skia_util.h" | 25 #include "ui/gfx/skia_util.h" |
26 #include "ui/keyboard/keyboard_controller_observer.h" | 26 #include "ui/keyboard/keyboard_controller_observer.h" |
27 #include "ui/keyboard/keyboard_controller_proxy.h" | 27 #include "ui/keyboard/keyboard_controller_proxy.h" |
28 #include "ui/keyboard/keyboard_layout_manager.h" | 28 #include "ui/keyboard/keyboard_layout_manager.h" |
29 #include "ui/keyboard/keyboard_switches.h" | |
30 #include "ui/keyboard/keyboard_util.h" | 29 #include "ui/keyboard/keyboard_util.h" |
31 #include "ui/wm/core/masked_window_targeter.h" | 30 #include "ui/wm/core/masked_window_targeter.h" |
32 | 31 |
33 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
34 #include "base/process/launch.h" | 33 #include "base/process/launch.h" |
35 #include "base/sys_info.h" | 34 #include "base/sys_info.h" |
36 #endif | 35 #endif |
37 | 36 |
38 namespace { | 37 namespace { |
39 | 38 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 show_on_resize_ = false; | 400 show_on_resize_ = false; |
402 proxy_->ReloadKeyboardIfNeeded(); | 401 proxy_->ReloadKeyboardIfNeeded(); |
403 } | 402 } |
404 } | 403 } |
405 | 404 |
406 void KeyboardController::OnTextInputStateChanged( | 405 void KeyboardController::OnTextInputStateChanged( |
407 const ui::TextInputClient* client) { | 406 const ui::TextInputClient* client) { |
408 if (!container_.get()) | 407 if (!container_.get()) |
409 return; | 408 return; |
410 | 409 |
411 if (IsKeyboardUsabilityExperimentEnabled()) { | |
412 ShowKeyboardInternal(); | |
413 return; | |
414 } | |
415 | |
416 type_ = client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; | 410 type_ = client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; |
417 | 411 |
418 if (type_ == ui::TEXT_INPUT_TYPE_NONE && !lock_keyboard_) { | 412 if (type_ == ui::TEXT_INPUT_TYPE_NONE && !lock_keyboard_) { |
419 if (keyboard_visible_) { | 413 if (keyboard_visible_) { |
420 // Set the visibility state here so that any queries for visibility | 414 // Set the visibility state here so that any queries for visibility |
421 // before the timer fires returns the correct future value. | 415 // before the timer fires returns the correct future value. |
422 keyboard_visible_ = false; | 416 keyboard_visible_ = false; |
423 base::MessageLoop::current()->PostDelayedTask( | 417 base::MessageLoop::current()->PostDelayedTask( |
424 FROM_HERE, | 418 FROM_HERE, |
425 base::Bind(&KeyboardController::HideKeyboard, | 419 base::Bind(&KeyboardController::HideKeyboard, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 proxy_->HideKeyboardContainer(container_.get()); | 573 proxy_->HideKeyboardContainer(container_.get()); |
580 } | 574 } |
581 | 575 |
582 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { | 576 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { |
583 aura::Window* target_window = GetFrameWindow(window); | 577 aura::Window* target_window = GetFrameWindow(window); |
584 if (target_window) | 578 if (target_window) |
585 window_bounds_observer_->AddObservedWindow(target_window); | 579 window_bounds_observer_->AddObservedWindow(target_window); |
586 } | 580 } |
587 | 581 |
588 } // namespace keyboard | 582 } // namespace keyboard |
OLD | NEW |