OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |