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

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

Issue 2216433004: Add skeleton for select-to-speak component extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV)); 297 bundle.GetRawDataResource(IDR_SOUND_ENTER_SCREEN_WAV));
298 298
299 base::FilePath resources_path; 299 base::FilePath resources_path;
300 if (!PathService::Get(chrome::DIR_RESOURCES, &resources_path)) 300 if (!PathService::Get(chrome::DIR_RESOURCES, &resources_path))
301 NOTREACHED(); 301 NOTREACHED();
302 chromevox_loader_ = base::WrapUnique(new AccessibilityExtensionLoader( 302 chromevox_loader_ = base::WrapUnique(new AccessibilityExtensionLoader(
303 extension_misc::kChromeVoxExtensionId, 303 extension_misc::kChromeVoxExtensionId,
304 resources_path.Append(extension_misc::kChromeVoxExtensionPath), 304 resources_path.Append(extension_misc::kChromeVoxExtensionPath),
305 base::Bind(&AccessibilityManager::PostUnloadChromeVox, 305 base::Bind(&AccessibilityManager::PostUnloadChromeVox,
306 weak_ptr_factory_.GetWeakPtr()))); 306 weak_ptr_factory_.GetWeakPtr())));
307 select_to_speak_loader_ = base::WrapUnique(new AccessibilityExtensionLoader(
308 extension_misc::kSelectToSpeakExtensionId,
309 resources_path.Append(extension_misc::kSelectToSpeakExtensionPath),
310 base::Closure()));
307 } 311 }
308 312
309 AccessibilityManager::~AccessibilityManager() { 313 AccessibilityManager::~AccessibilityManager() {
310 CHECK(this == g_accessibility_manager); 314 CHECK(this == g_accessibility_manager);
311 AccessibilityStatusEventDetails details(ACCESSIBILITY_MANAGER_SHUTDOWN, false, 315 AccessibilityStatusEventDetails details(ACCESSIBILITY_MANAGER_SHUTDOWN, false,
312 ash::A11Y_NOTIFICATION_NONE); 316 ash::A11Y_NOTIFICATION_NONE);
313 NotifyAccessibilityStatusChanged(details); 317 NotifyAccessibilityStatusChanged(details);
314 input_method::InputMethodManager::Get()->RemoveObserver(this); 318 input_method::InputMethodManager::Get()->RemoveObserver(this);
315 319
316 if (chromevox_panel_) { 320 if (chromevox_panel_) {
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 if (!profile_) 836 if (!profile_)
833 return; 837 return;
834 838
835 const bool enabled = profile_->GetPrefs()->GetBoolean( 839 const bool enabled = profile_->GetPrefs()->GetBoolean(
836 prefs::kAccessibilitySelectToSpeakEnabled); 840 prefs::kAccessibilitySelectToSpeakEnabled);
837 841
838 if (select_to_speak_enabled_ == enabled) 842 if (select_to_speak_enabled_ == enabled)
839 return; 843 return;
840 select_to_speak_enabled_ = enabled; 844 select_to_speak_enabled_ = enabled;
841 845
842 // TODO(dmazzoni): implement feature here. 846 if (enabled) {
847 select_to_speak_loader_->Load(profile_, "", base::Closure());
David Tseng 2016/09/16 21:16:02 "" /* param_name */
dmazzoni 2016/09/16 22:06:20 Done
848 } else {
849 select_to_speak_loader_->Unload();
850 }
843 } 851 }
844 852
845 void AccessibilityManager::SetSwitchAccessEnabled(bool enabled) { 853 void AccessibilityManager::SetSwitchAccessEnabled(bool enabled) {
846 if (!profile_) 854 if (!profile_)
847 return; 855 return;
848 856
849 PrefService* pref_service = profile_->GetPrefs(); 857 PrefService* pref_service = profile_->GetPrefs();
850 pref_service->SetBoolean(prefs::kAccessibilitySwitchAccessEnabled, enabled); 858 pref_service->SetBoolean(prefs::kAccessibilitySwitchAccessEnabled, enabled);
851 pref_service->CommitPendingWrite(); 859 pref_service->CommitPendingWrite();
852 } 860 }
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 content::BrowserContext* context) { 1341 content::BrowserContext* context) {
1334 keyboard_listener_extension_id_ = id; 1342 keyboard_listener_extension_id_ = id;
1335 1343
1336 extensions::ExtensionRegistry* registry = 1344 extensions::ExtensionRegistry* registry =
1337 extensions::ExtensionRegistry::Get(context); 1345 extensions::ExtensionRegistry::Get(context);
1338 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) 1346 if (!extension_registry_observer_.IsObserving(registry) && !id.empty())
1339 extension_registry_observer_.Add(registry); 1347 extension_registry_observer_.Add(registry);
1340 } 1348 }
1341 1349
1342 } // namespace chromeos 1350 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698