| OLD | NEW |
| 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 "ash/autoclick/autoclick_controller.h" | 7 #include "ash/autoclick/autoclick_controller.h" |
| 8 #include "ash/high_contrast/high_contrast_controller.h" | 8 #include "ash/high_contrast/high_contrast_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/tray/system_tray_notifier.h" | 10 #include "ash/system/tray/system_tray_notifier.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 void AccessibilityManager::PrefHandler::HandleProfileChanged( | 209 void AccessibilityManager::PrefHandler::HandleProfileChanged( |
| 210 Profile* previous_profile, Profile* current_profile) { | 210 Profile* previous_profile, Profile* current_profile) { |
| 211 // Returns if the current profile is null. | 211 // Returns if the current profile is null. |
| 212 if (!current_profile) | 212 if (!current_profile) |
| 213 return; | 213 return; |
| 214 | 214 |
| 215 // If the user set a pref value on the login screen and is now starting a | 215 // If the user set a pref value on the login screen and is now starting a |
| 216 // session with a new profile, copy the pref value to the profile. | 216 // session with a new profile, copy the pref value to the profile. |
| 217 if ((previous_profile && | 217 if ((previous_profile && |
| 218 ProfileHelper::IsSigninProfile(previous_profile) && | 218 previous_profile->IsLoginProfile() && |
| 219 current_profile->IsNewProfile() && | 219 current_profile->IsNewProfile() && |
| 220 !ProfileHelper::IsSigninProfile(current_profile)) || | 220 !current_profile->IsLoginProfile()) || |
| 221 // Special case for Guest mode: | 221 // Special case for Guest mode: |
| 222 // Guest mode launches a guest-mode browser process before session starts, | 222 // Guest mode launches a guest-mode browser process before session starts, |
| 223 // so the previous profile is null. | 223 // so the previous profile is null. |
| 224 (!previous_profile && | 224 (!previous_profile && |
| 225 current_profile->IsGuestSession())) { | 225 current_profile->IsGuestSession())) { |
| 226 // Returns if the pref has not been set by the user. | 226 // Returns if the pref has not been set by the user. |
| 227 const PrefService::Preference* pref = ProfileHelper::GetSigninProfile()-> | 227 const PrefService::Preference* pref = ProfileHelper::GetSigninProfile()-> |
| 228 GetPrefs()->FindPreference(pref_path_); | 228 GetPrefs()->FindPreference(pref_path_); |
| 229 if (!pref || !pref->IsUserControlled()) | 229 if (!pref || !pref->IsUserControlled()) |
| 230 return; | 230 return; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 } | 421 } |
| 422 | 422 |
| 423 void AccessibilityManager::LoadChromeVoxToUserScreen() { | 423 void AccessibilityManager::LoadChromeVoxToUserScreen() { |
| 424 if (chrome_vox_loaded_on_user_screen_) | 424 if (chrome_vox_loaded_on_user_screen_) |
| 425 return; | 425 return; |
| 426 | 426 |
| 427 // Determine whether an OOBE screen is currently being shown. If so, | 427 // Determine whether an OOBE screen is currently being shown. If so, |
| 428 // ChromeVox will be injected directly into that screen. | 428 // ChromeVox will be injected directly into that screen. |
| 429 content::WebUI* login_web_ui = NULL; | 429 content::WebUI* login_web_ui = NULL; |
| 430 | 430 |
| 431 if (ProfileHelper::IsSigninProfile(profile_)) { | 431 if (profile_->IsLoginProfile()) { |
| 432 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); | 432 LoginDisplayHost* login_display_host = LoginDisplayHostImpl::default_host(); |
| 433 if (login_display_host) { | 433 if (login_display_host) { |
| 434 WebUILoginView* web_ui_login_view = | 434 WebUILoginView* web_ui_login_view = |
| 435 login_display_host->GetWebUILoginView(); | 435 login_display_host->GetWebUILoginView(); |
| 436 if (web_ui_login_view) | 436 if (web_ui_login_view) |
| 437 login_web_ui = web_ui_login_view->GetWebUI(); | 437 login_web_ui = web_ui_login_view->GetWebUI(); |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 | 440 |
| 441 LoadChromeVoxExtension(profile_, login_web_ui); | 441 LoadChromeVoxExtension(profile_, login_web_ui); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 } | 696 } |
| 697 | 697 |
| 698 void AccessibilityManager::Observe( | 698 void AccessibilityManager::Observe( |
| 699 int type, | 699 int type, |
| 700 const content::NotificationSource& source, | 700 const content::NotificationSource& source, |
| 701 const content::NotificationDetails& details) { | 701 const content::NotificationDetails& details) { |
| 702 switch (type) { | 702 switch (type) { |
| 703 case chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE: { | 703 case chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE: { |
| 704 // Update |profile_| when entering the login screen. | 704 // Update |profile_| when entering the login screen. |
| 705 Profile* profile = ProfileManager::GetDefaultProfile(); | 705 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 706 if (ProfileHelper::IsSigninProfile(profile)) | 706 if (profile->IsLoginProfile()) |
| 707 SetProfile(profile); | 707 SetProfile(profile); |
| 708 break; | 708 break; |
| 709 } | 709 } |
| 710 case chrome::NOTIFICATION_SESSION_STARTED: | 710 case chrome::NOTIFICATION_SESSION_STARTED: |
| 711 // Update |profile_| when entering a session. | 711 // Update |profile_| when entering a session. |
| 712 SetProfile(ProfileManager::GetDefaultProfile()); | 712 SetProfile(ProfileManager::GetDefaultProfile()); |
| 713 break; | 713 break; |
| 714 case chrome::NOTIFICATION_PROFILE_DESTROYED: { | 714 case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
| 715 // Update |profile_| when exiting a session or shutting down. | 715 // Update |profile_| when exiting a session or shutting down. |
| 716 Profile* profile = content::Source<Profile>(source).ptr(); | 716 Profile* profile = content::Source<Profile>(source).ptr(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 727 UnloadChromeVoxFromLockScreen(); | 727 UnloadChromeVoxFromLockScreen(); |
| 728 | 728 |
| 729 if (spoken_feedback_enabled_) | 729 if (spoken_feedback_enabled_) |
| 730 LoadChromeVoxToUserScreen(); | 730 LoadChromeVoxToUserScreen(); |
| 731 } | 731 } |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 } | 734 } |
| 735 | 735 |
| 736 } // namespace chromeos | 736 } // namespace chromeos |
| OLD | NEW |