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

Side by Side Diff: chrome/browser/chromeos/accessibility_util.cc

Issue 7563004: Add logging code to ensure that ChromeVox is loaded/unloaded (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_util.h" 5 #include "chrome/browser/chromeos/accessibility_util.h"
6 6
7 #include "base/logging.h"
7 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/extensions/extension_accessibility_api.h" 9 #include "chrome/browser/extensions/extension_accessibility_api.h"
9 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
13 #include "grit/browser_resources.h" 14 #include "grit/browser_resources.h"
14 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
15 16
16 namespace chromeos { 17 namespace chromeos {
17 namespace accessibility { 18 namespace accessibility {
18 19
19 20
20 void EnableAccessibility(bool enabled) { 21 void EnableAccessibility(bool enabled) {
21 bool accessibility_enabled = g_browser_process && 22 bool accessibility_enabled = g_browser_process &&
22 g_browser_process->local_state()->GetBoolean( 23 g_browser_process->local_state()->GetBoolean(
23 prefs::kAccessibilityEnabled); 24 prefs::kAccessibilityEnabled);
24 if (accessibility_enabled == enabled) { 25 if (accessibility_enabled == enabled) {
26 LOG(INFO) << "Accessibility is already " <<
27 (enabled ? "enabled" : "diabled") << ". Going to do nothing.";
25 return; 28 return;
26 } 29 }
27 30
28 g_browser_process->local_state()->SetBoolean( 31 g_browser_process->local_state()->SetBoolean(
29 prefs::kAccessibilityEnabled, enabled); 32 prefs::kAccessibilityEnabled, enabled);
30 ExtensionAccessibilityEventRouter::GetInstance()-> 33 ExtensionAccessibilityEventRouter::GetInstance()->
31 SetAccessibilityEnabled(enabled); 34 SetAccessibilityEnabled(enabled);
32 35
33 // Load/Unload ChromeVox 36 // Load/Unload ChromeVox
34 Profile* profile = ProfileManager::GetDefaultProfile(); 37 Profile* profile = ProfileManager::GetDefaultProfile();
35 ExtensionService* extension_service = 38 ExtensionService* extension_service =
36 profile->GetExtensionService(); 39 profile->GetExtensionService();
37 std::string manifest = ResourceBundle::GetSharedInstance(). 40 std::string manifest = ResourceBundle::GetSharedInstance().
38 GetRawDataResource(IDR_CHROMEVOX_MANIFEST).as_string(); 41 GetRawDataResource(IDR_CHROMEVOX_MANIFEST).as_string();
39 FilePath path = FilePath(extension_misc::kAccessExtensionPath) 42 FilePath path = FilePath(extension_misc::kAccessExtensionPath)
40 .AppendASCII(extension_misc::kChromeVoxDirectoryName); 43 .AppendASCII(extension_misc::kChromeVoxDirectoryName);
41 ExtensionService::ComponentExtensionInfo info(manifest, path); 44 ExtensionService::ComponentExtensionInfo info(manifest, path);
42 if (enabled) { // Load ChromeVox 45 if (enabled) { // Load ChromeVox
43 extension_service->register_component_extension(info); 46 extension_service->register_component_extension(info);
44 extension_service->LoadComponentExtension(info); 47 extension_service->LoadComponentExtension(info);
48 LOG(INFO) << "ChromeVox was Loaded.";
45 } else { // Unload ChromeVox 49 } else { // Unload ChromeVox
46 extension_service->UnloadComponentExtension(info); 50 extension_service->UnloadComponentExtension(info);
47 extension_service->UnregisterComponentExtension(info); 51 extension_service->UnregisterComponentExtension(info);
52 LOG(INFO) << "ChromeVox was Unloaded.";
48 } 53 }
49 } 54 }
50 55
51 void ToggleAccessibility() { 56 void ToggleAccessibility() {
52 bool accessibility_enabled = g_browser_process && 57 bool accessibility_enabled = g_browser_process &&
53 g_browser_process->local_state()->GetBoolean( 58 g_browser_process->local_state()->GetBoolean(
54 prefs::kAccessibilityEnabled); 59 prefs::kAccessibilityEnabled);
55 accessibility_enabled = !accessibility_enabled; 60 accessibility_enabled = !accessibility_enabled;
56 EnableAccessibility(accessibility_enabled); 61 EnableAccessibility(accessibility_enabled);
57 }; 62 };
58 63
59 } // namespace accessibility 64 } // namespace accessibility
60 } // namespace chromeos 65 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698