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

Side by Side Diff: chrome/browser/browser_about_handler.cc

Issue 3817004: Rename about:labs to about:flags, step 1/3 (Closed)
Patch Set: Created 10 years, 2 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 namespace { 95 namespace {
96 96
97 // The (alphabetized) paths used for the about pages. 97 // The (alphabetized) paths used for the about pages.
98 // Note: Keep these in sync with url_constants.h 98 // Note: Keep these in sync with url_constants.h
99 const char kAppCacheInternalsPath[] = "appcache-internals"; 99 const char kAppCacheInternalsPath[] = "appcache-internals";
100 const char kBlobInternalsPath[] = "blob-internals"; 100 const char kBlobInternalsPath[] = "blob-internals";
101 const char kCreditsPath[] = "credits"; 101 const char kCreditsPath[] = "credits";
102 const char kCachePath[] = "view-http-cache"; 102 const char kCachePath[] = "view-http-cache";
103 const char kDnsPath[] = "dns"; 103 const char kDnsPath[] = "dns";
104 const char kFlagsPath[] = "flags";
104 const char kGpuPath[] = "gpu"; 105 const char kGpuPath[] = "gpu";
105 const char kHistogramsPath[] = "histograms"; 106 const char kHistogramsPath[] = "histograms";
106 const char kLabsPath[] = "labs";
107 const char kMemoryRedirectPath[] = "memory-redirect"; 107 const char kMemoryRedirectPath[] = "memory-redirect";
108 const char kMemoryPath[] = "memory"; 108 const char kMemoryPath[] = "memory";
109 const char kStatsPath[] = "stats"; 109 const char kStatsPath[] = "stats";
110 const char kSyncPath[] = "sync"; 110 const char kSyncPath[] = "sync";
111 const char kTasksPath[] = "tasks"; 111 const char kTasksPath[] = "tasks";
112 const char kTcmallocPath[] = "tcmalloc"; 112 const char kTcmallocPath[] = "tcmalloc";
113 const char kTermsPath[] = "terms"; 113 const char kTermsPath[] = "terms";
114 const char kVersionPath[] = "version"; 114 const char kVersionPath[] = "version";
115 const char kAboutPath[] = "about"; 115 const char kAboutPath[] = "about";
116 // Not about:* pages, but included to make about:about look nicer 116 // Not about:* pages, but included to make about:about look nicer
(...skipping 10 matching lines...) Expand all
127 const char kOSCreditsPath[] = "os-credits"; 127 const char kOSCreditsPath[] = "os-credits";
128 #endif 128 #endif
129 129
130 // Add path here to be included in about:about 130 // Add path here to be included in about:about
131 const char *kAllAboutPaths[] = { 131 const char *kAllAboutPaths[] = {
132 kAppCacheInternalsPath, 132 kAppCacheInternalsPath,
133 kBlobInternalsPath, 133 kBlobInternalsPath,
134 kCachePath, 134 kCachePath,
135 kCreditsPath, 135 kCreditsPath,
136 kDnsPath, 136 kDnsPath,
137 kFlagsPath,
137 kGpuPath, 138 kGpuPath,
138 kHistogramsPath, 139 kHistogramsPath,
139 kLabsPath,
140 kMemoryPath, 140 kMemoryPath,
141 kNetInternalsPath, 141 kNetInternalsPath,
142 kPluginsPath, 142 kPluginsPath,
143 kStatsPath, 143 kStatsPath,
144 kSyncPath, 144 kSyncPath,
145 kTasksPath, 145 kTasksPath,
146 kTcmallocPath, 146 kTcmallocPath,
147 kTermsPath, 147 kTermsPath,
148 kVersionPath, 148 kVersionPath,
149 #if defined(OS_LINUX) 149 #if defined(OS_LINUX)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 }; 252 };
253 #endif 253 #endif
254 254
255 // Individual about handlers --------------------------------------------------- 255 // Individual about handlers ---------------------------------------------------
256 256
257 std::string AboutAbout() { 257 std::string AboutAbout() {
258 std::string html; 258 std::string html;
259 html.append("<html><head><title>About Pages</title></head><body>\n"); 259 html.append("<html><head><title>About Pages</title></head><body>\n");
260 html.append("<h2>List of About pages</h2><ul>\n"); 260 html.append("<h2>List of About pages</h2><ul>\n");
261 for (size_t i = 0; i < arraysize(kAllAboutPaths); i++) { 261 for (size_t i = 0; i < arraysize(kAllAboutPaths); i++) {
262 if (kAllAboutPaths[i] == kLabsPath && !about_labs::IsEnabled()) 262 if (kAllAboutPaths[i] == kFlagsPath && !about_labs::IsEnabled())
263 continue; 263 continue;
264 if (kAllAboutPaths[i] == kAppCacheInternalsPath || 264 if (kAllAboutPaths[i] == kAppCacheInternalsPath ||
265 kAllAboutPaths[i] == kBlobInternalsPath || 265 kAllAboutPaths[i] == kBlobInternalsPath ||
266 kAllAboutPaths[i] == kCachePath || 266 kAllAboutPaths[i] == kCachePath ||
267 kAllAboutPaths[i] == kLabsPath || 267 kAllAboutPaths[i] == kFlagsPath ||
268 kAllAboutPaths[i] == kNetInternalsPath || 268 kAllAboutPaths[i] == kNetInternalsPath ||
269 kAllAboutPaths[i] == kPluginsPath) { 269 kAllAboutPaths[i] == kPluginsPath) {
270 html.append("<li><a href='chrome://"); 270 html.append("<li><a href='chrome://");
271 } else { 271 } else {
272 html.append("<li><a href='chrome://about/"); 272 html.append("<li><a href='chrome://about/");
273 } 273 }
274 html.append(kAllAboutPaths[i]); 274 html.append(kAllAboutPaths[i]);
275 html.append("/'>about:"); 275 html.append("/'>about:");
276 html.append(kAllAboutPaths[i]); 276 html.append(kAllAboutPaths[i]);
277 html.append("</a>\n"); 277 html.append("</a>\n");
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 return false; 1173 return false;
1174 1174
1175 // Rewrite about:cache/* URLs to chrome://view-http-cache/* 1175 // Rewrite about:cache/* URLs to chrome://view-http-cache/*
1176 if (StartsWithAboutSpecifier(*url, chrome::kAboutCacheURL)) { 1176 if (StartsWithAboutSpecifier(*url, chrome::kAboutCacheURL)) {
1177 *url = RemapAboutURL(chrome::kNetworkViewCacheURL, *url); 1177 *url = RemapAboutURL(chrome::kNetworkViewCacheURL, *url);
1178 return true; 1178 return true;
1179 } 1179 }
1180 1180
1181 if (about_labs::IsEnabled()) { 1181 if (about_labs::IsEnabled()) {
1182 // Rewrite about:labs and about:vaporware to chrome://labs/. 1182 // Rewrite about:labs and about:vaporware to chrome://labs/.
1183 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutLabsURL) || 1183 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutFlagsURL) ||
1184 LowerCaseEqualsASCII(url->spec(), chrome::kAboutVaporwareURL)) { 1184 LowerCaseEqualsASCII(url->spec(), chrome::kAboutVaporwareURL)) {
1185 *url = GURL(chrome::kChromeUILabsURL); 1185 *url = GURL(chrome::kChromeUIFlagsURL);
1186 return true; 1186 return true;
1187 } 1187 }
1188 } 1188 }
1189 1189
1190 // Rewrite about:net-internals/* URLs to chrome://net-internals/* 1190 // Rewrite about:net-internals/* URLs to chrome://net-internals/*
1191 if (StartsWithAboutSpecifier(*url, chrome::kAboutNetInternalsURL)) { 1191 if (StartsWithAboutSpecifier(*url, chrome::kAboutNetInternalsURL)) {
1192 *url = RemapAboutURL(chrome::kNetworkViewInternalsURL, *url); 1192 *url = RemapAboutURL(chrome::kNetworkViewInternalsURL, *url);
1193 return true; 1193 return true;
1194 } 1194 }
1195 1195
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 // Run the dialog. This will re-use the existing one if it's already up. 1264 // Run the dialog. This will re-use the existing one if it's already up.
1265 AboutIPCDialog::RunDialog(); 1265 AboutIPCDialog::RunDialog();
1266 return true; 1266 return true;
1267 } 1267 }
1268 #endif 1268 #endif
1269 1269
1270 #endif // OFFICIAL_BUILD 1270 #endif // OFFICIAL_BUILD
1271 1271
1272 return false; 1272 return false;
1273 } 1273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698