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

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

Issue 3152055: Implement about:labs (Closed)
Patch Set: chromeos fix Created 10 years, 3 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
« no previous file with comments | « chrome/browser/app_controller_mac.mm ('k') | chrome/browser/browser_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
22 #include "base/string_piece.h" 22 #include "base/string_piece.h"
23 #include "base/string_util.h" 23 #include "base/string_util.h"
24 #include "base/thread.h" 24 #include "base/thread.h"
25 #include "base/tracked_objects.h" 25 #include "base/tracked_objects.h"
26 #include "base/utf_string_conversions.h" 26 #include "base/utf_string_conversions.h"
27 #include "chrome/browser/browser.h" 27 #include "chrome/browser/browser.h"
28 #include "chrome/browser/browser_process.h" 28 #include "chrome/browser/browser_process.h"
29 #include "chrome/browser/chrome_thread.h" 29 #include "chrome/browser/chrome_thread.h"
30 #include "chrome/browser/defaults.h" 30 #include "chrome/browser/defaults.h"
31 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 31 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
32 #include "chrome/browser/labs.h"
32 #include "chrome/browser/memory_details.h" 33 #include "chrome/browser/memory_details.h"
33 #include "chrome/browser/metrics/histogram_synchronizer.h" 34 #include "chrome/browser/metrics/histogram_synchronizer.h"
34 #include "chrome/browser/net/predictor_api.h" 35 #include "chrome/browser/net/predictor_api.h"
35 #include "chrome/browser/platform_util.h" 36 #include "chrome/browser/platform_util.h"
36 #include "chrome/browser/prefs/pref_service.h" 37 #include "chrome/browser/prefs/pref_service.h"
37 #include "chrome/browser/profile.h" 38 #include "chrome/browser/profile.h"
38 #include "chrome/browser/profile_manager.h" 39 #include "chrome/browser/profile_manager.h"
39 #include "chrome/browser/renderer_host/render_process_host.h" 40 #include "chrome/browser/renderer_host/render_process_host.h"
40 #include "chrome/browser/renderer_host/render_view_host.h" 41 #include "chrome/browser/renderer_host/render_view_host.h"
41 #include "chrome/browser/sync/profile_sync_service.h" 42 #include "chrome/browser/sync/profile_sync_service.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 90
90 namespace { 91 namespace {
91 92
92 // The (alphabetized) paths used for the about pages. 93 // The (alphabetized) paths used for the about pages.
93 // Note: Keep these in sync with url_constants.h 94 // Note: Keep these in sync with url_constants.h
94 const char kAppCacheInternalsPath[] = "appcache-internals"; 95 const char kAppCacheInternalsPath[] = "appcache-internals";
95 const char kCreditsPath[] = "credits"; 96 const char kCreditsPath[] = "credits";
96 const char kCachePath[] = "view-http-cache"; 97 const char kCachePath[] = "view-http-cache";
97 const char kDnsPath[] = "dns"; 98 const char kDnsPath[] = "dns";
98 const char kHistogramsPath[] = "histograms"; 99 const char kHistogramsPath[] = "histograms";
100 const char kLabsPath[] = "labs";
99 const char kMemoryRedirectPath[] = "memory-redirect"; 101 const char kMemoryRedirectPath[] = "memory-redirect";
100 const char kMemoryPath[] = "memory"; 102 const char kMemoryPath[] = "memory";
101 const char kStatsPath[] = "stats"; 103 const char kStatsPath[] = "stats";
102 const char kSyncPath[] = "sync"; 104 const char kSyncPath[] = "sync";
103 const char kTasksPath[] = "tasks"; 105 const char kTasksPath[] = "tasks";
104 const char kTcmallocPath[] = "tcmalloc"; 106 const char kTcmallocPath[] = "tcmalloc";
105 const char kTermsPath[] = "terms"; 107 const char kTermsPath[] = "terms";
106 const char kVersionPath[] = "version"; 108 const char kVersionPath[] = "version";
107 const char kAboutPath[] = "about"; 109 const char kAboutPath[] = "about";
108 // Not about:* pages, but included to make about:about look nicer 110 // Not about:* pages, but included to make about:about look nicer
(...skipping 11 matching lines...) Expand all
120 const char kSysPath[] = "system"; 122 const char kSysPath[] = "system";
121 #endif 123 #endif
122 124
123 // Add path here to be included in about:about 125 // Add path here to be included in about:about
124 const char *kAllAboutPaths[] = { 126 const char *kAllAboutPaths[] = {
125 kAppCacheInternalsPath, 127 kAppCacheInternalsPath,
126 kCachePath, 128 kCachePath,
127 kCreditsPath, 129 kCreditsPath,
128 kDnsPath, 130 kDnsPath,
129 kHistogramsPath, 131 kHistogramsPath,
132 kLabsPath,
130 kMemoryPath, 133 kMemoryPath,
131 kNetInternalsPath, 134 kNetInternalsPath,
132 kPluginsPath, 135 kPluginsPath,
133 kStatsPath, 136 kStatsPath,
134 kSyncPath, 137 kSyncPath,
135 kTasksPath, 138 kTasksPath,
136 kTcmallocPath, 139 kTcmallocPath,
137 kTermsPath, 140 kTermsPath,
138 kVersionPath, 141 kVersionPath,
139 #if defined(OS_LINUX) 142 #if defined(OS_LINUX)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 }; 246 };
244 #endif 247 #endif
245 248
246 // Individual about handlers --------------------------------------------------- 249 // Individual about handlers ---------------------------------------------------
247 250
248 std::string AboutAbout() { 251 std::string AboutAbout() {
249 std::string html; 252 std::string html;
250 html.append("<html><head><title>About Pages</title></head><body>\n"); 253 html.append("<html><head><title>About Pages</title></head><body>\n");
251 html.append("<h2>List of About pages</h2><ul>\n"); 254 html.append("<h2>List of About pages</h2><ul>\n");
252 for (size_t i = 0; i < arraysize(kAllAboutPaths); i++) { 255 for (size_t i = 0; i < arraysize(kAllAboutPaths); i++) {
253 if (kAllAboutPaths[i] == kNetInternalsPath || 256 if (kAllAboutPaths[i] == kLabsPath && !about_labs::IsEnabled())
254 kAllAboutPaths[i] == kPluginsPath || 257 continue;
258 if (kAllAboutPaths[i] == kAppCacheInternalsPath ||
255 kAllAboutPaths[i] == kCachePath || 259 kAllAboutPaths[i] == kCachePath ||
256 kAllAboutPaths[i] == kAppCacheInternalsPath) 260 kAllAboutPaths[i] == kLabsPath ||
261 kAllAboutPaths[i] == kNetInternalsPath ||
262 kAllAboutPaths[i] == kPluginsPath) {
257 html.append("<li><a href='chrome://"); 263 html.append("<li><a href='chrome://");
258 else 264 } else {
259 html.append("<li><a href='chrome://about/"); 265 html.append("<li><a href='chrome://about/");
266 }
260 html.append(kAllAboutPaths[i]); 267 html.append(kAllAboutPaths[i]);
261 html.append("/'>about:"); 268 html.append("/'>about:");
262 html.append(kAllAboutPaths[i]); 269 html.append(kAllAboutPaths[i]);
263 html.append("</a>\n"); 270 html.append("</a>\n");
264 } 271 }
265 const char *debug[] = { "crash", "hang", "shorthang" }; 272 const char *debug[] = { "crash", "hang", "shorthang" };
266 html.append("</ul><h2>For Debug</h2>"); 273 html.append("</ul><h2>For Debug</h2>");
267 html.append("</ul><p>The following pages are for debugging purposes only. " 274 html.append("</ul><p>The following pages are for debugging purposes only. "
268 "Because they crash or hang the renderer, they're not linked " 275 "Because they crash or hang the renderer, they're not linked "
269 "directly; you can type them into the address bar if you need " 276 "directly; you can type them into the address bar if you need "
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 // Just ignore the about:blank and let the TAB_CONTENTS_WEB handle it. 1125 // Just ignore the about:blank and let the TAB_CONTENTS_WEB handle it.
1119 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutBlankURL)) 1126 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutBlankURL))
1120 return false; 1127 return false;
1121 1128
1122 // Rewrite about:cache/* URLs to chrome://view-http-cache/* 1129 // Rewrite about:cache/* URLs to chrome://view-http-cache/*
1123 if (StartsWithAboutSpecifier(*url, chrome::kAboutCacheURL)) { 1130 if (StartsWithAboutSpecifier(*url, chrome::kAboutCacheURL)) {
1124 *url = RemapAboutURL(chrome::kNetworkViewCacheURL, *url); 1131 *url = RemapAboutURL(chrome::kNetworkViewCacheURL, *url);
1125 return true; 1132 return true;
1126 } 1133 }
1127 1134
1135 if (about_labs::IsEnabled()) {
1136 // Rewrite about:labs and about:vaporware to chrome://labs/.
1137 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutLabsURL) ||
1138 LowerCaseEqualsASCII(url->spec(), chrome::kAboutVaporwareURL)) {
1139 *url = GURL(chrome::kChromeUILabsURL);
1140 return true;
1141 }
1142 }
1143
1128 // Rewrite about:net-internals/* URLs to chrome://net-internals/* 1144 // Rewrite about:net-internals/* URLs to chrome://net-internals/*
1129 if (StartsWithAboutSpecifier(*url, chrome::kAboutNetInternalsURL)) { 1145 if (StartsWithAboutSpecifier(*url, chrome::kAboutNetInternalsURL)) {
1130 *url = RemapAboutURL(chrome::kNetworkViewInternalsURL, *url); 1146 *url = RemapAboutURL(chrome::kNetworkViewInternalsURL, *url);
1131 return true; 1147 return true;
1132 } 1148 }
1133 1149
1134 // Rewrite about:appcache-internals/* URLs to chrome://appcache/* 1150 // Rewrite about:appcache-internals/* URLs to chrome://appcache/*
1135 if (StartsWithAboutSpecifier(*url, chrome::kAboutAppCacheInternalsURL)) { 1151 if (StartsWithAboutSpecifier(*url, chrome::kAboutAppCacheInternalsURL)) {
1136 *url = RemapAboutURL(chrome::kAppCacheViewInternalsURL, *url); 1152 *url = RemapAboutURL(chrome::kAppCacheViewInternalsURL, *url);
1137 return true; 1153 return true;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 // Run the dialog. This will re-use the existing one if it's already up. 1208 // Run the dialog. This will re-use the existing one if it's already up.
1193 AboutIPCDialog::RunDialog(); 1209 AboutIPCDialog::RunDialog();
1194 return true; 1210 return true;
1195 } 1211 }
1196 #endif 1212 #endif
1197 1213
1198 #endif // OFFICIAL_BUILD 1214 #endif // OFFICIAL_BUILD
1199 1215
1200 return false; 1216 return false;
1201 } 1217 }
OLDNEW
« no previous file with comments | « chrome/browser/app_controller_mac.mm ('k') | chrome/browser/browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698