OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_ keyboard_delegate.h" | 5 #include "chrome/browser/extensions/api/virtual_keyboard_private/chrome_virtual_ keyboard_delegate.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 | 66 |
67 } // namespace | 67 } // namespace |
68 | 68 |
69 namespace extensions { | 69 namespace extensions { |
70 | 70 |
71 bool ChromeVirtualKeyboardDelegate::GetKeyboardConfig( | 71 bool ChromeVirtualKeyboardDelegate::GetKeyboardConfig( |
72 base::DictionaryValue* results) { | 72 base::DictionaryValue* results) { |
73 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 73 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
74 results->SetString("layout", keyboard::GetKeyboardLayout()); | 74 results->SetString("layout", keyboard::GetKeyboardLayout()); |
75 results->SetBoolean("a11ymode", keyboard::GetAccessibilityKeyboardEnabled()); | 75 results->SetBoolean("a11ymode", keyboard::GetAccessibilityKeyboardEnabled()); |
76 results->SetBoolean("hotrodmode", keyboard::GetHotrodKeyboardEnabled()); | |
76 scoped_ptr<base::ListValue> features(new base::ListValue()); | 77 scoped_ptr<base::ListValue> features(new base::ListValue()); |
77 features->AppendString(GenerateFeatureFlag( | 78 features->AppendString(GenerateFeatureFlag( |
78 "floatingvirtualkeyboard", keyboard::IsFloatingVirtualKeyboardEnabled())); | 79 "floatingvirtualkeyboard", keyboard::IsFloatingVirtualKeyboardEnabled())); |
79 features->AppendString( | 80 features->AppendString( |
80 GenerateFeatureFlag("gesturetyping", keyboard::IsGestureTypingEnabled())); | 81 GenerateFeatureFlag("gesturetyping", keyboard::IsGestureTypingEnabled())); |
81 features->AppendString(GenerateFeatureFlag( | 82 features->AppendString(GenerateFeatureFlag( |
82 "gestureediting", keyboard::IsGestureEditingEnabled())); | 83 "gestureediting", keyboard::IsGestureEditingEnabled())); |
83 features->AppendString( | 84 features->AppendString( |
84 GenerateFeatureFlag("voiceinput", keyboard::IsVoiceInputEnabled())); | 85 GenerateFeatureFlag("voiceinput", keyboard::IsVoiceInputEnabled())); |
85 features->AppendString(GenerateFeatureFlag("experimental", | 86 features->AppendString(GenerateFeatureFlag("experimental", |
(...skipping 24 matching lines...) Expand all Loading... | |
110 return keyboard::InsertText(text); | 111 return keyboard::InsertText(text); |
111 } | 112 } |
112 | 113 |
113 bool ChromeVirtualKeyboardDelegate::OnKeyboardLoaded() { | 114 bool ChromeVirtualKeyboardDelegate::OnKeyboardLoaded() { |
114 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 115 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
115 keyboard::MarkKeyboardLoadFinished(); | 116 keyboard::MarkKeyboardLoadFinished(); |
116 base::UserMetricsAction("VirtualKeyboardLoaded"); | 117 base::UserMetricsAction("VirtualKeyboardLoaded"); |
117 return true; | 118 return true; |
118 } | 119 } |
119 | 120 |
121 void ChromeVirtualKeyboardDelegate::SetHotrodKeyboard(bool enable) { | |
122 if (keyboard::GetHotrodKeyboardEnabled() == enable) | |
123 return; | |
124 | |
125 keyboard::SetHotrodKeyboardEnabled(enable); | |
126 // This reloads virtual keyboard even if it exists. This ensures virtual | |
127 // keyboard gets the correct state of the hotrod keyboard through | |
128 // chrome.virtualKeyboardPrivate.getKeyboardConfig. | |
129 if (enable && keyboard::IsKeyboardEnabled()) | |
rsadam
2015/09/08 21:48:22
Does this actually reload the keyboard? Looking th
| |
130 ash::Shell::GetInstance()->CreateKeyboard(); | |
131 } | |
132 | |
120 bool ChromeVirtualKeyboardDelegate::LockKeyboard(bool state) { | 133 bool ChromeVirtualKeyboardDelegate::LockKeyboard(bool state) { |
121 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 134 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
122 keyboard::KeyboardController* controller = | 135 keyboard::KeyboardController* controller = |
123 keyboard::KeyboardController::GetInstance(); | 136 keyboard::KeyboardController::GetInstance(); |
124 if (!controller) | 137 if (!controller) |
125 return false; | 138 return false; |
126 | 139 |
127 keyboard::KeyboardController::GetInstance()->set_lock_keyboard(state); | 140 keyboard::KeyboardController::GetInstance()->set_lock_keyboard(state); |
128 return true; | 141 return true; |
129 } | 142 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 } | 193 } |
181 | 194 |
182 bool ChromeVirtualKeyboardDelegate::IsLanguageSettingsEnabled() { | 195 bool ChromeVirtualKeyboardDelegate::IsLanguageSettingsEnabled() { |
183 return (user_manager::UserManager::Get()->IsUserLoggedIn() && | 196 return (user_manager::UserManager::Get()->IsUserLoggedIn() && |
184 !chromeos::UserAddingScreen::Get()->IsRunning() && | 197 !chromeos::UserAddingScreen::Get()->IsRunning() && |
185 !(chromeos::ScreenLocker::default_screen_locker() && | 198 !(chromeos::ScreenLocker::default_screen_locker() && |
186 chromeos::ScreenLocker::default_screen_locker()->locked())); | 199 chromeos::ScreenLocker::default_screen_locker()->locked())); |
187 } | 200 } |
188 | 201 |
189 } // namespace extensions | 202 } // namespace extensions |
OLD | NEW |