| 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 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "grit/chromium_strings.h" | 57 #include "grit/chromium_strings.h" |
| 58 #include "grit/generated_resources.h" | 58 #include "grit/generated_resources.h" |
| 59 #include "grit/locale_settings.h" | 59 #include "grit/locale_settings.h" |
| 60 #include "webkit/glue/webkit_glue.h" | 60 #include "webkit/glue/webkit_glue.h" |
| 61 #include "net/base/escape.h" | 61 #include "net/base/escape.h" |
| 62 #ifdef CHROME_V8 | 62 #ifdef CHROME_V8 |
| 63 #include "v8/include/v8.h" | 63 #include "v8/include/v8.h" |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 #if defined(OS_WIN) | 66 #if defined(OS_WIN) |
| 67 #include "chrome/browser/enumerate_modules_model_win.h" |
| 67 #include "chrome/browser/views/about_ipc_dialog.h" | 68 #include "chrome/browser/views/about_ipc_dialog.h" |
| 68 #elif defined(OS_CHROMEOS) | 69 #elif defined(OS_CHROMEOS) |
| 69 #include "chrome/browser/chromeos/cros/cros_library.h" | 70 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 70 #include "chrome/browser/chromeos/cros/network_library.h" | 71 #include "chrome/browser/chromeos/cros/network_library.h" |
| 71 #include "chrome/browser/chromeos/cros/syslogs_library.h" | 72 #include "chrome/browser/chromeos/cros/syslogs_library.h" |
| 72 #include "chrome/browser/chromeos/version_loader.h" | 73 #include "chrome/browser/chromeos/version_loader.h" |
| 73 #include "chrome/browser/zygote_host_linux.h" | 74 #include "chrome/browser/zygote_host_linux.h" |
| 74 #elif defined(OS_MACOSX) | 75 #elif defined(OS_MACOSX) |
| 75 #include "chrome/browser/cocoa/about_ipc_dialog.h" | 76 #include "chrome/browser/cocoa/about_ipc_dialog.h" |
| 76 #elif defined(OS_LINUX) | 77 #elif defined(OS_LINUX) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 94 #endif | 95 #endif |
| 95 | 96 |
| 96 namespace { | 97 namespace { |
| 97 | 98 |
| 98 // The (alphabetized) paths used for the about pages. | 99 // The (alphabetized) paths used for the about pages. |
| 99 // Note: Keep these in sync with url_constants.h | 100 // Note: Keep these in sync with url_constants.h |
| 100 const char kAppCacheInternalsPath[] = "appcache-internals"; | 101 const char kAppCacheInternalsPath[] = "appcache-internals"; |
| 101 const char kBlobInternalsPath[] = "blob-internals"; | 102 const char kBlobInternalsPath[] = "blob-internals"; |
| 102 const char kCreditsPath[] = "credits"; | 103 const char kCreditsPath[] = "credits"; |
| 103 const char kCachePath[] = "view-http-cache"; | 104 const char kCachePath[] = "view-http-cache"; |
| 105 #if defined(OS_WIN) |
| 106 const char kConflictsPath[] = "conflicts"; |
| 107 #endif |
| 104 const char kDnsPath[] = "dns"; | 108 const char kDnsPath[] = "dns"; |
| 105 const char kFlagsPath[] = "flags"; | 109 const char kFlagsPath[] = "flags"; |
| 106 const char kGpuPath[] = "gpu"; | 110 const char kGpuPath[] = "gpu"; |
| 107 const char kHistogramsPath[] = "histograms"; | 111 const char kHistogramsPath[] = "histograms"; |
| 108 const char kMemoryRedirectPath[] = "memory-redirect"; | 112 const char kMemoryRedirectPath[] = "memory-redirect"; |
| 109 const char kMemoryPath[] = "memory"; | 113 const char kMemoryPath[] = "memory"; |
| 110 const char kStatsPath[] = "stats"; | 114 const char kStatsPath[] = "stats"; |
| 111 const char kSyncPath[] = "sync"; | 115 const char kSyncPath[] = "sync"; |
| 112 const char kTasksPath[] = "tasks"; | 116 const char kTasksPath[] = "tasks"; |
| 113 const char kTcmallocPath[] = "tcmalloc"; | 117 const char kTcmallocPath[] = "tcmalloc"; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 127 const char kNetworkPath[] = "network"; | 131 const char kNetworkPath[] = "network"; |
| 128 const char kOSCreditsPath[] = "os-credits"; | 132 const char kOSCreditsPath[] = "os-credits"; |
| 129 #endif | 133 #endif |
| 130 | 134 |
| 131 // Add path here to be included in about:about | 135 // Add path here to be included in about:about |
| 132 const char *kAllAboutPaths[] = { | 136 const char *kAllAboutPaths[] = { |
| 133 kAppCacheInternalsPath, | 137 kAppCacheInternalsPath, |
| 134 kBlobInternalsPath, | 138 kBlobInternalsPath, |
| 135 kCachePath, | 139 kCachePath, |
| 136 kCreditsPath, | 140 kCreditsPath, |
| 141 #if defined(OS_WIN) |
| 142 kConflictsPath, |
| 143 #endif |
| 137 kDnsPath, | 144 kDnsPath, |
| 138 kFlagsPath, | 145 kFlagsPath, |
| 139 kGpuPath, | 146 kGpuPath, |
| 140 kHistogramsPath, | 147 kHistogramsPath, |
| 141 kMemoryPath, | 148 kMemoryPath, |
| 142 kNetInternalsPath, | 149 kNetInternalsPath, |
| 143 kPluginsPath, | 150 kPluginsPath, |
| 144 kStatsPath, | 151 kStatsPath, |
| 145 kSyncPath, | 152 kSyncPath, |
| 146 kTasksPath, | 153 kTasksPath, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // Individual about handlers --------------------------------------------------- | 263 // Individual about handlers --------------------------------------------------- |
| 257 | 264 |
| 258 std::string AboutAbout() { | 265 std::string AboutAbout() { |
| 259 std::string html; | 266 std::string html; |
| 260 html.append("<html><head><title>About Pages</title></head><body>\n"); | 267 html.append("<html><head><title>About Pages</title></head><body>\n"); |
| 261 html.append("<h2>List of About pages</h2><ul>\n"); | 268 html.append("<h2>List of About pages</h2><ul>\n"); |
| 262 for (size_t i = 0; i < arraysize(kAllAboutPaths); i++) { | 269 for (size_t i = 0; i < arraysize(kAllAboutPaths); i++) { |
| 263 if (kAllAboutPaths[i] == kAppCacheInternalsPath || | 270 if (kAllAboutPaths[i] == kAppCacheInternalsPath || |
| 264 kAllAboutPaths[i] == kBlobInternalsPath || | 271 kAllAboutPaths[i] == kBlobInternalsPath || |
| 265 kAllAboutPaths[i] == kCachePath || | 272 kAllAboutPaths[i] == kCachePath || |
| 273 #if defined(OS_WIN) |
| 274 kAllAboutPaths[i] == kConflictsPath || |
| 275 #endif |
| 266 kAllAboutPaths[i] == kFlagsPath || | 276 kAllAboutPaths[i] == kFlagsPath || |
| 267 kAllAboutPaths[i] == kNetInternalsPath || | 277 kAllAboutPaths[i] == kNetInternalsPath || |
| 268 kAllAboutPaths[i] == kPluginsPath) { | 278 kAllAboutPaths[i] == kPluginsPath) { |
| 269 html.append("<li><a href='chrome://"); | 279 html.append("<li><a href='chrome://"); |
| 270 } else { | 280 } else { |
| 271 html.append("<li><a href='chrome://about/"); | 281 html.append("<li><a href='chrome://about/"); |
| 272 } | 282 } |
| 273 html.append(kAllAboutPaths[i]); | 283 html.append(kAllAboutPaths[i]); |
| 274 html.append("/'>about:"); | 284 html.append("/'>about:"); |
| 275 html.append(kAllAboutPaths[i]); | 285 html.append(kAllAboutPaths[i]); |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 // Just ignore the about:blank and let the TAB_CONTENTS_WEB handle it. | 1088 // Just ignore the about:blank and let the TAB_CONTENTS_WEB handle it. |
| 1079 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutBlankURL)) | 1089 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutBlankURL)) |
| 1080 return false; | 1090 return false; |
| 1081 | 1091 |
| 1082 // Rewrite about:cache/* URLs to chrome://view-http-cache/* | 1092 // Rewrite about:cache/* URLs to chrome://view-http-cache/* |
| 1083 if (StartsWithAboutSpecifier(*url, chrome::kAboutCacheURL)) { | 1093 if (StartsWithAboutSpecifier(*url, chrome::kAboutCacheURL)) { |
| 1084 *url = RemapAboutURL(chrome::kNetworkViewCacheURL, *url); | 1094 *url = RemapAboutURL(chrome::kNetworkViewCacheURL, *url); |
| 1085 return true; | 1095 return true; |
| 1086 } | 1096 } |
| 1087 | 1097 |
| 1098 #if defined(OS_WIN) |
| 1099 // Rewrite about:conflicts/* URLs to chrome://conflicts/* |
| 1100 if (StartsWithAboutSpecifier(*url, chrome::kAboutConflicts)) { |
| 1101 *url = GURL(chrome::kChromeUIConflictsURL); |
| 1102 return true; |
| 1103 } |
| 1104 #endif |
| 1105 |
| 1088 // Rewrite about:flags and about:vaporware to chrome://flags/. | 1106 // Rewrite about:flags and about:vaporware to chrome://flags/. |
| 1089 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutFlagsURL) || | 1107 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutFlagsURL) || |
| 1090 LowerCaseEqualsASCII(url->spec(), chrome::kAboutVaporwareURL)) { | 1108 LowerCaseEqualsASCII(url->spec(), chrome::kAboutVaporwareURL)) { |
| 1091 *url = GURL(chrome::kChromeUIFlagsURL); | 1109 *url = GURL(chrome::kChromeUIFlagsURL); |
| 1092 return true; | 1110 return true; |
| 1093 } | 1111 } |
| 1094 | 1112 |
| 1095 // Rewrite about:net-internals/* URLs to chrome://net-internals/* | 1113 // Rewrite about:net-internals/* URLs to chrome://net-internals/* |
| 1096 if (StartsWithAboutSpecifier(*url, chrome::kAboutNetInternalsURL)) { | 1114 if (StartsWithAboutSpecifier(*url, chrome::kAboutNetInternalsURL)) { |
| 1097 *url = RemapAboutURL(chrome::kNetworkViewInternalsURL, *url); | 1115 *url = RemapAboutURL(chrome::kNetworkViewInternalsURL, *url); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 // Run the dialog. This will re-use the existing one if it's already up. | 1187 // Run the dialog. This will re-use the existing one if it's already up. |
| 1170 AboutIPCDialog::RunDialog(); | 1188 AboutIPCDialog::RunDialog(); |
| 1171 return true; | 1189 return true; |
| 1172 } | 1190 } |
| 1173 #endif | 1191 #endif |
| 1174 | 1192 |
| 1175 #endif // OFFICIAL_BUILD | 1193 #endif // OFFICIAL_BUILD |
| 1176 | 1194 |
| 1177 return false; | 1195 return false; |
| 1178 } | 1196 } |
| OLD | NEW |