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

Side by Side Diff: chrome/browser/chromeos/login/user_manager.cc

Issue 7867044: PART1: Initiated the SignedSettings refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final rebase to ToT before hitting the CQ. Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/rand_util.h" 18 #include "base/rand_util.h"
19 #include "base/string_util.h" 19 #include "base/string_util.h"
20 #include "base/stringprintf.h" 20 #include "base/stringprintf.h"
21 #include "base/task.h" 21 #include "base/task.h"
22 #include "base/time.h" 22 #include "base/time.h"
23 #include "base/utf_string_conversions.h" 23 #include "base/utf_string_conversions.h"
24 #include "base/values.h" 24 #include "base/values.h"
25 #include "chrome/browser/browser_process.h" 25 #include "chrome/browser/browser_process.h"
26 #include "chrome/browser/chromeos/cros_settings.h"
26 #include "chrome/browser/chromeos/cros/cert_library.h" 27 #include "chrome/browser/chromeos/cros/cert_library.h"
27 #include "chrome/browser/chromeos/cros/cros_library.h" 28 #include "chrome/browser/chromeos/cros/cros_library.h"
28 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 29 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
29 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 30 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
30 #include "chrome/browser/chromeos/login/default_user_images.h" 31 #include "chrome/browser/chromeos/login/default_user_images.h"
31 #include "chrome/browser/chromeos/login/helper.h" 32 #include "chrome/browser/chromeos/login/helper.h"
32 #include "chrome/browser/chromeos/login/login_display.h" 33 #include "chrome/browser/chromeos/login/login_display.h"
33 #include "chrome/browser/chromeos/login/ownership_service.h" 34 #include "chrome/browser/chromeos/login/ownership_service.h"
34 #include "chrome/browser/chromeos/system/runtime_environment.h" 35 #include "chrome/browser/chromeos/system/runtime_environment.h"
35 #include "chrome/browser/chromeos/user_cros_settings_provider.h" 36 #include "chrome/browser/chromeos/user_cros_settings_provider.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 delegate_(delegate), 110 delegate_(delegate),
110 weak_factory_(this) { 111 weak_factory_(this) {
111 RemoveUser(); 112 RemoveUser();
112 } 113 }
113 114
114 virtual ~RemoveAttempt() {} 115 virtual ~RemoveAttempt() {}
115 116
116 void RemoveUser() { 117 void RemoveUser() {
117 // Owner is not allowed to be removed from the device. 118 // Owner is not allowed to be removed from the device.
118 // Must not proceed without signature verification. 119 // Must not proceed without signature verification.
119 UserCrosSettingsProvider user_settings; 120 CrosSettings* cros_settings = CrosSettings::Get();
120 bool trusted_owner_available = user_settings.RequestTrustedOwner( 121 bool trusted_owner_available = cros_settings->GetTrusted(
122 kDeviceOwner,
121 base::Bind(&RemoveAttempt::RemoveUser, weak_factory_.GetWeakPtr())); 123 base::Bind(&RemoveAttempt::RemoveUser, weak_factory_.GetWeakPtr()));
122 if (!trusted_owner_available) { 124 if (!trusted_owner_available) {
123 // Value of owner email is still not verified. 125 // Value of owner email is still not verified.
124 // Another attempt will be invoked after verification completion. 126 // Another attempt will be invoked after verification completion.
125 return; 127 return;
126 } 128 }
127 if (user_email_ == UserCrosSettingsProvider::cached_owner()) { 129 std::string owner;
130 cros_settings->GetString(kDeviceOwner, &owner);
131 if (user_email_ == owner) {
128 // Owner is not allowed to be removed from the device. Probably on 132 // Owner is not allowed to be removed from the device. Probably on
129 // the stack, so deffer the deletion. 133 // the stack, so deffer the deletion.
130 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 134 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
131 return; 135 return;
132 } 136 }
133 137
134 if (delegate_) 138 if (delegate_)
135 delegate_->OnBeforeUserRemoved(user_email_); 139 delegate_->OnBeforeUserRemoved(user_email_);
136 140
137 chromeos::UserManager::Get()->RemoveUserFromList(user_email_); 141 chromeos::UserManager::Get()->RemoveUserFromList(user_email_);
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 876
873 User* UserManager::CreateUser(const std::string& email) const { 877 User* UserManager::CreateUser(const std::string& email) const {
874 User* user = new User(email); 878 User* user = new User(email);
875 user->set_oauth_token_status(GetUserOAuthStatus(email)); 879 user->set_oauth_token_status(GetUserOAuthStatus(email));
876 // Used to determine whether user's display name is unique. 880 // Used to determine whether user's display name is unique.
877 ++display_name_count_[user->GetDisplayName()]; 881 ++display_name_count_[user->GetDisplayName()];
878 return user; 882 return user;
879 } 883 }
880 884
881 } // namespace chromeos 885 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_performer.cc ('k') | chrome/browser/chromeos/user_cros_settings_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698