| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/prefs/preferences_manager.h" | 5 #include "chrome/browser/prefs/preferences_manager.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/ptr_util.h" |
| 9 #include "base/values.h" | 10 #include "base/values.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "components/prefs/pref_change_registrar.h" | 12 #include "components/prefs/pref_change_registrar.h" |
| 12 #include "components/prefs/pref_service.h" | 13 #include "components/prefs/pref_service.h" |
| 13 | 14 |
| 14 PreferencesManager::PreferencesManager(Profile* profile) | 15 PreferencesManager::PreferencesManager(Profile* profile) |
| 15 : preferences_change_registrar_(new PrefChangeRegistrar), | 16 : preferences_change_registrar_(new PrefChangeRegistrar), |
| 16 setting_preferences_(false) { | 17 setting_preferences_(false) { |
| 17 DCHECK(profile); | 18 DCHECK(profile); |
| 18 service_ = profile->GetPrefs(); | 19 service_ = profile->GetPrefs(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 preferences_change_registrar_->Add( | 81 preferences_change_registrar_->Add( |
| 81 it, base::Bind(&PreferencesManager::PreferenceChanged, | 82 it, base::Bind(&PreferencesManager::PreferenceChanged, |
| 82 base::Unretained(this))); | 83 base::Unretained(this))); |
| 83 dictionary->Set(it, pref->GetValue()->CreateDeepCopy()); | 84 dictionary->Set(it, pref->GetValue()->CreateDeepCopy()); |
| 84 } | 85 } |
| 85 | 86 |
| 86 if (dictionary->empty()) | 87 if (dictionary->empty()) |
| 87 return; | 88 return; |
| 88 client_->OnPreferencesChanged(std::move(dictionary)); | 89 client_->OnPreferencesChanged(std::move(dictionary)); |
| 89 } | 90 } |
| OLD | NEW |