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

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

Issue 2474653003: PreferencesManager (Closed)
Patch Set: DLOG error states Created 4 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PREFS_PREFERENCES_CONNECTION_MANAGER_H_
6 #define CHROME_BROWSER_PREFS_PREFERENCES_CONNECTION_MANAGER_H_
7
8 #include <vector>
9
10 #include "base/macros.h"
11 #include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
12 #include "mojo/public/cpp/bindings/strong_binding.h"
13 #include "services/preferences/public/interfaces/preferences.mojom.h"
14
15 // Handles all incoming prefs::mojom::PreferenceManagerRequest, providing a
16 // separate PreferencesManager per connection request.
17 //
18 // Additionally monitors system shutdown to clean up connections to PrefService.
19 //
20 // TODO(jonross): Observe profile switching and update PreferenceManager
21 // connections.
22 class PreferencesConnectionManager {
23 public:
24 PreferencesConnectionManager();
25 ~PreferencesConnectionManager();
26
27 // Creates a new PreferencesManager and binds it to |request|.
28 void ProcessRequest(prefs::mojom::PreferencesManagerRequest request);
29
30 private:
31 // KeyedServiceShutdownNotifier::Subscription callback. Used to cleanup when
32 // the active PrefService is being destroyed.
33 void OnProfileDestroyed();
34
35 // Bindings that automatically cleanup during connection errors.
36 std::vector<mojo::StrongBindingPtr<prefs::mojom::PreferencesManager>>
37 bindings_;
38
39 // Observes shutdown, when PrefService is being destroyed.
40 std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
41 profile_shutdown_notification_;
42
43 DISALLOW_COPY_AND_ASSIGN(PreferencesConnectionManager);
44 };
45
46 #endif // CHROME_BROWSER_PREFS_PREFERENCES_CONNECTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698