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

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

Issue 2871243003: Enable new-virtual-keyboard-behavior flag by default. (Closed)
Patch Set: keep sorted the declarations Created 3 years, 7 months 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_ui.h" 5 #include "ui/keyboard/keyboard_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 #include "ui/base/ime/input_method.h" 9 #include "ui/base/ime/input_method.h"
10 #include "ui/base/ime/text_input_client.h" 10 #include "ui/base/ime/text_input_client.h"
(...skipping 24 matching lines...) Expand all
35 return; 35 return;
36 36
37 const aura::Window* keyboard_window = GetKeyboardWindow(); 37 const aura::Window* keyboard_window = GetKeyboardWindow();
38 const gfx::Rect keyboard_bounds_in_screen = 38 const gfx::Rect keyboard_bounds_in_screen =
39 keyboard_window->IsVisible() ? keyboard_window->GetBoundsInScreen() 39 keyboard_window->IsVisible() ? keyboard_window->GetBoundsInScreen()
40 : gfx::Rect(); 40 : gfx::Rect();
41 41
42 // Use new virtual keyboard behavior only if the flag enabled and in 42 // Use new virtual keyboard behavior only if the flag enabled and in
43 // non-sticky mode. 43 // non-sticky mode.
44 const bool new_vk_behavior = 44 const bool new_vk_behavior =
45 (base::CommandLine::ForCurrentProcess()->HasSwitch( 45 (!base::CommandLine::ForCurrentProcess()->HasSwitch(
46 ::switches::kUseNewVirtualKeyboardBehavior) && 46 ::switches::kDisableNewVirtualKeyboardBehavior) &&
47 !keyboard_controller_->keyboard_locked()); 47 !keyboard_controller_->keyboard_locked());
48 48
49 if (new_vk_behavior) { 49 if (new_vk_behavior) {
50 GetInputMethod()->SetOnScreenKeyboardBounds(keyboard_bounds_in_screen); 50 GetInputMethod()->SetOnScreenKeyboardBounds(keyboard_bounds_in_screen);
51 } else if (GetInputMethod()->GetTextInputClient()) { 51 } else if (GetInputMethod()->GetTextInputClient()) {
52 GetInputMethod()->GetTextInputClient()->EnsureCaretNotInRect( 52 GetInputMethod()->GetTextInputClient()->EnsureCaretNotInRect(
53 keyboard_bounds_in_screen); 53 keyboard_bounds_in_screen);
54 } 54 }
55 } 55 }
56 56
57 void KeyboardUI::SetController(KeyboardController* controller) { 57 void KeyboardUI::SetController(KeyboardController* controller) {
58 keyboard_controller_ = controller; 58 keyboard_controller_ = controller;
59 } 59 }
60 60
61 } // namespace keyboard 61 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/keyboard_controller_unittest.cc ('k') | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698