| OLD | NEW |
| 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/login/wizard_accessibility_helper.h" | 5 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/extensions/extension_accessibility_api.h" | 10 #include "chrome/browser/extensions/extension_accessibility_api.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 15 #include "content/common/notification_registrar.h" | 16 #include "content/common/notification_registrar.h" |
| 16 #include "content/common/notification_service.h" | 17 #include "content/common/notification_service.h" |
| 17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "views/accelerator.h" | 20 #include "views/accelerator.h" |
| 20 #include "views/view.h" | 21 #include "views/view.h" |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 | 24 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 50 RegisterNotifications(); | 51 RegisterNotifications(); |
| 51 // SetAccessibilityEnabled(true) fully enables accessibility. Init() is | 52 // SetAccessibilityEnabled(true) fully enables accessibility. Init() is |
| 52 // necessary during startup when the global accessibility pref is set but | 53 // necessary during startup when the global accessibility pref is set but |
| 53 // the notifications are not registered. | 54 // the notifications are not registered. |
| 54 SetAccessibilityEnabled(true); | 55 SetAccessibilityEnabled(true); |
| 55 } | 56 } |
| 56 } | 57 } |
| 57 | 58 |
| 58 void WizardAccessibilityHelper::RegisterNotifications() { | 59 void WizardAccessibilityHelper::RegisterNotifications() { |
| 59 registrar_.Add(accessibility_handler_.get(), | 60 registrar_.Add(accessibility_handler_.get(), |
| 60 NotificationType::ACCESSIBILITY_CONTROL_FOCUSED, | 61 chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, |
| 61 NotificationService::AllSources()); | 62 NotificationService::AllSources()); |
| 62 registrar_.Add(accessibility_handler_.get(), | 63 registrar_.Add(accessibility_handler_.get(), |
| 63 NotificationType::ACCESSIBILITY_CONTROL_ACTION, | 64 chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_ACTION, |
| 64 NotificationService::AllSources()); | 65 NotificationService::AllSources()); |
| 65 registrar_.Add(accessibility_handler_.get(), | 66 registrar_.Add(accessibility_handler_.get(), |
| 66 NotificationType::ACCESSIBILITY_TEXT_CHANGED, | 67 chrome::NOTIFICATION_ACCESSIBILITY_TEXT_CHANGED, |
| 67 NotificationService::AllSources()); | 68 NotificationService::AllSources()); |
| 68 registrar_.Add(accessibility_handler_.get(), | 69 registrar_.Add(accessibility_handler_.get(), |
| 69 NotificationType::ACCESSIBILITY_MENU_OPENED, | 70 chrome::NOTIFICATION_ACCESSIBILITY_MENU_OPENED, |
| 70 NotificationService::AllSources()); | 71 NotificationService::AllSources()); |
| 71 registrar_.Add(accessibility_handler_.get(), | 72 registrar_.Add(accessibility_handler_.get(), |
| 72 NotificationType::ACCESSIBILITY_MENU_CLOSED, | 73 chrome::NOTIFICATION_ACCESSIBILITY_MENU_CLOSED, |
| 73 NotificationService::AllSources()); | 74 NotificationService::AllSources()); |
| 74 registered_notifications_ = true; | 75 registered_notifications_ = true; |
| 75 } | 76 } |
| 76 | 77 |
| 77 void WizardAccessibilityHelper::UnregisterNotifications() { | 78 void WizardAccessibilityHelper::UnregisterNotifications() { |
| 78 if (!registered_notifications_) | 79 if (!registered_notifications_) |
| 79 return; | 80 return; |
| 80 registrar_.RemoveAll(); | 81 registrar_.RemoveAll(); |
| 81 registered_notifications_ = false; | 82 registered_notifications_ = false; |
| 82 } | 83 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 SetAccessibilityEnabled(enabled); | 119 SetAccessibilityEnabled(enabled); |
| 119 if (doSpeak) { | 120 if (doSpeak) { |
| 120 accessibility_handler_->Speak(enabled ? | 121 accessibility_handler_->Speak(enabled ? |
| 121 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_ENABLED).c_str() : | 122 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_ENABLED).c_str() : |
| 122 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_DISABLED).c_str(), | 123 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_DISABLED).c_str(), |
| 123 false, true); | 124 false, true); |
| 124 } | 125 } |
| 125 } | 126 } |
| 126 | 127 |
| 127 } // namespace chromeos | 128 } // namespace chromeos |
| OLD | NEW |