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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 chrome::kChromeUIPrintHost, | 138 chrome::kChromeUIPrintHost, |
139 chrome::kChromeUIQuotaInternalsHost, | 139 chrome::kChromeUIQuotaInternalsHost, |
140 chrome::kChromeUISessionsHost, | 140 chrome::kChromeUISessionsHost, |
141 chrome::kChromeUISettingsHost, | 141 chrome::kChromeUISettingsHost, |
142 chrome::kChromeUIStatsHost, | 142 chrome::kChromeUIStatsHost, |
143 chrome::kChromeUISyncInternalsHost, | 143 chrome::kChromeUISyncInternalsHost, |
144 chrome::kChromeUITaskManagerHost, | 144 chrome::kChromeUITaskManagerHost, |
145 chrome::kChromeUITCMallocHost, | 145 chrome::kChromeUITCMallocHost, |
146 chrome::kChromeUITermsHost, | 146 chrome::kChromeUITermsHost, |
147 chrome::kChromeUITracingHost, | 147 chrome::kChromeUITracingHost, |
| 148 chrome::kChromeUITrackingHost, |
148 chrome::kChromeUIVersionHost, | 149 chrome::kChromeUIVersionHost, |
149 chrome::kChromeUIWorkersHost, | 150 chrome::kChromeUIWorkersHost, |
150 #if defined(TRACK_ALL_TASK_OBJECTS) | |
151 chrome::kChromeUITrackingHost, | |
152 #endif | |
153 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
154 chrome::kChromeUIConflictsHost, | 152 chrome::kChromeUIConflictsHost, |
155 #endif | 153 #endif |
156 #if defined(OS_LINUX) | 154 #if defined(OS_LINUX) |
157 chrome::kChromeUILinuxProxyConfigHost, | 155 chrome::kChromeUILinuxProxyConfigHost, |
158 chrome::kChromeUISandboxHost, | 156 chrome::kChromeUISandboxHost, |
159 #endif | 157 #endif |
160 #if defined(OS_CHROMEOS) | 158 #if defined(OS_CHROMEOS) |
161 chrome::kChromeUIActiveDownloadsHost, | 159 chrome::kChromeUIActiveDownloadsHost, |
162 chrome::kChromeUIChooseMobileNetworkHost, | 160 chrome::kChromeUIChooseMobileNetworkHost, |
(...skipping 14 matching lines...) Expand all Loading... |
177 const char* const kAboutSourceNames[] = { | 175 const char* const kAboutSourceNames[] = { |
178 chrome::kChromeUIChromeURLsHost, | 176 chrome::kChromeUIChromeURLsHost, |
179 chrome::kChromeUICreditsHost, | 177 chrome::kChromeUICreditsHost, |
180 chrome::kChromeUIDNSHost, | 178 chrome::kChromeUIDNSHost, |
181 chrome::kChromeUIHistogramsHost, | 179 chrome::kChromeUIHistogramsHost, |
182 chrome::kChromeUIMemoryHost, | 180 chrome::kChromeUIMemoryHost, |
183 chrome::kChromeUIMemoryRedirectHost, | 181 chrome::kChromeUIMemoryRedirectHost, |
184 chrome::kChromeUIStatsHost, | 182 chrome::kChromeUIStatsHost, |
185 chrome::kChromeUITaskManagerHost, | 183 chrome::kChromeUITaskManagerHost, |
186 chrome::kChromeUITermsHost, | 184 chrome::kChromeUITermsHost, |
| 185 chrome::kChromeUITrackingHost, |
187 chrome::kChromeUIVersionHost, | 186 chrome::kChromeUIVersionHost, |
188 #if defined(TRACK_ALL_TASK_OBJECTS) | |
189 chrome::kChromeUITrackingHost, | |
190 #endif | |
191 #if defined(USE_TCMALLOC) | 187 #if defined(USE_TCMALLOC) |
192 chrome::kChromeUITCMallocHost, | 188 chrome::kChromeUITCMallocHost, |
193 #endif | 189 #endif |
194 #if defined(OS_LINUX) | 190 #if defined(OS_LINUX) |
195 chrome::kChromeUILinuxProxyConfigHost, | 191 chrome::kChromeUILinuxProxyConfigHost, |
196 chrome::kChromeUISandboxHost, | 192 chrome::kChromeUISandboxHost, |
197 #endif | 193 #endif |
198 #if defined(OS_CHROMEOS) | 194 #if defined(OS_CHROMEOS) |
199 chrome::kChromeUICryptohomeHost, | 195 chrome::kChromeUICryptohomeHost, |
200 chrome::kChromeUIDiscardsHost, | 196 chrome::kChromeUIDiscardsHost, |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 handler(new AboutMemoryHandler(source, request_id)); | 878 handler(new AboutMemoryHandler(source, request_id)); |
883 handler->StartFetch(); | 879 handler->StartFetch(); |
884 } else { | 880 } else { |
885 source->FinishDataRequest( | 881 source->FinishDataRequest( |
886 ResourceBundle::GetSharedInstance().GetRawDataResource( | 882 ResourceBundle::GetSharedInstance().GetRawDataResource( |
887 path == kMemoryJsPath ? IDR_ABOUT_MEMORY_JS : | 883 path == kMemoryJsPath ? IDR_ABOUT_MEMORY_JS : |
888 IDR_ABOUT_MEMORY_HTML).as_string(), request_id); | 884 IDR_ABOUT_MEMORY_HTML).as_string(), request_id); |
889 } | 885 } |
890 } | 886 } |
891 | 887 |
892 #if defined(TRACK_ALL_TASK_OBJECTS) | |
893 static std::string AboutTracking(const std::string& query) { | 888 static std::string AboutTracking(const std::string& query) { |
894 std::string unescaped_title("About Tracking"); | 889 std::string unescaped_title("About Tracking"); |
895 if (!query.empty()) { | 890 if (!query.empty()) { |
896 unescaped_title += " - "; | 891 unescaped_title += " - "; |
897 unescaped_title += net::UnescapeURLComponent(query, UnescapeRule::NORMAL); | 892 unescaped_title += net::UnescapeURLComponent(query, UnescapeRule::NORMAL); |
898 } | 893 } |
899 std::string data; | 894 std::string data; |
900 AppendHeader(&data, 0, unescaped_title); | 895 AppendHeader(&data, 0, unescaped_title); |
901 AppendBody(&data); | 896 AppendBody(&data); |
902 tracked_objects::ThreadData::WriteHTML(query, &data); | 897 tracked_objects::ThreadData::WriteHTML(query, &data); |
903 AppendFooter(&data); | 898 AppendFooter(&data); |
904 return data; | 899 return data; |
905 } | 900 } |
906 #endif // TRACK_ALL_TASK_OBJECTS | |
907 | 901 |
908 // Handler for filling in the "about:stats" page, as called by the browser's | 902 // Handler for filling in the "about:stats" page, as called by the browser's |
909 // About handler processing. | 903 // About handler processing. |
910 // |query| is roughly the query string of the about:stats URL. | 904 // |query| is roughly the query string of the about:stats URL. |
911 // Returns a string containing the HTML to render for the about:stats page. | 905 // Returns a string containing the HTML to render for the about:stats page. |
912 // Conditional Output: | 906 // Conditional Output: |
913 // if |query| is "json", returns a JSON format of all counters. | 907 // if |query| is "json", returns a JSON format of all counters. |
914 // if |query| is "raw", returns plain text of counter deltas. | 908 // if |query| is "raw", returns plain text of counter deltas. |
915 // otherwise, returns HTML with pretty JS/HTML to display the data. | 909 // otherwise, returns HTML with pretty JS/HTML to display the data. |
916 std::string AboutStats(const std::string& query) { | 910 std::string AboutStats(const std::string& query) { |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 } else if (host == chrome::kChromeUIOSCreditsHost) { | 1461 } else if (host == chrome::kChromeUIOSCreditsHost) { |
1468 response = ResourceBundle::GetSharedInstance().GetRawDataResource( | 1462 response = ResourceBundle::GetSharedInstance().GetRawDataResource( |
1469 IDR_OS_CREDITS_HTML).as_string(); | 1463 IDR_OS_CREDITS_HTML).as_string(); |
1470 #endif | 1464 #endif |
1471 #if defined(OS_LINUX) | 1465 #if defined(OS_LINUX) |
1472 } else if (host == chrome::kChromeUISandboxHost) { | 1466 } else if (host == chrome::kChromeUISandboxHost) { |
1473 response = AboutSandbox(); | 1467 response = AboutSandbox(); |
1474 #endif | 1468 #endif |
1475 } else if (host == chrome::kChromeUIStatsHost) { | 1469 } else if (host == chrome::kChromeUIStatsHost) { |
1476 response = AboutStats(path); | 1470 response = AboutStats(path); |
1477 #if defined(TRACK_ALL_TASK_OBJECTS) | |
1478 } else if (host == chrome::kChromeUITrackingHost) { | 1471 } else if (host == chrome::kChromeUITrackingHost) { |
1479 response = AboutTracking(path); | 1472 response = AboutTracking(path); |
1480 #endif | |
1481 #if defined(USE_TCMALLOC) | 1473 #if defined(USE_TCMALLOC) |
1482 } else if (host == chrome::kChromeUITCMallocHost) { | 1474 } else if (host == chrome::kChromeUITCMallocHost) { |
1483 response = AboutTcmalloc(); | 1475 response = AboutTcmalloc(); |
1484 #endif | 1476 #endif |
1485 } else if (host == chrome::kChromeUITermsHost) { | 1477 } else if (host == chrome::kChromeUITermsHost) { |
1486 #if defined(OS_CHROMEOS) | 1478 #if defined(OS_CHROMEOS) |
1487 ChromeOSTermsHandler::Start(this, path, request_id); | 1479 ChromeOSTermsHandler::Start(this, path, request_id); |
1488 return; | 1480 return; |
1489 #else | 1481 #else |
1490 response = ResourceBundle::GetSharedInstance().GetRawDataResource( | 1482 response = ResourceBundle::GetSharedInstance().GetRawDataResource( |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 return false; | 1629 return false; |
1638 } | 1630 } |
1639 | 1631 |
1640 std::vector<std::string> ChromePaths() { | 1632 std::vector<std::string> ChromePaths() { |
1641 std::vector<std::string> paths; | 1633 std::vector<std::string> paths; |
1642 paths.reserve(arraysize(kChromePaths)); | 1634 paths.reserve(arraysize(kChromePaths)); |
1643 for (size_t i = 0; i < arraysize(kChromePaths); i++) | 1635 for (size_t i = 0; i < arraysize(kChromePaths); i++) |
1644 paths.push_back(kChromePaths[i]); | 1636 paths.push_back(kChromePaths[i]); |
1645 return paths; | 1637 return paths; |
1646 } | 1638 } |
OLD | NEW |