OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/login/user_manager.h" | 5 #include "chrome/browser/chromeos/login/user_manager.h" |
6 | 6 |
7 #include "base/bind.h" | |
7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
9 #include "base/file_path.h" | 10 #include "base/file_path.h" |
10 #include "base/file_util.h" | 11 #include "base/file_util.h" |
11 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
15 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
17 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
18 #include "base/time.h" | 19 #include "base/time.h" |
19 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
20 #include "base/values.h" | 21 #include "base/values.h" |
21 #include "crypto/nss_util.h" | 22 #include "crypto/nss_util.h" |
22 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/chromeos/cros_settings.h" | |
23 #include "chrome/browser/chromeos/cros/cros_library.h" | 25 #include "chrome/browser/chromeos/cros/cros_library.h" |
24 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 26 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
25 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 27 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
26 #include "chrome/browser/chromeos/login/default_user_images.h" | 28 #include "chrome/browser/chromeos/login/default_user_images.h" |
27 #include "chrome/browser/chromeos/login/login_display.h" | 29 #include "chrome/browser/chromeos/login/login_display.h" |
28 #include "chrome/browser/chromeos/login/ownership_service.h" | 30 #include "chrome/browser/chromeos/login/ownership_service.h" |
29 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 31 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
30 #include "chrome/browser/chromeos/wm_ipc.h" | 32 #include "chrome/browser/chromeos/wm_ipc.h" |
31 #include "chrome/browser/defaults.h" | 33 #include "chrome/browser/defaults.h" |
32 #include "chrome/browser/prefs/pref_service.h" | 34 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 delegate_(delegate), | 189 delegate_(delegate), |
188 method_factory_(this) { | 190 method_factory_(this) { |
189 RemoveUser(); | 191 RemoveUser(); |
190 } | 192 } |
191 | 193 |
192 virtual ~RemoveAttempt() {} | 194 virtual ~RemoveAttempt() {} |
193 | 195 |
194 void RemoveUser() { | 196 void RemoveUser() { |
195 // Owner is not allowed to be removed from the device. | 197 // Owner is not allowed to be removed from the device. |
196 // Must not proceed without signature verification. | 198 // Must not proceed without signature verification. |
197 UserCrosSettingsProvider user_settings; | 199 CrosSettings* cros_settings = CrosSettings::Get(); |
198 bool trusted_owner_available = user_settings.RequestTrustedOwner( | 200 bool trusted_owner_available = cros_settings->GetTrusted( |
199 method_factory_.NewRunnableMethod(&RemoveAttempt::RemoveUser)); | 201 kDeviceOwner, |
202 base::Bind(&RemoveAttempt::RemoveUser, base::Unretained(this))); | |
Denis Lagno
2011/09/20 14:05:22
is it safe to replace ScopedMethodFactory by this?
pastarmovj
2011/09/20 17:11:52
Done.
| |
200 if (!trusted_owner_available) { | 203 if (!trusted_owner_available) { |
201 // Value of owner email is still not verified. | 204 // Value of owner email is still not verified. |
202 // Another attempt will be invoked after verification completion. | 205 // Another attempt will be invoked after verification completion. |
203 return; | 206 return; |
204 } | 207 } |
205 if (user_email_ == UserCrosSettingsProvider::cached_owner()) { | 208 std::string owner; |
209 cros_settings->GetString(kDeviceOwner, &owner); | |
210 if (user_email_ == owner) { | |
206 // Owner is not allowed to be removed from the device. Probably on | 211 // Owner is not allowed to be removed from the device. Probably on |
207 // the stack, so deffer the deletion. | 212 // the stack, so deffer the deletion. |
208 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 213 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
209 return; | 214 return; |
210 } | 215 } |
211 | 216 |
212 if (delegate_) | 217 if (delegate_) |
213 delegate_->OnBeforeUserRemoved(user_email_); | 218 delegate_->OnBeforeUserRemoved(user_email_); |
214 | 219 |
215 chromeos::UserManager::Get()->RemoveUserFromList(user_email_); | 220 chromeos::UserManager::Get()->RemoveUserFromList(user_email_); |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
716 } | 721 } |
717 | 722 |
718 void UserManager::NotifyLocalStateChanged() { | 723 void UserManager::NotifyLocalStateChanged() { |
719 FOR_EACH_OBSERVER( | 724 FOR_EACH_OBSERVER( |
720 Observer, | 725 Observer, |
721 observer_list_, | 726 observer_list_, |
722 LocalStateChanged(this)); | 727 LocalStateChanged(this)); |
723 } | 728 } |
724 | 729 |
725 } // namespace chromeos | 730 } // namespace chromeos |
OLD | NEW |