Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Side by Side Diff: chrome/browser/chromeos/accessibility/magnification_manager.cc

Issue 2942043002: cros: Tighten profile loading (Closed)
Patch Set: update SystemClock header Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <limits> 7 #include <limits>
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/accessibility_types.h" 10 #include "ash/accessibility_types.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return std::numeric_limits<double>::min(); 102 return std::numeric_limits<double>::min();
103 103
104 return profile_->GetPrefs()->GetDouble( 104 return profile_->GetPrefs()->GetDouble(
105 prefs::kAccessibilityScreenMagnifierScale); 105 prefs::kAccessibilityScreenMagnifierScale);
106 } 106 }
107 107
108 void SetProfileForTest(Profile* profile) override { SetProfile(profile); } 108 void SetProfileForTest(Profile* profile) override { SetProfile(profile); }
109 109
110 // user_manager::UserManager::UserSessionStateObserver overrides: 110 // user_manager::UserManager::UserSessionStateObserver overrides:
111 void ActiveUserChanged(const user_manager::User* active_user) override { 111 void ActiveUserChanged(const user_manager::User* active_user) override {
112 SetProfile(ProfileManager::GetActiveUserProfile()); 112 if (active_user && active_user->is_profile_created())
113 SetProfile(ProfileManager::GetActiveUserProfile());
113 } 114 }
114 115
115 private: 116 private:
116 void SetProfile(Profile* profile) { 117 void SetProfile(Profile* profile) {
117 pref_change_registrar_.reset(); 118 pref_change_registrar_.reset();
118 119
119 if (profile) { 120 if (profile) {
120 // TODO(yoshiki): Move following code to PrefHandler. 121 // TODO(yoshiki): Move following code to PrefHandler.
121 pref_change_registrar_.reset(new PrefChangeRegistrar); 122 pref_change_registrar_.reset(new PrefChangeRegistrar);
122 pref_change_registrar_->Init(profile->GetPrefs()); 123 pref_change_registrar_->Init(profile->GetPrefs());
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 delete g_magnification_manager; 309 delete g_magnification_manager;
309 g_magnification_manager = NULL; 310 g_magnification_manager = NULL;
310 } 311 }
311 312
312 // static 313 // static
313 MagnificationManager* MagnificationManager::Get() { 314 MagnificationManager* MagnificationManager::Get() {
314 return g_magnification_manager; 315 return g_magnification_manager;
315 } 316 }
316 317
317 } // namespace chromeos 318 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/accessibility/accessibility_manager.cc ('k') | chrome/browser/chromeos/system/system_clock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698