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

Side by Side Diff: chrome/browser/supervised_user/legacy/supervised_user_shared_settings_update.cc

Issue 1878143002: Convert //chrome/browser/supervised_user from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
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 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ update.h" 5 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ update.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ service.h" 11 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_ service.h"
12 12
13 SupervisedUserSharedSettingsUpdate::SupervisedUserSharedSettingsUpdate( 13 SupervisedUserSharedSettingsUpdate::SupervisedUserSharedSettingsUpdate(
14 SupervisedUserSharedSettingsService* service, 14 SupervisedUserSharedSettingsService* service,
15 const std::string& su_id, 15 const std::string& su_id,
16 const std::string& key, 16 const std::string& key,
17 scoped_ptr<base::Value> value, 17 std::unique_ptr<base::Value> value,
18 const base::Callback<void(bool)>& success_callback) 18 const base::Callback<void(bool)>& success_callback)
19 : service_(service), 19 : service_(service),
20 su_id_(su_id), 20 su_id_(su_id),
21 key_(key), 21 key_(key),
22 value_(std::move(value)), 22 value_(std::move(value)),
23 callback_(success_callback) { 23 callback_(success_callback) {
24 service->SetValueInternal(su_id, key, *value_, false); 24 service->SetValueInternal(su_id, key, *value_, false);
25 subscription_ = service->Subscribe( 25 subscription_ = service->Subscribe(
26 base::Bind(&SupervisedUserSharedSettingsUpdate::OnSettingChanged, 26 base::Bind(&SupervisedUserSharedSettingsUpdate::OnSettingChanged,
27 base::Unretained(this))); 27 base::Unretained(this)));
28 } 28 }
29 29
30 SupervisedUserSharedSettingsUpdate::~SupervisedUserSharedSettingsUpdate() {} 30 SupervisedUserSharedSettingsUpdate::~SupervisedUserSharedSettingsUpdate() {}
31 31
32 void SupervisedUserSharedSettingsUpdate::OnSettingChanged( 32 void SupervisedUserSharedSettingsUpdate::OnSettingChanged(
33 const std::string& su_id, const std::string& key) { 33 const std::string& su_id, const std::string& key) {
34 if (su_id != su_id_) 34 if (su_id != su_id_)
35 return; 35 return;
36 36
37 if (key != key_) 37 if (key != key_)
38 return; 38 return;
39 39
40 const base::Value* value = service_->GetValue(su_id, key); 40 const base::Value* value = service_->GetValue(su_id, key);
41 callback_.Run(value->Equals(value_.get())); 41 callback_.Run(value->Equals(value_.get()));
42 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698