OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_controller.h" | 5 #include "chrome/browser/chromeos/login/wizard_controller.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 | 10 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 is_out_of_box_(false), | 129 is_out_of_box_(false), |
130 host_(host), | 130 host_(host), |
131 oobe_display_(oobe_display), | 131 oobe_display_(oobe_display), |
132 usage_statistics_reporting_(true), | 132 usage_statistics_reporting_(true), |
133 skip_update_enroll_after_eula_(false), | 133 skip_update_enroll_after_eula_(false), |
134 login_screen_started_(false), | 134 login_screen_started_(false), |
135 user_image_screen_return_to_previous_hack_(false), | 135 user_image_screen_return_to_previous_hack_(false), |
136 weak_factory_(this) { | 136 weak_factory_(this) { |
137 DCHECK(default_controller_ == NULL); | 137 DCHECK(default_controller_ == NULL); |
138 default_controller_ = this; | 138 default_controller_ = this; |
139 | 139 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); |
140 registrar_.Add( | 140 CHECK(accessibility_manager); |
141 this, | 141 accessibility_subscription_ = accessibility_manager->RegisterCallback( |
142 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK, | 142 base::Bind(&WizardController::OnAccessibilityStatusChanged, |
143 content::NotificationService::AllSources()); | 143 base::Unretained(this))); |
144 } | 144 } |
145 | 145 |
146 WizardController::~WizardController() { | 146 WizardController::~WizardController() { |
147 if (default_controller_ == this) { | 147 if (default_controller_ == this) { |
148 default_controller_ = NULL; | 148 default_controller_ = NULL; |
149 } else { | 149 } else { |
150 NOTREACHED() << "More than one controller are alive."; | 150 NOTREACHED() << "More than one controller are alive."; |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 VLOG(1) << "Showing error screen."; | 819 VLOG(1) << "Showing error screen."; |
820 SetCurrentScreen(GetErrorScreen()); | 820 SetCurrentScreen(GetErrorScreen()); |
821 } | 821 } |
822 | 822 |
823 void WizardController::HideErrorScreen(WizardScreen* parent_screen) { | 823 void WizardController::HideErrorScreen(WizardScreen* parent_screen) { |
824 DCHECK(parent_screen); | 824 DCHECK(parent_screen); |
825 VLOG(1) << "Hiding error screen."; | 825 VLOG(1) << "Hiding error screen."; |
826 SetCurrentScreen(parent_screen); | 826 SetCurrentScreen(parent_screen); |
827 } | 827 } |
828 | 828 |
829 void WizardController::Observe(int type, | 829 void WizardController::OnAccessibilityStatusChanged( |
830 const content::NotificationSource& source, | 830 const AccessibilityStatusEventDetails& details) { |
831 const content::NotificationDetails& details) { | 831 enum AccessibilityNotificationType type = details.notification_type; |
832 if (type != chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { | 832 if (type == ACCESSIBILITY_MANAGER_SHUTDOWN) { |
833 NOTREACHED(); | 833 accessibility_subscription_.reset(); |
| 834 return; |
| 835 } else if (type != ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK || !details.enabled) { |
834 return; | 836 return; |
835 } | 837 } |
836 const AccessibilityStatusEventDetails* a11y_details = | 838 |
837 content::Details<const AccessibilityStatusEventDetails>(details).ptr(); | |
838 CrasAudioHandler* cras = CrasAudioHandler::Get(); | 839 CrasAudioHandler* cras = CrasAudioHandler::Get(); |
839 if (!a11y_details->enabled) | |
840 return; | |
841 if (cras->IsOutputMuted()) { | 840 if (cras->IsOutputMuted()) { |
842 cras->SetOutputMute(false); | 841 cras->SetOutputMute(false); |
843 cras->SetOutputVolumePercent(kMinAudibleOutputVolumePercent); | 842 cras->SetOutputVolumePercent(kMinAudibleOutputVolumePercent); |
844 } else if (cras->GetOutputVolumePercent() < kMinAudibleOutputVolumePercent) { | 843 } else if (cras->GetOutputVolumePercent() < kMinAudibleOutputVolumePercent) { |
845 cras->SetOutputVolumePercent(kMinAudibleOutputVolumePercent); | 844 cras->SetOutputVolumePercent(kMinAudibleOutputVolumePercent); |
846 } | 845 } |
847 } | 846 } |
848 | 847 |
849 void WizardController::AutoLaunchKioskApp() { | 848 void WizardController::AutoLaunchKioskApp() { |
850 KioskAppManager::App app_data; | 849 KioskAppManager::App app_data; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 ShowErrorScreen(); | 892 ShowErrorScreen(); |
894 } | 893 } |
895 | 894 |
896 PrefService* WizardController::GetLocalState() { | 895 PrefService* WizardController::GetLocalState() { |
897 if (local_state_for_testing_) | 896 if (local_state_for_testing_) |
898 return local_state_for_testing_; | 897 return local_state_for_testing_; |
899 return g_browser_process->local_state(); | 898 return g_browser_process->local_state(); |
900 } | 899 } |
901 | 900 |
902 } // namespace chromeos | 901 } // namespace chromeos |
OLD | NEW |