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

Side by Side Diff: chrome/browser/ui/webui/options/core_options_handler.cc

Issue 7647026: base: Add three helper functions to Values API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a typo Ceate -> Create Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/options/core_options_handler.h" 5 #include "chrome/browser/ui/webui/options/core_options_handler.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 DCHECK(handlers_host_); 150 DCHECK(handlers_host_);
151 handlers_host_->InitializeHandlers(); 151 handlers_host_->InitializeHandlers();
152 } 152 }
153 153
154 Value* CoreOptionsHandler::FetchPref(const std::string& pref_name) { 154 Value* CoreOptionsHandler::FetchPref(const std::string& pref_name) {
155 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs(); 155 PrefService* pref_service = Profile::FromWebUI(web_ui_)->GetPrefs();
156 156
157 const PrefService::Preference* pref = 157 const PrefService::Preference* pref =
158 pref_service->FindPreference(pref_name.c_str()); 158 pref_service->FindPreference(pref_name.c_str());
159 if (!pref) 159 if (!pref)
160 return Value::CreateNullValue(); 160 return base::NullValue();
161 161
162 return CreateValueForPref(pref); 162 return CreateValueForPref(pref);
163 } 163 }
164 164
165 void CoreOptionsHandler::ObservePref(const std::string& pref_name) { 165 void CoreOptionsHandler::ObservePref(const std::string& pref_name) {
166 registrar_.Add(pref_name.c_str(), this); 166 registrar_.Add(pref_name.c_str(), this);
167 } 167 }
168 168
169 void CoreOptionsHandler::SetPref(const std::string& pref_name, 169 void CoreOptionsHandler::SetPref(const std::string& pref_name,
170 const Value* value, 170 const Value* value,
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 const std::wstring& callback_function = iter->second; 391 const std::wstring& callback_function = iter->second;
392 ListValue result_value; 392 ListValue result_value;
393 result_value.Append(Value::CreateStringValue(pref_name->c_str())); 393 result_value.Append(Value::CreateStringValue(pref_name->c_str()));
394 394
395 result_value.Append(CreateValueForPref(pref)); 395 result_value.Append(CreateValueForPref(pref));
396 396
397 web_ui_->CallJavascriptFunction(WideToASCII(callback_function), 397 web_ui_->CallJavascriptFunction(WideToASCII(callback_function),
398 result_value); 398 result_value);
399 } 399 }
400 } 400 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/cookies_view_handler.cc ('k') | chrome/browser/ui/webui/options/personal_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698