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

Side by Side Diff: chrome/browser/extensions/api/settings_private/settings_private_delegate.cc

Issue 1315173003: PrefObject -> PrefData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extensions/api/settings_private/settings_private_delega te.h" 5 #include "chrome/browser/extensions/api/settings_private/settings_private_delega te.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chromeos/settings/cros_settings.h" 10 #include "chrome/browser/chromeos/settings/cros_settings.h"
(...skipping 11 matching lines...) Expand all
22 SettingsPrivateDelegate::SettingsPrivateDelegate(Profile* profile) 22 SettingsPrivateDelegate::SettingsPrivateDelegate(Profile* profile)
23 : profile_(profile) { 23 : profile_(profile) {
24 prefs_util_.reset(new PrefsUtil(profile)); 24 prefs_util_.reset(new PrefsUtil(profile));
25 } 25 }
26 26
27 SettingsPrivateDelegate::~SettingsPrivateDelegate() { 27 SettingsPrivateDelegate::~SettingsPrivateDelegate() {
28 } 28 }
29 29
30 scoped_ptr<base::Value> SettingsPrivateDelegate::GetPref( 30 scoped_ptr<base::Value> SettingsPrivateDelegate::GetPref(
31 const std::string& name) { 31 const std::string& name) {
32 scoped_ptr<api::settings_private::PrefObject> pref = 32 scoped_ptr<api::settings_private::PrefData> pref =
33 prefs_util_->GetPref(name); 33 prefs_util_->GetPref(name);
34 if (!pref) 34 if (!pref)
35 return base::Value::CreateNullValue(); 35 return base::Value::CreateNullValue();
36 return pref->ToValue(); 36 return pref->ToValue();
37 } 37 }
38 38
39 scoped_ptr<base::Value> SettingsPrivateDelegate::GetAllPrefs() { 39 scoped_ptr<base::Value> SettingsPrivateDelegate::GetAllPrefs() {
40 scoped_ptr<base::ListValue> prefs(new base::ListValue()); 40 scoped_ptr<base::ListValue> prefs(new base::ListValue());
41 41
42 const TypedPrefMap& keys = prefs_util_->GetWhitelistedKeys(); 42 const TypedPrefMap& keys = prefs_util_->GetWhitelistedKeys();
43 for (const auto& it : keys) { 43 for (const auto& it : keys) {
44 scoped_ptr<base::Value> pref = GetPref(it.first); 44 scoped_ptr<base::Value> pref = GetPref(it.first);
45 if (!pref->IsType(base::Value::TYPE_NULL)) 45 if (!pref->IsType(base::Value::TYPE_NULL))
46 prefs->Append(pref.release()); 46 prefs->Append(pref.release());
47 } 47 }
48 48
49 return prefs.Pass(); 49 return prefs.Pass();
50 } 50 }
51 51
52 bool SettingsPrivateDelegate::SetPref(const std::string& pref_name, 52 bool SettingsPrivateDelegate::SetPref(const std::string& pref_name,
53 const base::Value* value) { 53 const base::Value* value) {
54 return prefs_util_->SetPref(pref_name, value); 54 return prefs_util_->SetPref(pref_name, value);
55 } 55 }
56 56
57 } // namespace extensions 57 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698