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

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

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/about_ui.h" 5 #include "chrome/browser/ui/webui/about_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 } 876 }
877 break; 877 break;
878 default: 878 default:
879 NOTREACHED(); 879 NOTREACHED();
880 } 880 }
881 } 881 }
882 882
883 std::string data; 883 std::string data;
884 if (query == "json" || query == kStringsJsPath) { 884 if (query == "json" || query == kStringsJsPath) {
885 base::JSONWriter::WriteWithOptions( 885 base::JSONWriter::WriteWithOptions(
886 &root, true, base::JSONWriter::OPTIONS_DO_NOT_ESCAPE, &data); 886 &root,
887 base::JSONWriter::OPTIONS_DO_NOT_ESCAPE |
888 base::JSONWriter::OPTIONS_PRETTY_PRINT,
889 &data);
887 if (query == kStringsJsPath) 890 if (query == kStringsJsPath)
888 data = "var templateData = " + data + ";"; 891 data = "var templateData = " + data + ";";
889 } else if (query == "raw") { 892 } else if (query == "raw") {
890 // Dump the raw counters which have changed in text format. 893 // Dump the raw counters which have changed in text format.
891 data = "<pre>"; 894 data = "<pre>";
892 data.append(StringPrintf("Counter changes in the last %ldms\n", 895 data.append(StringPrintf("Counter changes in the last %ldms\n",
893 static_cast<long int>(time_since_last_sample.InMilliseconds()))); 896 static_cast<long int>(time_since_last_sample.InMilliseconds())));
894 for (size_t i = 0; i < counters->GetSize(); ++i) { 897 for (size_t i = 0; i < counters->GetSize(); ++i) {
895 Value* entry = NULL; 898 Value* entry = NULL;
896 bool rv = counters->Get(i, &entry); 899 bool rv = counters->Get(i, &entry);
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 } 1405 }
1403 1406
1404 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name) 1407 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name)
1405 : WebUIController(web_ui) { 1408 : WebUIController(web_ui) {
1406 Profile* profile = Profile::FromWebUI(web_ui); 1409 Profile* profile = Profile::FromWebUI(web_ui);
1407 ChromeURLDataManager::DataSource* source = 1410 ChromeURLDataManager::DataSource* source =
1408 new AboutUIHTMLSource(name, profile); 1411 new AboutUIHTMLSource(name, profile);
1409 if (source) 1412 if (source)
1410 profile->GetChromeURLDataManager()->AddDataSource(source); 1413 profile->GetChromeURLDataManager()->AddDataSource(source);
1411 } 1414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698