| OLD | NEW |
| 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 |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/i18n/number_formatting.h" | 15 #include "base/i18n/number_formatting.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/metrics/stats_table.h" | 17 #include "base/metrics/stats_table.h" |
| 18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
| 19 #include "base/platform_thread.h" | 19 #include "base/platform_thread.h" |
| 20 #include "base/stringprintf.h" | 20 #include "base/stringprintf.h" |
| 21 #include "base/string_number_conversions.h" | 21 #include "base/string_number_conversions.h" |
| 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/about_flags.h" |
| 27 #include "chrome/browser/browser.h" | 28 #include "chrome/browser/browser.h" |
| 28 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 29 #include "chrome/browser/browser_thread.h" | 30 #include "chrome/browser/browser_thread.h" |
| 30 #include "chrome/browser/defaults.h" | 31 #include "chrome/browser/defaults.h" |
| 31 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 32 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 32 #include "chrome/browser/gpu_process_host.h" | 33 #include "chrome/browser/gpu_process_host.h" |
| 33 #include "chrome/browser/gpu_process_host_ui_shim.h" | 34 #include "chrome/browser/gpu_process_host_ui_shim.h" |
| 34 #include "chrome/browser/labs.h" | |
| 35 #include "chrome/browser/memory_details.h" | 35 #include "chrome/browser/memory_details.h" |
| 36 #include "chrome/browser/metrics/histogram_synchronizer.h" | 36 #include "chrome/browser/metrics/histogram_synchronizer.h" |
| 37 #include "chrome/browser/net/predictor_api.h" | 37 #include "chrome/browser/net/predictor_api.h" |
| 38 #include "chrome/browser/platform_util.h" | 38 #include "chrome/browser/platform_util.h" |
| 39 #include "chrome/browser/prefs/pref_service.h" | 39 #include "chrome/browser/prefs/pref_service.h" |
| 40 #include "chrome/browser/profile.h" | 40 #include "chrome/browser/profile.h" |
| 41 #include "chrome/browser/profile_manager.h" | 41 #include "chrome/browser/profile_manager.h" |
| 42 #include "chrome/browser/renderer_host/render_process_host.h" | 42 #include "chrome/browser/renderer_host/render_process_host.h" |
| 43 #include "chrome/browser/renderer_host/render_view_host.h" | 43 #include "chrome/browser/renderer_host/render_view_host.h" |
| 44 #include "chrome/browser/sync/profile_sync_service.h" | 44 #include "chrome/browser/sync/profile_sync_service.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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] == kFlagsPath && !about_labs::IsEnabled()) | 262 if (kAllAboutPaths[i] == kFlagsPath && !about_flags::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] == kFlagsPath || | 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/"); |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 // Just ignore the about:blank and let the TAB_CONTENTS_WEB handle it. | 1171 // Just ignore the about:blank and let the TAB_CONTENTS_WEB handle it. |
| 1172 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutBlankURL)) | 1172 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutBlankURL)) |
| 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_flags::IsEnabled()) { |
| 1182 // Rewrite about:labs and about:vaporware to chrome://labs/. | 1182 // Rewrite about:flags and about:vaporware to chrome://flags/. |
| 1183 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutFlagsURL) || | 1183 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutFlagsURL) || |
| 1184 LowerCaseEqualsASCII(url->spec(), chrome::kAboutVaporwareURL)) { | 1184 LowerCaseEqualsASCII(url->spec(), chrome::kAboutVaporwareURL)) { |
| 1185 *url = GURL(chrome::kChromeUIFlagsURL); | 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); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |