Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 const PrefService::Preference* pref = ProfileHelper::GetSigninProfile()-> | 358 const PrefService::Preference* pref = ProfileHelper::GetSigninProfile()-> |
| 359 GetPrefs()->FindPreference(pref_path_); | 359 GetPrefs()->FindPreference(pref_path_); |
| 360 if (!pref || !pref->IsUserControlled()) | 360 if (!pref || !pref->IsUserControlled()) |
| 361 return; | 361 return; |
| 362 | 362 |
| 363 // Copy the pref value from the signin screen. | 363 // Copy the pref value from the signin screen. |
| 364 const base::Value* value_on_login = pref->GetValue(); | 364 const base::Value* value_on_login = pref->GetValue(); |
| 365 PrefService* user_prefs = current_profile->GetPrefs(); | 365 PrefService* user_prefs = current_profile->GetPrefs(); |
| 366 user_prefs->Set(pref_path_, *value_on_login); | 366 user_prefs->Set(pref_path_, *value_on_login); |
| 367 } | 367 } |
| 368 | |
| 369 // Update the panel height in the shelf layout manager when the profile | |
| 370 // changes, since the shelf layout manager doesn't exist in the login profile. | |
| 371 if (g_accessibility_manager) | |
| 372 g_accessibility_manager->UpdateChromeVoxPanelHeight(); | |
|
xiyuan
2016/03/28 22:35:56
Do this in AccessibilityManager::SetProfile so tha
dmazzoni
2016/03/29 20:43:22
Done.
| |
| 368 } | 373 } |
| 369 | 374 |
| 370 /////////////////////////////////////////////////////////////////////////////// | 375 /////////////////////////////////////////////////////////////////////////////// |
| 371 // | 376 // |
| 372 // AccessibilityManager | 377 // AccessibilityManager |
| 373 | 378 |
| 374 // static | 379 // static |
| 375 void AccessibilityManager::Initialize() { | 380 void AccessibilityManager::Initialize() { |
| 376 CHECK(g_accessibility_manager == NULL); | 381 CHECK(g_accessibility_manager == NULL); |
| 377 g_accessibility_manager = new AccessibilityManager(); | 382 g_accessibility_manager = new AccessibilityManager(); |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1419 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); | 1424 ash::PlaySystemSoundAlways(SOUND_SPOKEN_FEEDBACK_DISABLED); |
| 1420 // Clear the accessibility focus ring. | 1425 // Clear the accessibility focus ring. |
| 1421 AccessibilityFocusRingController::GetInstance()->SetFocusRing( | 1426 AccessibilityFocusRingController::GetInstance()->SetFocusRing( |
| 1422 std::vector<gfx::Rect>()); | 1427 std::vector<gfx::Rect>()); |
| 1423 } | 1428 } |
| 1424 | 1429 |
| 1425 void AccessibilityManager::OnChromeVoxPanelClosing() { | 1430 void AccessibilityManager::OnChromeVoxPanelClosing() { |
| 1426 aura::Window* root_window = chromevox_panel_->GetRootWindow(); | 1431 aura::Window* root_window = chromevox_panel_->GetRootWindow(); |
| 1427 chromevox_panel_widget_observer_.reset(nullptr); | 1432 chromevox_panel_widget_observer_.reset(nullptr); |
| 1428 chromevox_panel_ = nullptr; | 1433 chromevox_panel_ = nullptr; |
| 1429 ash::Shelf::ForWindow(root_window) | 1434 |
| 1430 ->shelf_layout_manager() | 1435 ash::Shelf* shelf = ash::Shelf::ForWindow(root_window); |
| 1431 ->SetChromeVoxPanelHeight(0); | 1436 if (!shelf) |
| 1437 return; | |
| 1438 | |
| 1439 ash::ShelfLayoutManager* shelf_layout_manager = shelf->shelf_layout_manager(); | |
| 1440 if (shelf_layout_manager) | |
| 1441 shelf_layout_manager->SetChromeVoxPanelHeight(0); | |
| 1432 } | 1442 } |
| 1433 | 1443 |
| 1434 void AccessibilityManager::OnChromeVoxPanelDestroying() { | 1444 void AccessibilityManager::OnChromeVoxPanelDestroying() { |
| 1435 chromevox_panel_widget_observer_.reset(nullptr); | 1445 chromevox_panel_widget_observer_.reset(nullptr); |
| 1436 chromevox_panel_ = nullptr; | 1446 chromevox_panel_ = nullptr; |
| 1437 } | 1447 } |
| 1438 | 1448 |
| 1449 void AccessibilityManager::UpdateChromeVoxPanelHeight() { | |
| 1450 if (chromevox_panel_) | |
| 1451 chromevox_panel_->UpdatePanelHeight(); | |
| 1452 } | |
| 1453 | |
| 1439 void AccessibilityManager::SetKeyboardListenerExtensionId( | 1454 void AccessibilityManager::SetKeyboardListenerExtensionId( |
| 1440 const std::string& id, | 1455 const std::string& id, |
| 1441 content::BrowserContext* context) { | 1456 content::BrowserContext* context) { |
| 1442 keyboard_listener_extension_id_ = id; | 1457 keyboard_listener_extension_id_ = id; |
| 1443 | 1458 |
| 1444 extensions::ExtensionRegistry* registry = | 1459 extensions::ExtensionRegistry* registry = |
| 1445 extensions::ExtensionRegistry::Get(context); | 1460 extensions::ExtensionRegistry::Get(context); |
| 1446 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) | 1461 if (!extension_registry_observer_.IsObserving(registry) && !id.empty()) |
| 1447 extension_registry_observer_.Add(registry); | 1462 extension_registry_observer_.Add(registry); |
| 1448 } | 1463 } |
| 1449 | 1464 |
| 1450 } // namespace chromeos | 1465 } // namespace chromeos |
| OLD | NEW |