| 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.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/accessibility_util.h" | 10 #include "chrome/browser/chromeos/accessibility_util.h" |
| 11 #include "chrome/browser/extensions/extension_accessibility_api.h" | 11 #include "chrome/browser/extensions/extension_accessibility_api.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/common/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 19 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "views/accelerator.h" | 21 #include "views/accelerator.h" |
| 22 #include "views/view.h" | 22 #include "views/view.h" |
| 23 | 23 |
| 24 namespace chromeos { | 24 namespace chromeos { |
| 25 | 25 |
| 26 scoped_ptr<views::Accelerator> WizardAccessibilityHelper::accelerator_; | 26 scoped_ptr<views::Accelerator> WizardAccessibilityHelper::accelerator_; |
| 27 | 27 |
| 28 // static | 28 // static |
| (...skipping 24 matching lines...) Expand all Loading... |
| 53 // SetAccessibilityEnabled(true) fully enables accessibility. Init() is | 53 // SetAccessibilityEnabled(true) fully enables accessibility. Init() is |
| 54 // necessary during startup when the global accessibility pref is set but | 54 // necessary during startup when the global accessibility pref is set but |
| 55 // the notifications are not registered. | 55 // the notifications are not registered. |
| 56 SetAccessibilityEnabled(true); | 56 SetAccessibilityEnabled(true); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 void WizardAccessibilityHelper::RegisterNotifications() { | 60 void WizardAccessibilityHelper::RegisterNotifications() { |
| 61 registrar_.Add(accessibility_handler_.get(), | 61 registrar_.Add(accessibility_handler_.get(), |
| 62 chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, | 62 chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_FOCUSED, |
| 63 NotificationService::AllSources()); | 63 content::NotificationService::AllSources()); |
| 64 registrar_.Add(accessibility_handler_.get(), | 64 registrar_.Add(accessibility_handler_.get(), |
| 65 chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_ACTION, | 65 chrome::NOTIFICATION_ACCESSIBILITY_CONTROL_ACTION, |
| 66 NotificationService::AllSources()); | 66 content::NotificationService::AllSources()); |
| 67 registrar_.Add(accessibility_handler_.get(), | 67 registrar_.Add(accessibility_handler_.get(), |
| 68 chrome::NOTIFICATION_ACCESSIBILITY_TEXT_CHANGED, | 68 chrome::NOTIFICATION_ACCESSIBILITY_TEXT_CHANGED, |
| 69 NotificationService::AllSources()); | 69 content::NotificationService::AllSources()); |
| 70 registrar_.Add(accessibility_handler_.get(), | 70 registrar_.Add(accessibility_handler_.get(), |
| 71 chrome::NOTIFICATION_ACCESSIBILITY_MENU_OPENED, | 71 chrome::NOTIFICATION_ACCESSIBILITY_MENU_OPENED, |
| 72 NotificationService::AllSources()); | 72 content::NotificationService::AllSources()); |
| 73 registrar_.Add(accessibility_handler_.get(), | 73 registrar_.Add(accessibility_handler_.get(), |
| 74 chrome::NOTIFICATION_ACCESSIBILITY_MENU_CLOSED, | 74 chrome::NOTIFICATION_ACCESSIBILITY_MENU_CLOSED, |
| 75 NotificationService::AllSources()); | 75 content::NotificationService::AllSources()); |
| 76 registered_notifications_ = true; | 76 registered_notifications_ = true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void WizardAccessibilityHelper::UnregisterNotifications() { | 79 void WizardAccessibilityHelper::UnregisterNotifications() { |
| 80 if (!registered_notifications_) | 80 if (!registered_notifications_) |
| 81 return; | 81 return; |
| 82 registrar_.RemoveAll(); | 82 registrar_.RemoveAll(); |
| 83 registered_notifications_ = false; | 83 registered_notifications_ = false; |
| 84 } | 84 } |
| 85 | 85 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 107 if (registered_notifications_) | 107 if (registered_notifications_) |
| 108 UnregisterNotifications(); | 108 UnregisterNotifications(); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 void WizardAccessibilityHelper::SetAccessibilityEnabled(bool enabled) { | 112 void WizardAccessibilityHelper::SetAccessibilityEnabled(bool enabled) { |
| 113 accessibility::EnableAccessibility(enabled, NULL); | 113 accessibility::EnableAccessibility(enabled, NULL); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace chromeos | 116 } // namespace chromeos |
| OLD | NEW |