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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_manager_impl.cc

Issue 2953033002: Hide handwriting and voice buttons when keyboard is in restricted state (Closed)
Patch Set: Created 3 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/input_method/input_method_manager_impl.h" 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> // std::find 9 #include <algorithm> // std::find
10 #include <memory> 10 #include <memory>
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 922
923 InputMethodManagerImpl::InputMethodManagerImpl( 923 InputMethodManagerImpl::InputMethodManagerImpl(
924 std::unique_ptr<InputMethodDelegate> delegate, 924 std::unique_ptr<InputMethodDelegate> delegate,
925 bool enable_extension_loading) 925 bool enable_extension_loading)
926 : delegate_(std::move(delegate)), 926 : delegate_(std::move(delegate)),
927 ui_session_(STATE_LOGIN_SCREEN), 927 ui_session_(STATE_LOGIN_SCREEN),
928 state_(NULL), 928 state_(NULL),
929 util_(delegate_.get()), 929 util_(delegate_.get()),
930 component_extension_ime_manager_(new ComponentExtensionIMEManager()), 930 component_extension_ime_manager_(new ComponentExtensionIMEManager()),
931 enable_extension_loading_(enable_extension_loading), 931 enable_extension_loading_(enable_extension_loading),
932 is_ime_menu_activated_(false) { 932 is_ime_menu_activated_(false),
933 features_restricted_state_(FeaturesRestricted::NONE) {
933 if (IsRunningAsSystemCompositor()) { 934 if (IsRunningAsSystemCompositor()) {
934 #if defined(USE_OZONE) 935 #if defined(USE_OZONE)
935 keyboard_ = base::MakeUnique<ImeKeyboardMus>( 936 keyboard_ = base::MakeUnique<ImeKeyboardMus>(
936 g_browser_process->platform_part()->GetInputDeviceControllerClient()); 937 g_browser_process->platform_part()->GetInputDeviceControllerClient());
937 #else 938 #else
938 keyboard_.reset(ImeKeyboard::Create()); 939 keyboard_.reset(ImeKeyboard::Create());
939 #endif 940 #endif
940 } else { 941 } else {
941 keyboard_.reset(new FakeImeKeyboard()); 942 keyboard_.reset(new FakeImeKeyboard());
942 } 943 }
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 keyboard::KeyboardController* keyboard_controller = 1339 keyboard::KeyboardController* keyboard_controller =
1339 keyboard::KeyboardController::GetInstance(); 1340 keyboard::KeyboardController::GetInstance();
1340 if (keyboard_controller) 1341 if (keyboard_controller)
1341 keyboard_controller->Reload(); 1342 keyboard_controller->Reload();
1342 } 1343 }
1343 1344
1344 bool InputMethodManagerImpl::IsEmojiHandwritingVoiceOnImeMenuEnabled() { 1345 bool InputMethodManagerImpl::IsEmojiHandwritingVoiceOnImeMenuEnabled() {
1345 return base::FeatureList::IsEnabled(features::kEHVInputOnImeMenu); 1346 return base::FeatureList::IsEnabled(features::kEHVInputOnImeMenu);
1346 } 1347 }
1347 1348
1349 void InputMethodManagerImpl::SetFeaturesRestricted(FeaturesRestricted feature,
1350 bool restricted) {
1351 if (feature == FeaturesRestricted::NONE) {
1352 features_restricted_state_ =
1353 restricted ? FeaturesRestricted::NONE : (~FeaturesRestricted::NONE);
James Cook 2017/06/27 16:31:11 nit: () not needed, here or below
Azure Wei 2017/06/29 16:37:02 Done.
1354 } else {
1355 if (restricted)
1356 features_restricted_state_ |= feature;
1357 else
1358 features_restricted_state_ &= (~feature);
1359 }
1360 }
1361
1362 bool InputMethodManagerImpl::GetFeaturesRestricted(
1363 FeaturesRestricted feature) const {
1364 if (feature == FeaturesRestricted::NONE)
1365 return features_restricted_state_ == FeaturesRestricted::NONE;
1366 return (features_restricted_state_ & feature);
1367 }
1368
1348 } // namespace input_method 1369 } // namespace input_method
1349 } // namespace chromeos 1370 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698