OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/known_user.h" | 5 #include "components/user_manager/known_user.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> |
10 | 11 |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "components/prefs/pref_registry_simple.h" | 14 #include "components/prefs/pref_registry_simple.h" |
14 #include "components/prefs/scoped_user_pref_update.h" | 15 #include "components/prefs/scoped_user_pref_update.h" |
15 #include "components/user_manager/user_manager.h" | 16 #include "components/user_manager/user_manager.h" |
16 #include "google_apis/gaia/gaia_auth_util.h" | 17 #include "google_apis/gaia/gaia_auth_util.h" |
17 | 18 |
18 namespace user_manager { | 19 namespace user_manager { |
19 namespace known_user { | 20 namespace known_user { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 element->Clear(); | 131 element->Clear(); |
131 element->MergeDictionary(&values); | 132 element->MergeDictionary(&values); |
132 UpdateIdentity(account_id, *element); | 133 UpdateIdentity(account_id, *element); |
133 return; | 134 return; |
134 } | 135 } |
135 } | 136 } |
136 } | 137 } |
137 std::unique_ptr<base::DictionaryValue> new_value(new base::DictionaryValue()); | 138 std::unique_ptr<base::DictionaryValue> new_value(new base::DictionaryValue()); |
138 new_value->MergeDictionary(&values); | 139 new_value->MergeDictionary(&values); |
139 UpdateIdentity(account_id, *new_value); | 140 UpdateIdentity(account_id, *new_value); |
140 update->Append(new_value.release()); | 141 update->Append(std::move(new_value)); |
141 } | 142 } |
142 | 143 |
143 bool GetStringPref(const AccountId& account_id, | 144 bool GetStringPref(const AccountId& account_id, |
144 const std::string& path, | 145 const std::string& path, |
145 std::string* out_value) { | 146 std::string* out_value) { |
146 const base::DictionaryValue* user_pref_dict = nullptr; | 147 const base::DictionaryValue* user_pref_dict = nullptr; |
147 if (!FindPrefs(account_id, &user_pref_dict)) | 148 if (!FindPrefs(account_id, &user_pref_dict)) |
148 return false; | 149 return false; |
149 | 150 |
150 return user_pref_dict->GetString(path, out_value); | 151 return user_pref_dict->GetString(path, out_value); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 } | 376 } |
376 } | 377 } |
377 } | 378 } |
378 | 379 |
379 void RegisterPrefs(PrefRegistrySimple* registry) { | 380 void RegisterPrefs(PrefRegistrySimple* registry) { |
380 registry->RegisterListPref(kKnownUsers); | 381 registry->RegisterListPref(kKnownUsers); |
381 } | 382 } |
382 | 383 |
383 } // namespace known_user | 384 } // namespace known_user |
384 } // namespace user_manager | 385 } // namespace user_manager |
OLD | NEW |