| 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_util.h" | 5 #include "ui/keyboard/keyboard_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 keyboard::KeyboardOverscrolOverride g_keyboard_overscroll_override = | 50 keyboard::KeyboardOverscrolOverride g_keyboard_overscroll_override = |
| 51 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_NONE; | 51 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_NONE; |
| 52 | 52 |
| 53 keyboard::KeyboardShowOverride g_keyboard_show_override = | 53 keyboard::KeyboardShowOverride g_keyboard_show_override = |
| 54 keyboard::KEYBOARD_SHOW_OVERRIDE_NONE; | 54 keyboard::KEYBOARD_SHOW_OVERRIDE_NONE; |
| 55 | 55 |
| 56 } // namespace | 56 } // namespace |
| 57 | 57 |
| 58 namespace keyboard { | 58 namespace keyboard { |
| 59 | 59 |
| 60 gfx::Rect DefaultKeyboardBoundsFromWindowBounds( | 60 gfx::Rect FullWidthKeyboardBoundsFromRootBounds(const gfx::Rect& root_bounds, |
| 61 const gfx::Rect& window_bounds) { | 61 int keyboard_height) { |
| 62 // Initialize default keyboard height to 0. The keyboard window height should | |
| 63 // only be set by window.resizeTo in virtual keyboard web contents. Otherwise, | |
| 64 // the default height may conflict with the new height and causing some | |
| 65 // strange animation issues. | |
| 66 return KeyboardBoundsFromWindowBounds(window_bounds, 0); | |
| 67 } | |
| 68 | |
| 69 gfx::Rect KeyboardBoundsFromWindowBounds(const gfx::Rect& window_bounds, | |
| 70 int keyboard_height) { | |
| 71 return gfx::Rect( | 62 return gfx::Rect( |
| 72 window_bounds.x(), | 63 root_bounds.x(), |
| 73 window_bounds.bottom() - keyboard_height, | 64 root_bounds.bottom() - keyboard_height, |
| 74 window_bounds.width(), | 65 root_bounds.width(), |
| 75 keyboard_height); | 66 keyboard_height); |
| 76 } | 67 } |
| 77 | 68 |
| 78 void SetAccessibilityKeyboardEnabled(bool enabled) { | 69 void SetAccessibilityKeyboardEnabled(bool enabled) { |
| 79 g_accessibility_keyboard_enabled = enabled; | 70 g_accessibility_keyboard_enabled = enabled; |
| 80 } | 71 } |
| 81 | 72 |
| 82 bool GetAccessibilityKeyboardEnabled() { | 73 bool GetAccessibilityKeyboardEnabled() { |
| 83 return g_accessibility_keyboard_enabled; | 74 return g_accessibility_keyboard_enabled; |
| 84 } | 75 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 395 } |
| 405 | 396 |
| 406 void LogKeyboardControlEvent(KeyboardControlEvent event) { | 397 void LogKeyboardControlEvent(KeyboardControlEvent event) { |
| 407 UMA_HISTOGRAM_ENUMERATION( | 398 UMA_HISTOGRAM_ENUMERATION( |
| 408 "VirtualKeyboard.KeyboardControlEvent", | 399 "VirtualKeyboard.KeyboardControlEvent", |
| 409 event, | 400 event, |
| 410 keyboard::KEYBOARD_CONTROL_MAX); | 401 keyboard::KEYBOARD_CONTROL_MAX); |
| 411 } | 402 } |
| 412 | 403 |
| 413 } // namespace keyboard | 404 } // namespace keyboard |
| OLD | NEW |