OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // This is the top-level URL handler for chrome-internal: URLs, and exposed in | 155 // This is the top-level URL handler for chrome-internal: URLs, and exposed in |
156 // our header file. | 156 // our header file. |
157 bool BrowserAboutHandler::MaybeHandle(GURL* url, | 157 bool BrowserAboutHandler::MaybeHandle(GURL* url, |
158 TabContentsType* result_type) { | 158 TabContentsType* result_type) { |
159 if (!url->SchemeIs(kAboutScheme)) | 159 if (!url->SchemeIs(kAboutScheme)) |
160 return false; | 160 return false; |
161 | 161 |
162 // about:blank is special. Frames are allowed to access about:blank, | 162 // about:blank is special. Frames are allowed to access about:blank, |
163 // but they are not allowed to access other types of about pages. | 163 // but they are not allowed to access other types of about pages. |
164 // Just ignore the about:blank and let the TAB_CONTENTS_WEB handle it. | 164 // Just ignore the about:blank and let the TAB_CONTENTS_WEB handle it. |
165 if (StringToLowerASCII(url->path()) == "blank") { | 165 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutBlankURL)) { |
166 return false; | 166 return false; |
167 } | 167 } |
168 | 168 |
169 // We create an about:cache mapping to the view-cache: internal URL. | 169 // We create an about:cache mapping to the view-cache: internal URL. |
170 if (StringToLowerASCII(url->path()) == kCachePath) { | 170 if (StringToLowerASCII(url->path()) == kCachePath) { |
171 *url = GURL("view-cache:"); | 171 *url = GURL("view-cache:"); |
172 *result_type = TAB_CONTENTS_WEB; | 172 *result_type = TAB_CONTENTS_WEB; |
173 return true; | 173 return true; |
174 } | 174 } |
175 | 175 |
176 if (LowerCaseEqualsASCII(url->path(), "network")) { | 176 if (LowerCaseEqualsASCII(url->path(), "network")) { |
177 #if defined(OS_WIN) | 177 #if defined(OS_WIN) |
178 // Run the dialog. This will re-use the existing one if it's already up. | 178 // Run the dialog. This will re-use the existing one if it's already up. |
179 AboutNetworkDialog::RunDialog(); | 179 AboutNetworkDialog::RunDialog(); |
180 #else | 180 #else |
181 NOTIMPLEMENTED(); | 181 NOTIMPLEMENTED(); |
182 // TODO(port) Implement this. | 182 // TODO(port) Implement this. |
183 #endif | 183 #endif |
184 | 184 |
185 // Navigate the renderer to about:blank. This is kind of stupid but is the | 185 // Navigate the renderer to about:blank. This is kind of stupid but is the |
186 // easiest thing to do in this situation without adding a lot of complexity | 186 // easiest thing to do in this situation without adding a lot of complexity |
187 // for this developer-only feature. | 187 // for this developer-only feature. |
188 *url = GURL("about:blank"); | 188 *url = GURL(chrome::kAboutBlankURL); |
189 return false; | 189 return false; |
190 } | 190 } |
191 | 191 |
192 #ifdef IPC_MESSAGE_LOG_ENABLED | 192 #ifdef IPC_MESSAGE_LOG_ENABLED |
193 if (LowerCaseEqualsASCII(url->path(), "ipc")) { | 193 if (LowerCaseEqualsASCII(url->path(), "ipc")) { |
194 #if defined(OS_WIN) | 194 #if defined(OS_WIN) |
195 // Run the dialog. This will re-use the existing one if it's already up. | 195 // Run the dialog. This will re-use the existing one if it's already up. |
196 AboutIPCDialog::RunDialog(); | 196 AboutIPCDialog::RunDialog(); |
197 #else | 197 #else |
198 NOTIMPLEMENTED(); | 198 NOTIMPLEMENTED(); |
199 // TODO(port) Implement this. | 199 // TODO(port) Implement this. |
200 #endif | 200 #endif |
201 *url = GURL("about:blank"); | 201 *url = GURL(chrome::kAboutBlankURL); |
202 return false; | 202 return false; |
203 } | 203 } |
204 #endif | 204 #endif |
205 | 205 |
206 // There are a few about URLs that we hand over to the renderer. | 206 // There are a few about URLs that we hand over to the renderer. |
207 // If the renderer wants them, let it have them. | 207 // If the renderer wants them, let it have them. |
208 if (AboutHandler::WillHandle(*url)) | 208 if (AboutHandler::WillHandle(*url)) |
209 return false; | 209 return false; |
210 | 210 |
211 *result_type = TAB_CONTENTS_ABOUT_UI; | 211 *result_type = TAB_CONTENTS_ABOUT_UI; |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 | 615 |
616 AboutSource* about_source = static_cast<AboutSource*>(source_); | 616 AboutSource* about_source = static_cast<AboutSource*>(source_); |
617 about_source->FinishDataRequest(template_html, request_id_); | 617 about_source->FinishDataRequest(template_html, request_id_); |
618 } | 618 } |
619 | 619 |
620 // static | 620 // static |
621 void BrowserAboutHandler::AboutMemory(AboutSource* source, int request_id) { | 621 void BrowserAboutHandler::AboutMemory(AboutSource* source, int request_id) { |
622 // The AboutMemoryHandler cleans itself up. | 622 // The AboutMemoryHandler cleans itself up. |
623 new AboutMemoryHandler(source, request_id); | 623 new AboutMemoryHandler(source, request_id); |
624 } | 624 } |
OLD | NEW |