| 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 "ash/magnifier/magnification_controller.h" | 5 #include "ash/magnifier/magnification_controller.h" |
| 6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 9 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 10 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 10 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 PrefServiceBase* prefs() { | 60 PrefServiceBase* prefs() { |
| 61 return PrefServiceBase::FromBrowserContext(profile()); | 61 return PrefServiceBase::FromBrowserContext(profile()); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void SetScreenManagnifierType(ash::MagnifierType type) { | 64 void SetScreenManagnifierType(ash::MagnifierType type) { |
| 65 MagnificationManager::Get()->SetMagnifier(type); | 65 MagnificationManager::Get()->SetMagnifier(type); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void SetScreenManagnifierTypeToPref(ash::MagnifierType type) { | 68 void SetScreenManagnifierTypeToPref(ash::MagnifierType type) { |
| 69 prefs()->SetString(prefs::kMagnifierType, | 69 prefs()->SetBoolean(prefs::kScreenMagnifierEnabled, |
| 70 accessibility::ScreenMagnifierNameFromType(type)); | 70 (type != ash::MAGNIFIER_OFF) ? true : false); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SetFullScreenMagnifierScale(double scale) { | 73 void SetFullScreenMagnifierScale(double scale) { |
| 74 ash::Shell::GetInstance()-> | 74 ash::Shell::GetInstance()-> |
| 75 magnification_controller()->SetScale(scale, false); | 75 magnification_controller()->SetScale(scale, false); |
| 76 } | 76 } |
| 77 | 77 |
| 78 double GetFullScreenMagnifierScale() { | 78 double GetFullScreenMagnifierScale() { |
| 79 return ash::Shell::GetInstance()->magnification_controller()->GetScale(); | 79 return ash::Shell::GetInstance()->magnification_controller()->GetScale(); |
| 80 } | 80 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 EXPECT_EQ(observed_type_, ash::MAGNIFIER_OFF); | 319 EXPECT_EQ(observed_type_, ash::MAGNIFIER_OFF); |
| 320 CheckCurrentMagnifierType(ash::MAGNIFIER_OFF); | 320 CheckCurrentMagnifierType(ash::MAGNIFIER_OFF); |
| 321 | 321 |
| 322 // Enables full screen magnifier and confirms observer is invoked. | 322 // Enables full screen magnifier and confirms observer is invoked. |
| 323 observed_ = false; | 323 observed_ = false; |
| 324 SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL); | 324 SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL); |
| 325 EXPECT_TRUE(observed_); | 325 EXPECT_TRUE(observed_); |
| 326 EXPECT_EQ(observed_type_, ash::MAGNIFIER_FULL); | 326 EXPECT_EQ(observed_type_, ash::MAGNIFIER_FULL); |
| 327 CheckCurrentMagnifierType(ash::MAGNIFIER_FULL); | 327 CheckCurrentMagnifierType(ash::MAGNIFIER_FULL); |
| 328 | 328 |
| 329 // Enables partial screen magnifier and confirms observer is invoked. | |
| 330 observed_ = false; | |
| 331 SetScreenManagnifierTypeToPref(ash::MAGNIFIER_PARTIAL); | |
| 332 EXPECT_TRUE(observed_); | |
| 333 EXPECT_EQ(observed_type_, ash::MAGNIFIER_PARTIAL); | |
| 334 CheckCurrentMagnifierType(ash::MAGNIFIER_PARTIAL); | |
| 335 | |
| 336 // Disables magnifier again and confirms observer is invoked. | 329 // Disables magnifier again and confirms observer is invoked. |
| 337 observed_ = false; | 330 observed_ = false; |
| 338 SetScreenManagnifierTypeToPref(ash::MAGNIFIER_OFF); | 331 SetScreenManagnifierTypeToPref(ash::MAGNIFIER_OFF); |
| 339 EXPECT_TRUE(observed_); | 332 EXPECT_TRUE(observed_); |
| 340 EXPECT_EQ(observed_type_, ash::MAGNIFIER_OFF); | 333 EXPECT_EQ(observed_type_, ash::MAGNIFIER_OFF); |
| 341 CheckCurrentMagnifierType(ash::MAGNIFIER_OFF); | 334 CheckCurrentMagnifierType(ash::MAGNIFIER_OFF); |
| 342 } | 335 } |
| 343 | 336 |
| 344 } // namespace chromeos | 337 } // namespace chromeos |
| OLD | NEW |