Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: ui/keyboard/keyboard_controller.cc

Issue 34783006: Add --keyboard-usability-test flag and always show keyboard unless manually hide (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/keyboard/keyboard_switches.h » ('j') | ui/keyboard/keyboard_switches.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/aura/layout_manager.h" 9 #include "ui/aura/layout_manager.h"
9 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
10 #include "ui/aura/window_delegate.h" 11 #include "ui/aura/window_delegate.h"
11 #include "ui/base/cursor/cursor.h" 12 #include "ui/base/cursor/cursor.h"
12 #include "ui/base/hit_test.h" 13 #include "ui/base/hit_test.h"
13 #include "ui/base/ime/input_method.h" 14 #include "ui/base/ime/input_method.h"
14 #include "ui/base/ime/text_input_client.h" 15 #include "ui/base/ime/text_input_client.h"
15 #include "ui/base/ime/text_input_type.h" 16 #include "ui/base/ime/text_input_type.h"
16 #include "ui/gfx/path.h" 17 #include "ui/gfx/path.h"
17 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
18 #include "ui/gfx/skia_util.h" 19 #include "ui/gfx/skia_util.h"
19 #include "ui/keyboard/keyboard_controller_observer.h" 20 #include "ui/keyboard/keyboard_controller_observer.h"
20 #include "ui/keyboard/keyboard_controller_proxy.h" 21 #include "ui/keyboard/keyboard_controller_proxy.h"
22 #include "ui/keyboard/keyboard_switches.h"
21 #include "ui/keyboard/keyboard_util.h" 23 #include "ui/keyboard/keyboard_util.h"
22 24
23 namespace { 25 namespace {
24 26
25 const int kHideKeyboardDelayMs = 100; 27 const int kHideKeyboardDelayMs = 100;
26 28
27 gfx::Rect KeyboardBoundsFromWindowBounds(const gfx::Rect& window_bounds) { 29 gfx::Rect KeyboardBoundsFromWindowBounds(const gfx::Rect& window_bounds) {
28 const float kKeyboardHeightRatio = 0.3f; 30 const float kKeyboardHeightRatio = 0.3f;
29 return gfx::Rect( 31 return gfx::Rect(
30 window_bounds.x(), 32 window_bounds.x(),
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 container_->SetName("KeyboardContainer"); 146 container_->SetName("KeyboardContainer");
145 container_->set_owned_by_parent(false); 147 container_->set_owned_by_parent(false);
146 container_->Init(ui::LAYER_NOT_DRAWN); 148 container_->Init(ui::LAYER_NOT_DRAWN);
147 container_->AddObserver(this); 149 container_->AddObserver(this);
148 container_->SetLayoutManager(new KeyboardLayoutManager(container_.get())); 150 container_->SetLayoutManager(new KeyboardLayoutManager(container_.get()));
149 } 151 }
150 return container_.get(); 152 return container_.get();
151 } 153 }
152 154
153 void KeyboardController::HideKeyboard(HideReason reason) { 155 void KeyboardController::HideKeyboard(HideReason reason) {
156 if (CommandLine::ForCurrentProcess()->HasSwitch(
kevers 2013/10/23 11:37:39 I think this belongs right before the "keyboard_vi
sadrul 2013/10/23 14:01:49 Agree. It would probably be better to just set |sh
bshe 2013/10/23 17:08:43 I agree with the above and have moved it before th
157 switches::kKeyboardUsabilityTest) && reason == HIDE_REASON_AUTOMATIC) {
158 return;
159 }
160
154 keyboard_visible_ = false; 161 keyboard_visible_ = false;
155 162
156 keyboard::LogKeyboardControlEvent( 163 keyboard::LogKeyboardControlEvent(
157 reason == HIDE_REASON_AUTOMATIC ? 164 reason == HIDE_REASON_AUTOMATIC ?
158 keyboard::KEYBOARD_CONTROL_HIDE_AUTO : 165 keyboard::KEYBOARD_CONTROL_HIDE_AUTO :
159 keyboard::KEYBOARD_CONTROL_HIDE_USER); 166 keyboard::KEYBOARD_CONTROL_HIDE_USER);
160 167
161 FOR_EACH_OBSERVER(KeyboardControllerObserver, 168 FOR_EACH_OBSERVER(KeyboardControllerObserver,
162 observer_list_, 169 observer_list_,
163 OnKeyboardBoundsChanging(gfx::Rect())); 170 OnKeyboardBoundsChanging(gfx::Rect()));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const ui::InputMethod* input_method) { 247 const ui::InputMethod* input_method) {
241 DCHECK_EQ(input_method_, input_method); 248 DCHECK_EQ(input_method_, input_method);
242 input_method_ = NULL; 249 input_method_ = NULL;
243 } 250 }
244 251
245 bool KeyboardController::WillHideKeyboard() const { 252 bool KeyboardController::WillHideKeyboard() const {
246 return weak_factory_.HasWeakPtrs(); 253 return weak_factory_.HasWeakPtrs();
247 } 254 }
248 255
249 } // namespace keyboard 256 } // namespace keyboard
OLDNEW
« no previous file with comments | « no previous file | ui/keyboard/keyboard_switches.h » ('j') | ui/keyboard/keyboard_switches.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698