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

Unified Diff: chrome/browser/prefs/preferences_manager.cc

Issue 2635093002: Switch Preferences to use Factory (Closed)
Patch Set: docs Created 3 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/preferences_manager.h ('k') | chrome/browser/prefs/preferences_manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/preferences_manager.cc
diff --git a/chrome/browser/prefs/preferences_manager.cc b/chrome/browser/prefs/preferences_manager.cc
index 13eb402d5cefbeeda556e2602190c2b6c7b2d22b..98898335843bfd0dd1fb591d57e5b80d0d8b46b4 100644
--- a/chrome/browser/prefs/preferences_manager.cc
+++ b/chrome/browser/prefs/preferences_manager.cc
@@ -12,8 +12,11 @@
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
-PreferencesManager::PreferencesManager(Profile* profile)
+PreferencesManager::PreferencesManager(
+ prefs::mojom::PreferencesObserverPtr client,
+ Profile* profile)
: preferences_change_registrar_(new PrefChangeRegistrar),
+ client_(std::move(client)),
setting_preferences_(false) {
DCHECK(profile);
dcheng 2017/01/17 22:36:33 Maybe DCHECK(client.is_bound()) here?
jonross 2017/01/17 23:05:43 Done.
service_ = profile->GetPrefs();
@@ -33,18 +36,8 @@ void PreferencesManager::PreferenceChanged(const std::string& preference_name) {
client_->OnPreferencesChanged(std::move(dictionary));
}
-void PreferencesManager::AddObserver(
- prefs::mojom::PreferencesObserverPtr client) {
- // TODO(jonross): once service_manager::Connector supports enforcing two-way
- // binding at connection time, update PreferencesManager to use that approach.
- // After which enforcing bind checks will not be needed (crbug.com/674140)
- client_ = std::move(client);
-}
-
void PreferencesManager::SetPreferences(
std::unique_ptr<base::DictionaryValue> preferences) {
- if (!client_.is_bound())
- return;
DCHECK(!setting_preferences_);
// We ignore preference changes caused by us.
base::AutoReset<bool> setting_preferences(&setting_preferences_, true);
@@ -65,8 +58,6 @@ void PreferencesManager::SetPreferences(
void PreferencesManager::Subscribe(
const std::vector<std::string>& preferences) {
- if (!client_.is_bound())
- return;
std::unique_ptr<base::DictionaryValue> dictionary =
base::MakeUnique<base::DictionaryValue>();
for (auto& it : preferences) {
« no previous file with comments | « chrome/browser/prefs/preferences_manager.h ('k') | chrome/browser/prefs/preferences_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698