OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/chrome_web_ui_controller_factory.h" | 5 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 Profile* profile, | 218 Profile* profile, |
219 const GURL& url) { | 219 const GURL& url) { |
220 #if defined(ENABLE_EXTENSIONS) | 220 #if defined(ENABLE_EXTENSIONS) |
221 if (NeedsExtensionWebUI(profile, url)) | 221 if (NeedsExtensionWebUI(profile, url)) |
222 return &NewWebUI<ExtensionWebUI>; | 222 return &NewWebUI<ExtensionWebUI>; |
223 #endif | 223 #endif |
224 | 224 |
225 // This will get called a lot to check all URLs, so do a quick check of other | 225 // This will get called a lot to check all URLs, so do a quick check of other |
226 // schemes to filter out most URLs. | 226 // schemes to filter out most URLs. |
227 if (!url.SchemeIs(chrome::kChromeDevToolsScheme) && | 227 if (!url.SchemeIs(chrome::kChromeDevToolsScheme) && |
228 !url.SchemeIs(chrome::kChromeInternalScheme) && | |
229 !url.SchemeIs(chrome::kChromeUIScheme)) { | 228 !url.SchemeIs(chrome::kChromeUIScheme)) { |
230 return NULL; | 229 return NULL; |
231 } | 230 } |
232 | 231 |
233 // Special case the new tab page. In older versions of Chrome, the new tab | |
234 // page was hosted at chrome-internal:<blah>. This might be in people's saved | |
235 // sessions or bookmarks, so we say any URL with that scheme triggers the new | |
236 // tab page. | |
237 if (url.host() == chrome::kChromeUINewTabHost || | |
238 url.SchemeIs(chrome::kChromeInternalScheme)) { | |
239 return &NewWebUI<NewTabUI>; | |
240 } | |
241 | |
242 /**************************************************************************** | 232 /**************************************************************************** |
243 * Please keep this in alphabetical order. If #ifs or special logics are | 233 * Please keep this in alphabetical order. If #ifs or special logics are |
244 * required, add it below in the appropriate section. | 234 * required, add it below in the appropriate section. |
245 ***************************************************************************/ | 235 ***************************************************************************/ |
246 // We must compare hosts only since some of the Web UIs append extra stuff | 236 // We must compare hosts only since some of the Web UIs append extra stuff |
247 // after the host name. | 237 // after the host name. |
248 // All platform builds of Chrome will need to have a cloud printing | 238 // All platform builds of Chrome will need to have a cloud printing |
249 // dialog as backup. It's just that on Chrome OS, it's the only | 239 // dialog as backup. It's just that on Chrome OS, it's the only |
250 // print dialog. | 240 // print dialog. |
251 if (url.host() == chrome::kChromeUICloudPrintResourcesHost) | 241 if (url.host() == chrome::kChromeUICloudPrintResourcesHost) |
(...skipping 24 matching lines...) Expand all Loading... |
276 #if !defined(DISABLE_NACL) | 266 #if !defined(DISABLE_NACL) |
277 if (url.host() == chrome::kChromeUINaClHost) | 267 if (url.host() == chrome::kChromeUINaClHost) |
278 return &NewWebUI<NaClUI>; | 268 return &NewWebUI<NaClUI>; |
279 #endif | 269 #endif |
280 #if defined(OS_ANDROID) || defined(OS_IOS) | 270 #if defined(OS_ANDROID) || defined(OS_IOS) |
281 if (url.host() == chrome::kChromeUINetExportHost) | 271 if (url.host() == chrome::kChromeUINetExportHost) |
282 return &NewWebUI<NetExportUI>; | 272 return &NewWebUI<NetExportUI>; |
283 #endif | 273 #endif |
284 if (url.host() == chrome::kChromeUINetInternalsHost) | 274 if (url.host() == chrome::kChromeUINetInternalsHost) |
285 return &NewWebUI<NetInternalsUI>; | 275 return &NewWebUI<NetInternalsUI>; |
| 276 if (url.host() == chrome::kChromeUINewTabHost) |
| 277 return &NewWebUI<NewTabUI>; |
286 if (url.host() == chrome::kChromeUIOmniboxHost) | 278 if (url.host() == chrome::kChromeUIOmniboxHost) |
287 return &NewWebUI<OmniboxUI>; | 279 return &NewWebUI<OmniboxUI>; |
288 if (url.host() == chrome::kChromeUIPredictorsHost) | 280 if (url.host() == chrome::kChromeUIPredictorsHost) |
289 return &NewWebUI<PredictorsUI>; | 281 return &NewWebUI<PredictorsUI>; |
290 if (url.host() == chrome::kChromeUIProfilerHost) | 282 if (url.host() == chrome::kChromeUIProfilerHost) |
291 return &NewWebUI<ProfilerUI>; | 283 return &NewWebUI<ProfilerUI>; |
292 if (url.host() == chrome::kChromeUIQuotaInternalsHost) | 284 if (url.host() == chrome::kChromeUIQuotaInternalsHost) |
293 return &NewWebUI<QuotaInternalsUI>; | 285 return &NewWebUI<QuotaInternalsUI>; |
294 if (url.host() == chrome::kChromeUISignInInternalsHost) | 286 if (url.host() == chrome::kChromeUISignInInternalsHost) |
295 return &NewWebUI<SignInInternalsUI>; | 287 return &NewWebUI<SignInInternalsUI>; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 if (page_url.host() == chrome::kChromeUIPluginsHost) | 656 if (page_url.host() == chrome::kChromeUIPluginsHost) |
665 return PluginsUI::GetFaviconResourceBytes(scale_factor); | 657 return PluginsUI::GetFaviconResourceBytes(scale_factor); |
666 | 658 |
667 // Android doesn't use the components pages. | 659 // Android doesn't use the components pages. |
668 if (page_url.host() == chrome::kChromeUIComponentsHost) | 660 if (page_url.host() == chrome::kChromeUIComponentsHost) |
669 return ComponentsUI::GetFaviconResourceBytes(scale_factor); | 661 return ComponentsUI::GetFaviconResourceBytes(scale_factor); |
670 #endif | 662 #endif |
671 | 663 |
672 return NULL; | 664 return NULL; |
673 } | 665 } |
OLD | NEW |