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

Unified Diff: chrome/browser/browser_about_handler.cc

Issue 5228004: Switch the about:gpu implementation from an about handler to dom_ui.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/browser_about_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_about_handler.cc
===================================================================
--- chrome/browser/browser_about_handler.cc (revision 68554)
+++ chrome/browser/browser_about_handler.cc (working copy)
@@ -274,6 +274,7 @@
kAllAboutPaths[i] == kConflictsPath ||
#endif
kAllAboutPaths[i] == kFlagsPath ||
+ kAllAboutPaths[i] == kGpuPath ||
kAllAboutPaths[i] == kNetInternalsPath ||
kAllAboutPaths[i] == kPluginsPath) {
html.append("<li><a href='chrome://");
@@ -715,110 +716,6 @@
return base::IntToString(hi) + "." + base::IntToString(low);
}
-namespace {
-
-#if defined(OS_WIN)
-
-// Output DxDiagNode tree as HTML tables and nested HTML unordered list
-// elements.
-void DxDiagNodeToHTML(std::string* output, const DxDiagNode& node) {
- output->append("<table>\n");
-
- for (std::map<std::string, std::string>::const_iterator it =
- node.values.begin();
- it != node.values.end();
- ++it) {
- output->append("<tr><td><strong>");
- output->append(EscapeForHTML(it->first));
- output->append("</strong></td><td>");
- output->append(EscapeForHTML(it->second));
- output->append("</td></tr>\n");
- }
-
- output->append("</table>\n<ul>\n");
-
- for (std::map<std::string, DxDiagNode>::const_iterator it =
- node.children.begin();
- it != node.children.end();
- ++it) {
- output->append("<li><strong>");
- output->append(EscapeForHTML(it->first));
- output->append("</strong>");
-
- DxDiagNodeToHTML(output, it->second);
-
- output->append("</li>\n");
- }
-
- output->append("</ul>\n");
-}
-
-#endif // OS_WIN
-
-}
-
-std::string AboutGpu() {
- const GPUInfo& gpu_info = GpuProcessHostUIShim::Get()->gpu_info();
-
- std::string html;
-
- html.append("<html><head><title>About GPU</title></head>\n");
-
- if (gpu_info.progress() != GPUInfo::kComplete) {
- GpuProcessHostUIShim::Get()->CollectGraphicsInfoAsynchronously();
-
- // If it's not fully initialized yet, set a timeout to reload the page.
- html.append("<body onload=\"setTimeout('window.location.reload(true)',");
- html.append("2000)\">\n");
- } else {
- html.append("<body>\n");
- }
-
- html.append("<h2>GPU Information</h2>\n");
-
- if (gpu_info.progress() == GPUInfo::kUninitialized) {
- html.append("<p>Retrieving GPU information . . .</p>\n");
- } else {
- html.append("<table><tr>");
- html.append("<td><strong>Initialization time</strong></td><td>");
- html.append(base::Int64ToString(
- gpu_info.initialization_time().InMilliseconds()));
- html.append("</td></tr><tr><td>");
- html.append("<strong>Vendor ID</strong></td><td>");
- html.append(base::StringPrintf("0x%04x", gpu_info.vendor_id()));
- html.append("</td></tr><tr><td>");
- html.append("<strong>Device ID</strong></td><td>");
- html.append(base::StringPrintf("0x%04x", gpu_info.device_id()));
- html.append("</td></tr><tr><td>");
- html.append("<strong>Driver Version</strong></td><td>");
- html.append(WideToASCII(gpu_info.driver_version()).c_str());
- html.append("</td></tr><tr><td>");
- html.append("<strong>Pixel Shader Version</strong></td><td>");
- html.append(VersionNumberToString(gpu_info.pixel_shader_version()).c_str());
- html.append("</td></tr><tr><td>");
- html.append("<strong>Vertex Shader Version</strong></td><td>");
- html.append(VersionNumberToString(
- gpu_info.vertex_shader_version()).c_str());
- html.append("</td></tr><tr><td>");
- html.append("<strong>GL Version</strong></td><td>");
- html.append(VersionNumberToString(gpu_info.gl_version()).c_str());
- html.append("</td></tr></table>");
-
-#if defined(OS_WIN)
- if (gpu_info.progress() != GPUInfo::kComplete) {
- html.append("<p>Retrieving DirectX Diagnostics . . .</p>\n");
- } else {
- html.append("<h2>DirectX Diagnostics</h2>");
- DxDiagNodeToHTML(&html, gpu_info.dx_diagnostics());
- }
-#endif
- }
-
- html.append("</body></html>");
-
- return html;
-}
-
// AboutSource -----------------------------------------------------------------
AboutSource::AboutSource()
@@ -903,8 +800,6 @@
#endif
} else if (path == kSyncPath) {
response = AboutSync();
- } else if (path == kGpuPath) {
- response = AboutGpu();
}
FinishDataRequest(response, request_id);
@@ -1138,6 +1033,12 @@
return true;
}
+ // Rewrite about:gpu/* URLs to chrome://gpu-internals/*
+ if (StartsWithAboutSpecifier(*url, chrome::kAboutGpuURL)) {
+ *url = RemapAboutURL(chrome::kGpuInternalsURL, *url);
+ return true;
+ }
+
// Rewrite about:appcache-internals/* URLs to chrome://appcache/*
if (StartsWithAboutSpecifier(*url, chrome::kAboutAppCacheInternalsURL)) {
*url = RemapAboutURL(chrome::kAppCacheViewInternalsURL, *url);
« no previous file with comments | « no previous file | chrome/browser/browser_about_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698