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

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

Issue 2474653003: PreferencesManager (Closed)
Patch Set: Update PreferencesManager to account for base::Value API change Created 3 years, 12 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
« no previous file with comments | « chrome/browser/prefs/DEPS ('k') | chrome/browser/prefs/preferences_connection_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/compiler_specific.h"
11 #include "base/macros.h"
12 #include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
13 #include "mojo/public/cpp/bindings/strong_binding.h"
14 #include "services/preferences/public/interfaces/preferences.mojom.h"
15 #include "services/service_manager/public/cpp/interface_factory.h"
16 #include "services/service_manager/public/cpp/service.h"
17
18 // Handles all incoming prefs::mojom::PreferenceManagerRequest, providing a
19 // separate PreferencesManager per connection request.
20 //
21 // Additionally monitors system shutdown to clean up connections to PrefService.
22 //
23 // TODO(jonross): Observe profile switching and update PreferenceManager
24 // connections.
25 class PreferencesConnectionManager
26 : public NON_EXPORTED_BASE(
27 service_manager::InterfaceFactory<prefs::mojom::PreferencesManager>),
28 public NON_EXPORTED_BASE(service_manager::Service) {
29 public:
30 PreferencesConnectionManager();
31 ~PreferencesConnectionManager() override;
32
33 private:
34 // mojo::StrongBinding callback:
35 void OnConnectionError(
36 mojo::StrongBindingPtr<prefs::mojom::PreferencesManager> binding);
37
38 // KeyedServiceShutdownNotifier::Subscription callback. Used to cleanup when
39 // the active PrefService is being destroyed.
40 void OnProfileDestroyed();
41
42 // service_manager::InterfaceFactory<PreferencesManager>:
43 void Create(const service_manager::Identity& remote_identity,
44 prefs::mojom::PreferencesManagerRequest request) override;
45
46 // service_manager::Service:
47 void OnStart() override;
48 bool OnConnect(const service_manager::ServiceInfo& remote_info,
49 service_manager::InterfaceRegistry* registry) override;
50
51 // Bindings that automatically cleanup during connection errors.
52 std::vector<mojo::StrongBindingPtr<prefs::mojom::PreferencesManager>>
53 bindings_;
54
55 // Observes shutdown, when PrefService is being destroyed.
56 std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
57 profile_shutdown_notification_;
58
59 DISALLOW_COPY_AND_ASSIGN(PreferencesConnectionManager);
60 };
61
62 #endif // CHROME_BROWSER_PREFS_PREFERENCES_CONNECTION_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/prefs/DEPS ('k') | chrome/browser/prefs/preferences_connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698