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_MANAGED_MODE_MANAGED_USER_SHARED_SETTINGS_UPDATE_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SHARED_SETTINGS_UPDATE_H_ |
6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SHARED_SETTINGS_UPDATE_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SHARED_SETTINGS_UPDATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/callback_list.h" | 11 #include "base/callback_list.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class Value; | 15 class Value; |
16 } | 16 } |
17 | 17 |
18 class ManagedUserSharedSettingsService; | 18 class SupervisedUserSharedSettingsService; |
19 | 19 |
20 // Lets clients of ManagedUserSharedSettingsService change settings and wait for | 20 // Lets clients of SupervisedUserSharedSettingsService change settings and wait |
21 // the Sync server to acknowledge the change. The callback passed in the | 21 // for the Sync server to acknowledge the change. The callback passed in the |
22 // constructor will be called with a true success value after the Sync server | 22 // constructor will be called with a true success value after the Sync server |
23 // has flipped the acknowledgement flag for the setting. If another client | 23 // has flipped the acknowledgement flag for the setting. If another client |
24 // changes the value in the mean time, the callback will be run with a false | 24 // changes the value in the mean time, the callback will be run with a false |
25 // success value. If the object is destroyed before that, the callback will not | 25 // success value. If the object is destroyed before that, the callback will not |
26 // be run. Note that any changes made to the setting will not be undone when | 26 // be run. Note that any changes made to the setting will not be undone when |
27 // destroying the object, even if the update was not successful or was canceled. | 27 // destroying the object, even if the update was not successful or was canceled. |
28 class ManagedUserSharedSettingsUpdate { | 28 class SupervisedUserSharedSettingsUpdate { |
29 public: | 29 public: |
30 ManagedUserSharedSettingsUpdate( | 30 SupervisedUserSharedSettingsUpdate( |
31 ManagedUserSharedSettingsService* service, | 31 SupervisedUserSharedSettingsService* service, |
32 const std::string& mu_id, | 32 const std::string& su_id, |
33 const std::string& key, | 33 const std::string& key, |
34 scoped_ptr<base::Value> value, | 34 scoped_ptr<base::Value> value, |
35 const base::Callback<void(bool)>& success_callback); | 35 const base::Callback<void(bool)>& success_callback); |
36 ~ManagedUserSharedSettingsUpdate(); | 36 ~SupervisedUserSharedSettingsUpdate(); |
37 | 37 |
38 private: | 38 private: |
39 typedef base::CallbackList<void(const std::string&, const std::string&)> | 39 typedef base::CallbackList<void(const std::string&, const std::string&)> |
40 CallbackList; | 40 CallbackList; |
41 | 41 |
42 void OnSettingChanged(const std::string& mu_id, | 42 void OnSettingChanged(const std::string& su_id, |
43 const std::string& key); | 43 const std::string& key); |
44 | 44 |
45 ManagedUserSharedSettingsService* service_; | 45 SupervisedUserSharedSettingsService* service_; |
46 std::string mu_id_; | 46 std::string su_id_; |
47 std::string key_; | 47 std::string key_; |
48 scoped_ptr<base::Value> value_; | 48 scoped_ptr<base::Value> value_; |
49 base::Callback<void(bool)> callback_; | 49 base::Callback<void(bool)> callback_; |
50 scoped_ptr<CallbackList::Subscription> subscription_; | 50 scoped_ptr<CallbackList::Subscription> subscription_; |
51 }; | 51 }; |
52 | 52 |
53 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SHARED_SETTINGS_UPDATE_H_ | 53 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SHARED_SETTINGS_UPDATE
_H_ |
OLD | NEW |