OLD | NEW |
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 PrefService* pref_service = web_ui_->GetProfile()->GetPrefs(); | 134 PrefService* pref_service = web_ui_->GetProfile()->GetPrefs(); |
135 | 135 |
136 const PrefService::Preference* pref = | 136 const PrefService::Preference* pref = |
137 pref_service->FindPreference(pref_name.c_str()); | 137 pref_service->FindPreference(pref_name.c_str()); |
138 | 138 |
139 Value* return_value; | 139 Value* return_value; |
140 if (pref) { | 140 if (pref) { |
141 DictionaryValue* dict = new DictionaryValue; | 141 DictionaryValue* dict = new DictionaryValue; |
142 dict->Set("value", pref->GetValue()->DeepCopy()); | 142 dict->Set("value", pref->GetValue()->DeepCopy()); |
143 dict->SetBoolean("managed", pref->IsManaged()); | 143 dict->SetBoolean("managed", pref->IsManaged()); |
| 144 dict->SetBoolean("extensionControlled", pref->IsExtensionControlled()); |
| 145 dict->SetBoolean("disabled", !pref->IsUserModifiable()); |
144 return_value = dict; | 146 return_value = dict; |
145 } else { | 147 } else { |
146 return_value = Value::CreateNullValue(); | 148 return_value = Value::CreateNullValue(); |
147 } | 149 } |
148 return return_value; | 150 return return_value; |
149 } | 151 } |
150 | 152 |
151 void CoreOptionsHandler::ObservePref(const std::string& pref_name) { | 153 void CoreOptionsHandler::ObservePref(const std::string& pref_name) { |
152 registrar_.Add(pref_name.c_str(), this); | 154 registrar_.Add(pref_name.c_str(), this); |
153 } | 155 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 for (PreferenceCallbackMap::const_iterator iter = | 372 for (PreferenceCallbackMap::const_iterator iter = |
371 pref_callback_map_.find(*pref_name); | 373 pref_callback_map_.find(*pref_name); |
372 iter != pref_callback_map_.end(); ++iter) { | 374 iter != pref_callback_map_.end(); ++iter) { |
373 const std::wstring& callback_function = iter->second; | 375 const std::wstring& callback_function = iter->second; |
374 ListValue result_value; | 376 ListValue result_value; |
375 result_value.Append(Value::CreateStringValue(pref_name->c_str())); | 377 result_value.Append(Value::CreateStringValue(pref_name->c_str())); |
376 | 378 |
377 DictionaryValue* dict = new DictionaryValue; | 379 DictionaryValue* dict = new DictionaryValue; |
378 dict->Set("value", pref->GetValue()->DeepCopy()); | 380 dict->Set("value", pref->GetValue()->DeepCopy()); |
379 dict->SetBoolean("managed", pref->IsManaged()); | 381 dict->SetBoolean("managed", pref->IsManaged()); |
| 382 dict->SetBoolean("extensionControlled", pref->IsExtensionControlled()); |
| 383 dict->SetBoolean("disabled", !pref->IsUserModifiable()); |
380 result_value.Append(dict); | 384 result_value.Append(dict); |
381 | 385 |
382 web_ui_->CallJavascriptFunction(WideToASCII(callback_function), | 386 web_ui_->CallJavascriptFunction(WideToASCII(callback_function), |
383 result_value); | 387 result_value); |
384 } | 388 } |
385 } | 389 } |
386 } | 390 } |
OLD | NEW |