Chromium Code Reviews| Index: chrome/browser/managed_mode/managed_user_shared_settings_update.h |
| diff --git a/chrome/browser/managed_mode/managed_user_shared_settings_update.h b/chrome/browser/managed_mode/managed_user_shared_settings_update.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7532b3ae8e217dd126571deee39774a7597503fc |
| --- /dev/null |
| +++ b/chrome/browser/managed_mode/managed_user_shared_settings_update.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SHARED_SETTINGS_UPDATE_H_ |
| +#define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SHARED_SETTINGS_UPDATE_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/callback.h" |
| +#include "base/callback_list.h" |
| +#include "base/memory/scoped_ptr.h" |
| + |
| +namespace base { |
| +class Value; |
| +} |
| + |
| +class ManagedUserSharedSettingsService; |
| + |
| +// Lets clients of ManagedUserSharedSettingsService change settings and wait for |
| +// the Sync server to acknowledge the change. The callback passed in the |
| +// constructor will be called with a true success value when the Sync server |
| +// flipped the acknowledgement flag for the setting. If another client changes |
|
Pam (message me for reviews)
2014/01/08 10:30:40
flips
Bernhard Bauer
2014/01/08 11:42:04
Well, technically it happens a little bit afterwar
|
| +// the value in the mean time, the callback will be run with a false success |
| +// value. If the object is destroyed before that, the callback will not be run. |
| +// Note that any changes made to the setting will not be undone when destroying |
| +// the object, even if the update was not successful or was canceled. |
| +class ManagedUserSharedSettingsUpdate { |
| + public: |
| + ManagedUserSharedSettingsUpdate( |
| + ManagedUserSharedSettingsService* service, |
| + const std::string& mu_id, |
| + const std::string& key, |
| + scoped_ptr<base::Value> value, |
| + const base::Callback<void(bool)>& success_callback); |
| + ~ManagedUserSharedSettingsUpdate(); |
| + |
| + private: |
| + typedef base::CallbackList<void(const std::string&, const std::string&)> |
| + CallbackList; |
| + |
| + void OnSettingChanged(const std::string& mu_id, |
| + const std::string& key); |
| + |
| + ManagedUserSharedSettingsService* service_; |
| + std::string mu_id_; |
| + std::string key_; |
| + scoped_ptr<base::Value> value_; |
| + base::Callback<void(bool)> callback_; |
| + scoped_ptr<CallbackList::Subscription> subscription_; |
| +}; |
| + |
| +#endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SHARED_SETTINGS_UPDATE_H_ |