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

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_manager.cc

Issue 2919583002: chromeos: Move InputMethodUtil into //ui/base/ime/chromeos (Closed)
Patch Set: Created 3 years, 6 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) 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 "chrome/browser/chromeos/accessibility/accessibility_manager.h" 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "extensions/browser/extension_registry.h" 77 #include "extensions/browser/extension_registry.h"
78 #include "extensions/browser/extension_system.h" 78 #include "extensions/browser/extension_system.h"
79 #include "extensions/common/extension.h" 79 #include "extensions/common/extension.h"
80 #include "extensions/common/extension_messages.h" 80 #include "extensions/common/extension_messages.h"
81 #include "extensions/common/extension_resource.h" 81 #include "extensions/common/extension_resource.h"
82 #include "extensions/common/host_id.h" 82 #include "extensions/common/host_id.h"
83 #include "mash/public/interfaces/launchable.mojom.h" 83 #include "mash/public/interfaces/launchable.mojom.h"
84 #include "media/audio/sounds/sounds_manager.h" 84 #include "media/audio/sounds/sounds_manager.h"
85 #include "media/base/media_switches.h" 85 #include "media/base/media_switches.h"
86 #include "services/service_manager/public/cpp/connector.h" 86 #include "services/service_manager/public/cpp/connector.h"
87 #include "ui/base/ime/chromeos/extension_ime_util.h"
87 #include "ui/base/ime/chromeos/input_method_manager.h" 88 #include "ui/base/ime/chromeos/input_method_manager.h"
88 #include "ui/base/resource/resource_bundle.h" 89 #include "ui/base/resource/resource_bundle.h"
89 #include "ui/keyboard/keyboard_controller.h" 90 #include "ui/keyboard/keyboard_controller.h"
90 #include "ui/keyboard/keyboard_util.h" 91 #include "ui/keyboard/keyboard_util.h"
91 #include "ui/views/widget/widget_observer.h" 92 #include "ui/views/widget/widget_observer.h"
92 93
93 using content::BrowserThread; 94 using content::BrowserThread;
94 using extensions::api::braille_display_private::BrailleController; 95 using extensions::api::braille_display_private::BrailleController;
95 using extensions::api::braille_display_private::DisplayState; 96 using extensions::api::braille_display_private::DisplayState;
96 using extensions::api::braille_display_private::KeyEvent; 97 using extensions::api::braille_display_private::KeyEvent;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 AccessibilityNotificationType notification_type, 168 AccessibilityNotificationType notification_type,
168 bool enabled, 169 bool enabled,
169 ash::MagnifierType magnifier_type, 170 ash::MagnifierType magnifier_type,
170 ash::AccessibilityNotificationVisibility notify) 171 ash::AccessibilityNotificationVisibility notify)
171 : notification_type(notification_type), 172 : notification_type(notification_type),
172 enabled(enabled), 173 enabled(enabled),
173 magnifier_type(magnifier_type), 174 magnifier_type(magnifier_type),
174 notify(notify) {} 175 notify(notify) {}
175 176
176 /////////////////////////////////////////////////////////////////////////////// 177 ///////////////////////////////////////////////////////////////////////////////
177 //
178 // AccessibilityManager::PrefHandler 178 // AccessibilityManager::PrefHandler
179 179
180 AccessibilityManager::PrefHandler::PrefHandler(const char* pref_path) 180 AccessibilityManager::PrefHandler::PrefHandler(const char* pref_path)
181 : pref_path_(pref_path) {} 181 : pref_path_(pref_path) {}
182 182
183 AccessibilityManager::PrefHandler::~PrefHandler() {} 183 AccessibilityManager::PrefHandler::~PrefHandler() {}
184 184
185 void AccessibilityManager::PrefHandler::HandleProfileChanged( 185 void AccessibilityManager::PrefHandler::HandleProfileChanged(
186 Profile* previous_profile, Profile* current_profile) { 186 Profile* previous_profile, Profile* current_profile) {
187 // Returns if the current profile is null. 187 // Returns if the current profile is null.
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 void AccessibilityManager::UpdateBrailleImeState() { 1087 void AccessibilityManager::UpdateBrailleImeState() {
1088 if (!profile_) 1088 if (!profile_)
1089 return; 1089 return;
1090 PrefService* pref_service = profile_->GetPrefs(); 1090 PrefService* pref_service = profile_->GetPrefs();
1091 std::string preload_engines_str = 1091 std::string preload_engines_str =
1092 pref_service->GetString(prefs::kLanguagePreloadEngines); 1092 pref_service->GetString(prefs::kLanguagePreloadEngines);
1093 std::vector<base::StringPiece> preload_engines = base::SplitStringPiece( 1093 std::vector<base::StringPiece> preload_engines = base::SplitStringPiece(
1094 preload_engines_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 1094 preload_engines_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
1095 std::vector<base::StringPiece>::iterator it = 1095 std::vector<base::StringPiece>::iterator it =
1096 std::find(preload_engines.begin(), preload_engines.end(), 1096 std::find(preload_engines.begin(), preload_engines.end(),
1097 extension_misc::kBrailleImeEngineId); 1097 extension_ime_util::kBrailleImeEngineId);
1098 bool is_enabled = (it != preload_engines.end()); 1098 bool is_enabled = (it != preload_engines.end());
1099 bool should_be_enabled = 1099 bool should_be_enabled =
1100 (spoken_feedback_enabled_ && braille_display_connected_); 1100 (spoken_feedback_enabled_ && braille_display_connected_);
1101 if (is_enabled == should_be_enabled) 1101 if (is_enabled == should_be_enabled)
1102 return; 1102 return;
1103 if (should_be_enabled) 1103 if (should_be_enabled)
1104 preload_engines.push_back(extension_misc::kBrailleImeEngineId); 1104 preload_engines.push_back(extension_ime_util::kBrailleImeEngineId);
1105 else 1105 else
1106 preload_engines.erase(it); 1106 preload_engines.erase(it);
1107 pref_service->SetString(prefs::kLanguagePreloadEngines, 1107 pref_service->SetString(prefs::kLanguagePreloadEngines,
1108 base::JoinString(preload_engines, ",")); 1108 base::JoinString(preload_engines, ","));
1109 braille_ime_current_ = false; 1109 braille_ime_current_ = false;
1110 } 1110 }
1111 1111
1112 // Overridden from InputMethodManager::Observer. 1112 // Overridden from InputMethodManager::Observer.
1113 void AccessibilityManager::InputMethodChanged( 1113 void AccessibilityManager::InputMethodChanged(
1114 input_method::InputMethodManager* manager, 1114 input_method::InputMethodManager* manager,
1115 Profile* /* profile */, 1115 Profile* /* profile */,
1116 bool show_message) { 1116 bool show_message) {
1117 // Sticky keys is implemented only in ash. 1117 // Sticky keys is implemented only in ash.
1118 // TODO(dpolukhin): support Athena, crbug.com/408733. 1118 // TODO(dpolukhin): support Athena, crbug.com/408733.
1119 if (!ash_util::IsRunningInMash()) { 1119 if (!ash_util::IsRunningInMash()) {
1120 ash::Shell::Get()->sticky_keys_controller()->SetModifiersEnabled( 1120 ash::Shell::Get()->sticky_keys_controller()->SetModifiersEnabled(
1121 manager->IsISOLevel5ShiftUsedByCurrentInputMethod(), 1121 manager->IsISOLevel5ShiftUsedByCurrentInputMethod(),
1122 manager->IsAltGrUsedByCurrentInputMethod()); 1122 manager->IsAltGrUsedByCurrentInputMethod());
1123 } 1123 }
1124 const chromeos::input_method::InputMethodDescriptor descriptor = 1124 const chromeos::input_method::InputMethodDescriptor descriptor =
1125 manager->GetActiveIMEState()->GetCurrentInputMethod(); 1125 manager->GetActiveIMEState()->GetCurrentInputMethod();
1126 braille_ime_current_ = 1126 braille_ime_current_ =
1127 (descriptor.id() == extension_misc::kBrailleImeEngineId); 1127 (descriptor.id() == extension_ime_util::kBrailleImeEngineId);
1128 } 1128 }
1129 1129
1130 void AccessibilityManager::OnSessionStateChanged() { 1130 void AccessibilityManager::OnSessionStateChanged() {
1131 if (!chromevox_panel_) 1131 if (!chromevox_panel_)
1132 return; 1132 return;
1133 if (chromevox_panel_->for_blocked_user_session() == 1133 if (chromevox_panel_->for_blocked_user_session() ==
1134 session_manager::SessionManager::Get()->IsUserSessionBlocked()) { 1134 session_manager::SessionManager::Get()->IsUserSessionBlocked()) {
1135 return; 1135 return;
1136 } 1136 }
1137 1137
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 NotifyAccessibilityStatusChanged(details); 1419 NotifyAccessibilityStatusChanged(details);
1420 } 1420 }
1421 1421
1422 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) { 1422 void AccessibilityManager::OnBrailleKeyEvent(const KeyEvent& event) {
1423 // Ensure the braille IME is active on braille keyboard (dots) input. 1423 // Ensure the braille IME is active on braille keyboard (dots) input.
1424 if ((event.command == 1424 if ((event.command ==
1425 extensions::api::braille_display_private::KEY_COMMAND_DOTS) && 1425 extensions::api::braille_display_private::KEY_COMMAND_DOTS) &&
1426 !braille_ime_current_) { 1426 !braille_ime_current_) {
1427 input_method::InputMethodManager::Get() 1427 input_method::InputMethodManager::Get()
1428 ->GetActiveIMEState() 1428 ->GetActiveIMEState()
1429 ->ChangeInputMethod(extension_misc::kBrailleImeEngineId, 1429 ->ChangeInputMethod(extension_ime_util::kBrailleImeEngineId,
1430 false /* show_message */); 1430 false /* show_message */);
1431 } 1431 }
1432 } 1432 }
1433 1433
1434 void AccessibilityManager::OnExtensionUnloaded( 1434 void AccessibilityManager::OnExtensionUnloaded(
1435 content::BrowserContext* browser_context, 1435 content::BrowserContext* browser_context,
1436 const extensions::Extension* extension, 1436 const extensions::Extension* extension,
1437 extensions::UnloadedExtensionReason reason) { 1437 extensions::UnloadedExtensionReason reason) {
1438 if (extension->id() == keyboard_listener_extension_id_) { 1438 if (extension->id() == keyboard_listener_extension_id_) {
1439 keyboard_listener_extension_id_ = std::string(); 1439 keyboard_listener_extension_id_ = std::string();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 content::BrowserContext* context) { 1526 content::BrowserContext* context) {
1527 keyboard_listener_extension_id_ = id; 1527 keyboard_listener_extension_id_ = id;
1528 1528
1529 extensions::ExtensionRegistry* registry = 1529 extensions::ExtensionRegistry* registry =
1530 extensions::ExtensionRegistry::Get(context); 1530 extensions::ExtensionRegistry::Get(context);
1531 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) 1531 if (!extension_registry_observer_.IsObserving(registry) && !id.empty())
1532 extension_registry_observer_.Add(registry); 1532 extension_registry_observer_.Add(registry);
1533 } 1533 }
1534 1534
1535 } // namespace chromeos 1535 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698