OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHROMEOS_POLICY_SERVER_BACKED_STATE_KEYS_BROKER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_SERVER_BACKED_STATE_KEYS_BROKER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_SERVER_BACKED_STATE_KEYS_BROKER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_SERVER_BACKED_STATE_KEYS_BROKER_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/callback.h" | 12 #include "base/callback.h" |
12 #include "base/callback_list.h" | 13 #include "base/callback_list.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 class TaskRunner; | 19 class TaskRunner; |
20 } | 20 } |
21 | 21 |
22 namespace chromeos { | 22 namespace chromeos { |
23 class SessionManagerClient; | 23 class SessionManagerClient; |
24 } | 24 } |
25 | 25 |
26 namespace policy { | 26 namespace policy { |
27 | 27 |
28 // Brokers server-backed FRE state keys for the device. Retrieves them from | 28 // Brokers server-backed FRE state keys for the device. Retrieves them from |
29 // session manager via DBus and refreshes them periodically. Consumers can | 29 // session manager via DBus and refreshes them periodically. Consumers can |
30 // register callbacks to invoke when the state keys change. | 30 // register callbacks to invoke when the state keys change. |
31 class ServerBackedStateKeysBroker { | 31 class ServerBackedStateKeysBroker { |
32 public: | 32 public: |
33 typedef scoped_ptr<base::CallbackList<void()>::Subscription> Subscription; | 33 typedef std::unique_ptr<base::CallbackList<void()>::Subscription> |
| 34 Subscription; |
34 typedef base::Callback<void(const std::vector<std::string>&)> | 35 typedef base::Callback<void(const std::vector<std::string>&)> |
35 StateKeysCallback; | 36 StateKeysCallback; |
36 | 37 |
37 ServerBackedStateKeysBroker( | 38 ServerBackedStateKeysBroker( |
38 chromeos::SessionManagerClient* session_manager_client, | 39 chromeos::SessionManagerClient* session_manager_client, |
39 scoped_refptr<base::TaskRunner> delayed_task_runner); | 40 scoped_refptr<base::TaskRunner> delayed_task_runner); |
40 ~ServerBackedStateKeysBroker(); | 41 ~ServerBackedStateKeysBroker(); |
41 | 42 |
42 // Registers a callback to be invoked whenever the state keys get updated. | 43 // Registers a callback to be invoked whenever the state keys get updated. |
43 // Note that consuming code needs to hold on to the returned Subscription as | 44 // Note that consuming code needs to hold on to the returned Subscription as |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 std::vector<StateKeysCallback> request_callbacks_; | 95 std::vector<StateKeysCallback> request_callbacks_; |
95 | 96 |
96 base::WeakPtrFactory<ServerBackedStateKeysBroker> weak_factory_; | 97 base::WeakPtrFactory<ServerBackedStateKeysBroker> weak_factory_; |
97 | 98 |
98 DISALLOW_COPY_AND_ASSIGN(ServerBackedStateKeysBroker); | 99 DISALLOW_COPY_AND_ASSIGN(ServerBackedStateKeysBroker); |
99 }; | 100 }; |
100 | 101 |
101 } // namespace policy | 102 } // namespace policy |
102 | 103 |
103 #endif // CHROME_BROWSER_CHROMEOS_POLICY_SERVER_BACKED_STATE_KEYS_BROKER_H_ | 104 #endif // CHROME_BROWSER_CHROMEOS_POLICY_SERVER_BACKED_STATE_KEYS_BROKER_H_ |
OLD | NEW |