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

Side by Side Diff: chrome/browser/ui/webui/prefs_internals_source.cc

Issue 2799143002: Improve profile stats performace. (Closed)
Patch Set: Use enum Created 3 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
« no previous file with comments | « chrome/browser/ui/webui/local_state/local_state_ui.cc ('k') | components/prefs/pref_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/local_state/local_state_ui.cc ('k') | components/prefs/pref_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698