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> |
| 10 |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "components/prefs/pref_registry_simple.h" | 13 #include "components/prefs/pref_registry_simple.h" |
13 #include "components/prefs/scoped_user_pref_update.h" | 14 #include "components/prefs/scoped_user_pref_update.h" |
14 #include "components/user_manager/user_manager.h" | 15 #include "components/user_manager/user_manager.h" |
15 #include "google_apis/gaia/gaia_auth_util.h" | 16 #include "google_apis/gaia/gaia_auth_util.h" |
16 | 17 |
17 namespace user_manager { | 18 namespace user_manager { |
18 namespace known_user { | 19 namespace known_user { |
19 namespace { | 20 namespace { |
20 | 21 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if (update->GetDictionary(i, &element)) { | 127 if (update->GetDictionary(i, &element)) { |
127 if (UserMatches(account_id, *element)) { | 128 if (UserMatches(account_id, *element)) { |
128 if (clear) | 129 if (clear) |
129 element->Clear(); | 130 element->Clear(); |
130 element->MergeDictionary(&values); | 131 element->MergeDictionary(&values); |
131 UpdateIdentity(account_id, *element); | 132 UpdateIdentity(account_id, *element); |
132 return; | 133 return; |
133 } | 134 } |
134 } | 135 } |
135 } | 136 } |
136 scoped_ptr<base::DictionaryValue> new_value(new base::DictionaryValue()); | 137 std::unique_ptr<base::DictionaryValue> new_value(new base::DictionaryValue()); |
137 new_value->MergeDictionary(&values); | 138 new_value->MergeDictionary(&values); |
138 UpdateIdentity(account_id, *new_value); | 139 UpdateIdentity(account_id, *new_value); |
139 update->Append(new_value.release()); | 140 update->Append(new_value.release()); |
140 } | 141 } |
141 | 142 |
142 bool GetStringPref(const AccountId& account_id, | 143 bool GetStringPref(const AccountId& account_id, |
143 const std::string& path, | 144 const std::string& path, |
144 std::string* out_value) { | 145 std::string* out_value) { |
145 const base::DictionaryValue* user_pref_dict = nullptr; | 146 const base::DictionaryValue* user_pref_dict = nullptr; |
146 if (!FindPrefs(account_id, &user_pref_dict)) | 147 if (!FindPrefs(account_id, &user_pref_dict)) |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } | 375 } |
375 } | 376 } |
376 } | 377 } |
377 | 378 |
378 void RegisterPrefs(PrefRegistrySimple* registry) { | 379 void RegisterPrefs(PrefRegistrySimple* registry) { |
379 registry->RegisterListPref(kKnownUsers); | 380 registry->RegisterListPref(kKnownUsers); |
380 } | 381 } |
381 | 382 |
382 } // namespace known_user | 383 } // namespace known_user |
383 } // namespace user_manager | 384 } // namespace user_manager |
OLD | NEW |