| 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/accessibility/magnification_manager.h" | 5 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 6 | 6 |
| 7 #include "ash/magnifier/magnification_controller.h" | 7 #include "ash/magnifier/magnification_controller.h" |
| 8 #include "ash/magnifier/partial_magnification_controller.h" | 8 #include "ash/magnifier/partial_magnification_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" |
| 10 #include "ash/system/tray/system_tray_notifier.h" | 11 #include "ash/system/tray/system_tray_notifier.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 13 #include "base/prefs/pref_member.h" | 14 #include "base/prefs/pref_member.h" |
| 14 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 15 #include "chrome/browser/chromeos/login/user_manager.h" | 17 #include "chrome/browser/chromeos/login/user_manager.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 20 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
| 23 #include "content/public/browser/notification_service.h" | 25 #include "content/public/browser/notification_service.h" |
| 24 | 26 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 virtual double GetSavedScreenMagnifierScale() const OVERRIDE { | 122 virtual double GetSavedScreenMagnifierScale() const OVERRIDE { |
| 121 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 123 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
| 122 DCHECK(profile->GetPrefs()); | 124 DCHECK(profile->GetPrefs()); |
| 123 if (profile->GetPrefs()->HasPrefPath(prefs::kScreenMagnifierScale)) | 125 if (profile->GetPrefs()->HasPrefPath(prefs::kScreenMagnifierScale)) |
| 124 return profile->GetPrefs()->GetDouble(prefs::kScreenMagnifierScale); | 126 return profile->GetPrefs()->GetDouble(prefs::kScreenMagnifierScale); |
| 125 return std::numeric_limits<double>::min(); | 127 return std::numeric_limits<double>::min(); |
| 126 } | 128 } |
| 127 | 129 |
| 128 private: | 130 private: |
| 129 void NotifyMagnifierChanged() { | 131 void NotifyMagnifierChanged() { |
| 130 accessibility::AccessibilityStatusEventDetails details( | 132 AccessibilityStatusEventDetails details( |
| 131 enabled_, type_, ash::A11Y_NOTIFICATION_NONE); | 133 enabled_, type_, ash::A11Y_NOTIFICATION_NONE); |
| 132 content::NotificationService::current()->Notify( | 134 content::NotificationService::current()->Notify( |
| 133 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER, | 135 chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER, |
| 134 content::NotificationService::AllSources(), | 136 content::NotificationService::AllSources(), |
| 135 content::Details<accessibility::AccessibilityStatusEventDetails>( | 137 content::Details<AccessibilityStatusEventDetails>(&details)); |
| 136 &details)); | |
| 137 } | 138 } |
| 138 | 139 |
| 139 bool IsMagnifierEnabledFromPref() { | 140 bool IsMagnifierEnabledFromPref() { |
| 140 if (!profile_) | 141 if (!profile_) |
| 141 return false; | 142 return false; |
| 142 | 143 |
| 143 DCHECK(profile_->GetPrefs()); | 144 DCHECK(profile_->GetPrefs()); |
| 144 return profile_->GetPrefs()->GetBoolean(prefs::kScreenMagnifierEnabled); | 145 return profile_->GetPrefs()->GetBoolean(prefs::kScreenMagnifierEnabled); |
| 145 } | 146 } |
| 146 | 147 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 delete g_magnification_manager; | 232 delete g_magnification_manager; |
| 232 g_magnification_manager = NULL; | 233 g_magnification_manager = NULL; |
| 233 } | 234 } |
| 234 | 235 |
| 235 // static | 236 // static |
| 236 MagnificationManager* MagnificationManager::Get() { | 237 MagnificationManager* MagnificationManager::Get() { |
| 237 return g_magnification_manager; | 238 return g_magnification_manager; |
| 238 } | 239 } |
| 239 | 240 |
| 240 } // namespace chromeos | 241 } // namespace chromeos |
| OLD | NEW |