| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/prefs_internals_source.h" | 5 #include "chrome/browser/ui/webui/prefs_internals_source.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 return "text/plain"; | 27 return "text/plain"; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void PrefsInternalsSource::StartDataRequest( | 30 void PrefsInternalsSource::StartDataRequest( |
| 31 const std::string& path, | 31 const std::string& path, |
| 32 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, | 32 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
| 33 const content::URLDataSource::GotDataCallback& callback) { | 33 const content::URLDataSource::GotDataCallback& callback) { |
| 34 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 34 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 35 std::string json; | 35 std::string json; |
| 36 std::unique_ptr<base::DictionaryValue> prefs = | 36 std::unique_ptr<base::DictionaryValue> prefs = |
| 37 profile_->GetPrefs()->GetPreferenceValues(); | 37 profile_->GetPrefs()->GetPreferenceValues(PrefService::INCLUDE_DEFAULTS); |
| 38 DCHECK(prefs); | 38 DCHECK(prefs); |
| 39 CHECK(base::JSONWriter::WriteWithOptions( | 39 CHECK(base::JSONWriter::WriteWithOptions( |
| 40 *prefs, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json)); | 40 *prefs, base::JSONWriter::OPTIONS_PRETTY_PRINT, &json)); |
| 41 callback.Run(base::RefCountedString::TakeString(&json)); | 41 callback.Run(base::RefCountedString::TakeString(&json)); |
| 42 } | 42 } |
| OLD | NEW |