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 "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 10 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
11 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 11 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
12 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 12 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
13 #include "chrome/browser/chromeos/login/helper.h" | 13 #include "chrome/browser/chromeos/login/helper.h" |
14 #include "chrome/browser/chromeos/login/login_utils.h" | 14 #include "chrome/browser/chromeos/login/login_utils.h" |
15 #include "chrome/browser/chromeos/login/user_manager.h" | 15 #include "chrome/browser/chromeos/login/user_manager.h" |
16 #include "chrome/browser/chromeos/login/user_manager_impl.h" | 16 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
19 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
22 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
| 23 #include "components/user_prefs/user_prefs.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 | 25 |
25 namespace chromeos { | 26 namespace chromeos { |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
29 void SetMagnifierEnabled(bool enabled) { | 30 void SetMagnifierEnabled(bool enabled) { |
30 MagnificationManager::Get()->SetMagnifierEnabled(enabled); | 31 MagnificationManager::Get()->SetMagnifierEnabled(enabled); |
31 } | 32 } |
32 | 33 |
(...skipping 26 matching lines...) Expand all Loading... |
59 return MagnificationManager::Get()->IsMagnifierEnabled(); | 60 return MagnificationManager::Get()->IsMagnifierEnabled(); |
60 } | 61 } |
61 | 62 |
62 Profile* profile() { | 63 Profile* profile() { |
63 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 64 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
64 DCHECK(profile); | 65 DCHECK(profile); |
65 return profile; | 66 return profile; |
66 } | 67 } |
67 | 68 |
68 PrefService* prefs() { | 69 PrefService* prefs() { |
69 return PrefServiceFromBrowserContext(profile()); | 70 return components::UserPrefs::Get(profile()); |
70 } | 71 } |
71 | 72 |
72 void EnableScreenManagnifierToPref(bool enabled) { | 73 void EnableScreenManagnifierToPref(bool enabled) { |
73 prefs()->SetBoolean(prefs::kScreenMagnifierEnabled, enabled); | 74 prefs()->SetBoolean(prefs::kScreenMagnifierEnabled, enabled); |
74 } | 75 } |
75 | 76 |
76 void SetScreenManagnifierTypeToPref(ash::MagnifierType type) { | 77 void SetScreenManagnifierTypeToPref(ash::MagnifierType type) { |
77 prefs()->SetInteger(prefs::kScreenMagnifierType, type); | 78 prefs()->SetInteger(prefs::kScreenMagnifierType, type); |
78 } | 79 } |
79 | 80 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 490 |
490 // Disables magnifier again and confirms observer is invoked. | 491 // Disables magnifier again and confirms observer is invoked. |
491 observed_ = false; | 492 observed_ = false; |
492 SetMagnifierEnabled(false); | 493 SetMagnifierEnabled(false); |
493 EXPECT_TRUE(observed_); | 494 EXPECT_TRUE(observed_); |
494 EXPECT_FALSE(observed_enabled_); | 495 EXPECT_FALSE(observed_enabled_); |
495 EXPECT_FALSE(IsMagnifierEnabled()); | 496 EXPECT_FALSE(IsMagnifierEnabled()); |
496 } | 497 } |
497 | 498 |
498 } // namespace chromeos | 499 } // namespace chromeos |
OLD | NEW |