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

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

Issue 2493923002: Select-to-speak event handler (Closed)
Patch Set: Fix presubmit warning Created 4 years 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 20 matching lines...) Expand all
31 #include "base/strings/string_split.h" 31 #include "base/strings/string_split.h"
32 #include "base/strings/string_util.h" 32 #include "base/strings/string_util.h"
33 #include "base/time/time.h" 33 #include "base/time/time.h"
34 #include "base/values.h" 34 #include "base/values.h"
35 #include "chrome/browser/accessibility/accessibility_extension_api.h" 35 #include "chrome/browser/accessibility/accessibility_extension_api.h"
36 #include "chrome/browser/browser_process.h" 36 #include "chrome/browser/browser_process.h"
37 #include "chrome/browser/chrome_notification_types.h" 37 #include "chrome/browser/chrome_notification_types.h"
38 #include "chrome/browser/chromeos/accessibility/accessibility_extension_loader.h " 38 #include "chrome/browser/chromeos/accessibility/accessibility_extension_loader.h "
39 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager. h" 39 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager. h"
40 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 40 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
41 #include "chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h"
41 #include "chrome/browser/chromeos/profiles/profile_helper.h" 42 #include "chrome/browser/chromeos/profiles/profile_helper.h"
42 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" 43 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h"
43 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con troller.h" 44 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con troller.h"
44 #include "chrome/browser/extensions/extension_service.h" 45 #include "chrome/browser/extensions/extension_service.h"
45 #include "chrome/browser/prefs/incognito_mode_prefs.h" 46 #include "chrome/browser/prefs/incognito_mode_prefs.h"
46 #include "chrome/browser/profiles/profile.h" 47 #include "chrome/browser/profiles/profile.h"
47 #include "chrome/browser/profiles/profile_manager.h" 48 #include "chrome/browser/profiles/profile_manager.h"
48 #include "chrome/browser/ui/ash/ash_util.h" 49 #include "chrome/browser/ui/ash/ash_util.h"
49 #include "chrome/common/chrome_paths.h" 50 #include "chrome/common/chrome_paths.h"
50 #include "chrome/common/extensions/api/accessibility_private.h" 51 #include "chrome/common/extensions/api/accessibility_private.h"
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 const bool enabled = profile_->GetPrefs()->GetBoolean( 855 const bool enabled = profile_->GetPrefs()->GetBoolean(
855 prefs::kAccessibilitySelectToSpeakEnabled); 856 prefs::kAccessibilitySelectToSpeakEnabled);
856 857
857 if (select_to_speak_enabled_ == enabled) 858 if (select_to_speak_enabled_ == enabled)
858 return; 859 return;
859 select_to_speak_enabled_ = enabled; 860 select_to_speak_enabled_ = enabled;
860 861
861 if (enabled) { 862 if (enabled) {
862 select_to_speak_loader_->Load(profile_, "" /* init_script_str */, 863 select_to_speak_loader_->Load(profile_, "" /* init_script_str */,
863 base::Closure() /* done_cb */); 864 base::Closure() /* done_cb */);
865 select_to_speak_event_handler_.reset(
866 new chromeos::SelectToSpeakEventHandler());
864 } else { 867 } else {
865 select_to_speak_loader_->Unload(); 868 select_to_speak_loader_->Unload();
869 select_to_speak_event_handler_.reset(nullptr);
866 } 870 }
867 } 871 }
868 872
869 void AccessibilityManager::SetSwitchAccessEnabled(bool enabled) { 873 void AccessibilityManager::SetSwitchAccessEnabled(bool enabled) {
870 if (!profile_) 874 if (!profile_)
871 return; 875 return;
872 876
873 PrefService* pref_service = profile_->GetPrefs(); 877 PrefService* pref_service = profile_->GetPrefs();
874 pref_service->SetBoolean(prefs::kAccessibilitySwitchAccessEnabled, enabled); 878 pref_service->SetBoolean(prefs::kAccessibilitySwitchAccessEnabled, enabled);
875 pref_service->CommitPendingWrite(); 879 pref_service->CommitPendingWrite();
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 content::BrowserContext* context) { 1373 content::BrowserContext* context) {
1370 keyboard_listener_extension_id_ = id; 1374 keyboard_listener_extension_id_ = id;
1371 1375
1372 extensions::ExtensionRegistry* registry = 1376 extensions::ExtensionRegistry* registry =
1373 extensions::ExtensionRegistry::Get(context); 1377 extensions::ExtensionRegistry::Get(context);
1374 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) 1378 if (!extension_registry_observer_.IsObserving(registry) && !id.empty())
1375 extension_registry_observer_.Add(registry); 1379 extension_registry_observer_.Add(registry);
1376 } 1380 }
1377 1381
1378 } // namespace chromeos 1382 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698