Chromium Code Reviews| 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 DefaultKeyboardBoundsFromRootBounds( |
| 61 const gfx::Rect& window_bounds) { | 61 const gfx::Rect& root_bounds) { |
| 62 // Initialize default keyboard height to 0. The keyboard window height should | 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, | 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 | 64 // the default height may conflict with the new height and causing some |
| 65 // strange animation issues. | 65 // strange animation issues. |
| 66 return KeyboardBoundsFromWindowBounds(window_bounds, 0); | 66 return gfx::Rect( |
| 67 root_bounds.x(), | |
| 68 root_bounds.bottom(), | |
| 69 root_bounds.width(), | |
| 70 0); | |
|
sadrul
2015/04/01 06:43:49
This doesn't seem to be useful. If the height is z
bshe
2015/04/01 20:41:33
You are right. We could probably just use gfx::Rec
| |
| 67 } | 71 } |
| 68 | 72 |
| 69 gfx::Rect KeyboardBoundsFromWindowBounds(const gfx::Rect& window_bounds, | 73 gfx::Rect FullWidthKeyboardBoundsFromRootBounds(const gfx::Rect& root_bounds, |
| 70 int keyboard_height) { | 74 int keyboard_height) { |
| 71 return gfx::Rect( | 75 return gfx::Rect( |
| 72 window_bounds.x(), | 76 root_bounds.x(), |
| 73 window_bounds.bottom() - keyboard_height, | 77 root_bounds.bottom() - keyboard_height, |
| 74 window_bounds.width(), | 78 root_bounds.width(), |
| 75 keyboard_height); | 79 keyboard_height); |
|
sadrul
2015/04/01 06:43:49
This only ever seems to be used in tests? Is that
bshe
2015/04/01 20:41:33
This is used in ui/keyboard and ash/. I can probab
sadrul
2015/04/07 17:35:51
Yep, makes sense. Follow up CL sgtm.
| |
| 76 } | 80 } |
| 77 | 81 |
| 78 void SetAccessibilityKeyboardEnabled(bool enabled) { | 82 void SetAccessibilityKeyboardEnabled(bool enabled) { |
| 79 g_accessibility_keyboard_enabled = enabled; | 83 g_accessibility_keyboard_enabled = enabled; |
| 80 } | 84 } |
| 81 | 85 |
| 82 bool GetAccessibilityKeyboardEnabled() { | 86 bool GetAccessibilityKeyboardEnabled() { |
| 83 return g_accessibility_keyboard_enabled; | 87 return g_accessibility_keyboard_enabled; |
| 84 } | 88 } |
| 85 | 89 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 } | 398 } |
| 395 | 399 |
| 396 void LogKeyboardControlEvent(KeyboardControlEvent event) { | 400 void LogKeyboardControlEvent(KeyboardControlEvent event) { |
| 397 UMA_HISTOGRAM_ENUMERATION( | 401 UMA_HISTOGRAM_ENUMERATION( |
| 398 "VirtualKeyboard.KeyboardControlEvent", | 402 "VirtualKeyboard.KeyboardControlEvent", |
| 399 event, | 403 event, |
| 400 keyboard::KEYBOARD_CONTROL_MAX); | 404 keyboard::KEYBOARD_CONTROL_MAX); |
| 401 } | 405 } |
| 402 | 406 |
| 403 } // namespace keyboard | 407 } // namespace keyboard |
| OLD | NEW |