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

Side by Side Diff: chrome/browser/chromeos/preferences.cc

Issue 2739763003: Moves maintaining ShellObservers back to Shell (Closed)
Patch Set: merge Created 3 years, 9 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/preferences.h" 5 #include "chrome/browser/chromeos/preferences.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/autoclick/autoclick_controller.h" 9 #include "ash/autoclick/autoclick_controller.h"
10 #include "ash/common/accessibility_types.h" 10 #include "ash/common/accessibility_types.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } // namespace 74 } // namespace
75 75
76 Preferences::Preferences() 76 Preferences::Preferences()
77 : prefs_(NULL), 77 : prefs_(NULL),
78 input_method_manager_(input_method::InputMethodManager::Get()), 78 input_method_manager_(input_method::InputMethodManager::Get()),
79 user_(NULL), 79 user_(NULL),
80 user_is_primary_(false) { 80 user_is_primary_(false) {
81 // Do not observe shell, if there is no shell instance; e.g., in some unit 81 // Do not observe shell, if there is no shell instance; e.g., in some unit
82 // tests. 82 // tests.
83 if (ash::WmShell::HasInstance()) 83 if (ash::WmShell::HasInstance())
84 ash::WmShell::Get()->AddShellObserver(this); 84 ash::Shell::GetInstance()->AddShellObserver(this);
85 } 85 }
86 86
87 Preferences::Preferences(input_method::InputMethodManager* input_method_manager) 87 Preferences::Preferences(input_method::InputMethodManager* input_method_manager)
88 : prefs_(NULL), 88 : prefs_(NULL),
89 input_method_manager_(input_method_manager), 89 input_method_manager_(input_method_manager),
90 user_(NULL), 90 user_(NULL),
91 user_is_primary_(false) { 91 user_is_primary_(false) {
92 // Do not observe shell, if there is no shell instance; e.g., in some unit 92 // Do not observe shell, if there is no shell instance; e.g., in some unit
93 // tests. 93 // tests.
94 if (ash::WmShell::HasInstance()) 94 if (ash::WmShell::HasInstance())
95 ash::WmShell::Get()->AddShellObserver(this); 95 ash::Shell::GetInstance()->AddShellObserver(this);
96 } 96 }
97 97
98 Preferences::~Preferences() { 98 Preferences::~Preferences() {
99 prefs_->RemoveObserver(this); 99 prefs_->RemoveObserver(this);
100 user_manager::UserManager::Get()->RemoveSessionStateObserver(this); 100 user_manager::UserManager::Get()->RemoveSessionStateObserver(this);
101 // If shell instance is destoryed before this preferences instance, there is 101 // If shell instance is destoryed before this preferences instance, there is
102 // no need to remove this shell observer. 102 // no need to remove this shell observer.
103 if (ash::WmShell::HasInstance()) 103 if (ash::WmShell::HasInstance())
104 ash::WmShell::Get()->RemoveShellObserver(this); 104 ash::Shell::GetInstance()->RemoveShellObserver(this);
105 } 105 }
106 106
107 // static 107 // static
108 void Preferences::RegisterPrefs(PrefRegistrySimple* registry) { 108 void Preferences::RegisterPrefs(PrefRegistrySimple* registry) {
109 registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); 109 registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false);
110 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); 110 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true);
111 registry->RegisterBooleanPref(prefs::kAccessibilityVirtualKeyboardEnabled, 111 registry->RegisterBooleanPref(prefs::kAccessibilityVirtualKeyboardEnabled,
112 false); 112 false);
113 registry->RegisterBooleanPref(prefs::kAccessibilityMonoAudioEnabled, 113 registry->RegisterBooleanPref(prefs::kAccessibilityMonoAudioEnabled,
114 false); 114 false);
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 touch_hud_projection_enabled_.SetValue(enabled); 832 touch_hud_projection_enabled_.SetValue(enabled);
833 } 833 }
834 834
835 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { 835 void Preferences::ActiveUserChanged(const user_manager::User* active_user) {
836 if (active_user != user_) 836 if (active_user != user_)
837 return; 837 return;
838 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); 838 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, "");
839 } 839 }
840 840
841 } // namespace chromeos 841 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698