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

Side by Side Diff: chrome/browser/prefs/preferences_service.h

Issue 2644893003: Unify Preferences Mojom Naming to PreferencesService (Closed)
Patch Set: / 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 unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_PREFS_PREFERENCES_MANAGER_H_ 5 #ifndef CHROME_BROWSER_PREFS_PREFERENCES_SERVICE_H_
6 #define CHROME_BROWSER_PREFS_PREFERENCES_MANAGER_H_ 6 #define CHROME_BROWSER_PREFS_PREFERENCES_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "services/preferences/public/interfaces/preferences.mojom.h" 11 #include "services/preferences/public/interfaces/preferences.mojom.h"
12 12
13 namespace test { 13 namespace test {
14 class PreferencesManagerTest; 14 class PreferencesServiceTest;
15 } 15 }
16 16
17 class PrefChangeRegistrar; 17 class PrefChangeRegistrar;
18 class PrefService; 18 class PrefService;
19 class Profile; 19 class Profile;
20 20
21 // Implementation of prefs::mojom::PreferencesManager that accepts a single 21 // Implementation of prefs::mojom::PreferencesService that accepts a single
22 // prefs::mojom::PreferencesObserver. 22 // prefs::mojom::PreferencesServiceClient.
23 // 23 //
24 // After calling AddObserver PreferencesManager will begin observing changes to 24 // After calling AddObserver PreferencesService will begin observing changes to
25 // the requested preferences, notifying the client of all changes. 25 // the requested preferences, notifying the client of all changes.
26 class PreferencesManager : public prefs::mojom::PreferencesManager { 26 class PreferencesService : public prefs::mojom::PreferencesService {
27 public: 27 public:
28 PreferencesManager(prefs::mojom::PreferencesObserverPtr client, 28 PreferencesService(prefs::mojom::PreferencesServiceClientPtr client,
29 Profile* profile); 29 Profile* profile);
30 ~PreferencesManager() override; 30 ~PreferencesService() override;
31 31
32 private: 32 private:
33 friend class test::PreferencesManagerTest; 33 friend class test::PreferencesServiceTest;
34 34
35 // PrefChangeRegistrar::NamedChangeCallback: 35 // PrefChangeRegistrar::NamedChangeCallback:
36 void PreferenceChanged(const std::string& preference_name); 36 void PreferenceChanged(const std::string& preference_name);
37 37
38 // mojom::PreferencesManager: 38 // mojom::PreferencesService:
39 void SetPreferences( 39 void SetPreferences(
40 std::unique_ptr<base::DictionaryValue> preferences) override; 40 std::unique_ptr<base::DictionaryValue> preferences) override;
41 void Subscribe(const std::vector<std::string>& preferences) override; 41 void Subscribe(const std::vector<std::string>& preferences) override;
42 42
43 // Tracks the desired preferences, and listens for updates. 43 // Tracks the desired preferences, and listens for updates.
44 std::unique_ptr<PrefChangeRegistrar> preferences_change_registrar_; 44 std::unique_ptr<PrefChangeRegistrar> preferences_change_registrar_;
45 prefs::mojom::PreferencesObserverPtr client_; 45 prefs::mojom::PreferencesServiceClientPtr client_;
46 PrefService* service_; 46 PrefService* service_;
47 47
48 // Used to prevent notifying |client_| of changes caused by it calling 48 // Used to prevent notifying |client_| of changes caused by it calling
49 // SetPreferences. 49 // SetPreferences.
50 bool setting_preferences_; 50 bool setting_preferences_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(PreferencesManager); 52 DISALLOW_COPY_AND_ASSIGN(PreferencesService);
53 }; 53 };
54 54
55 #endif // CHROME_BROWSER_PREFS_PREFERENCES_MANAGER_H_ 55 #endif // CHROME_BROWSER_PREFS_PREFERENCES_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/prefs/preferences_manager_unittest.cc ('k') | chrome/browser/prefs/preferences_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698