OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/user_manager/user_manager_base.h" | 5 #include "components/user_manager/user_manager_base.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | |
9 #include <set> | 8 #include <set> |
| 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 // ptr. | 1085 // ptr. |
1086 std::string* raw_resolved_locale = resolved_locale.get(); | 1086 std::string* raw_resolved_locale = resolved_locale.get(); |
1087 blocking_task_runner_->PostTaskAndReply( | 1087 blocking_task_runner_->PostTaskAndReply( |
1088 FROM_HERE, base::Bind(ResolveLocale, locale, | 1088 FROM_HERE, base::Bind(ResolveLocale, locale, |
1089 base::Unretained(raw_resolved_locale)), | 1089 base::Unretained(raw_resolved_locale)), |
1090 base::Bind(&UserManagerBase::DoUpdateAccountLocale, | 1090 base::Bind(&UserManagerBase::DoUpdateAccountLocale, |
1091 weak_factory_.GetWeakPtr(), account_id, | 1091 weak_factory_.GetWeakPtr(), account_id, |
1092 base::Passed(&resolved_locale))); | 1092 base::Passed(&resolved_locale))); |
1093 } else { | 1093 } else { |
1094 resolved_locale.reset(new std::string(locale)); | 1094 resolved_locale.reset(new std::string(locale)); |
1095 DoUpdateAccountLocale(account_id, resolved_locale.Pass()); | 1095 DoUpdateAccountLocale(account_id, std::move(resolved_locale)); |
1096 } | 1096 } |
1097 } | 1097 } |
1098 | 1098 |
1099 void UserManagerBase::DoUpdateAccountLocale( | 1099 void UserManagerBase::DoUpdateAccountLocale( |
1100 const AccountId& account_id, | 1100 const AccountId& account_id, |
1101 scoped_ptr<std::string> resolved_locale) { | 1101 scoped_ptr<std::string> resolved_locale) { |
1102 User* user = FindUserAndModify(account_id); | 1102 User* user = FindUserAndModify(account_id); |
1103 if (user && resolved_locale) | 1103 if (user && resolved_locale) |
1104 user->SetAccountLocale(*resolved_locale); | 1104 user->SetAccountLocale(*resolved_locale); |
1105 } | 1105 } |
1106 | 1106 |
1107 void UserManagerBase::DeleteUser(User* user) { | 1107 void UserManagerBase::DeleteUser(User* user) { |
1108 const bool is_active_user = (user == active_user_); | 1108 const bool is_active_user = (user == active_user_); |
1109 delete user; | 1109 delete user; |
1110 if (is_active_user) | 1110 if (is_active_user) |
1111 active_user_ = nullptr; | 1111 active_user_ = nullptr; |
1112 } | 1112 } |
1113 | 1113 |
1114 } // namespace user_manager | 1114 } // namespace user_manager |
OLD | NEW |