Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 if (url.host_piece() == chrome::kChromeUIUsbInternalsHost) | 385 if (url.host_piece() == chrome::kChromeUIUsbInternalsHost) |
| 386 return &NewWebUI<UsbInternalsUI>; | 386 return &NewWebUI<UsbInternalsUI>; |
| 387 if (url.host_piece() == chrome::kChromeUIUserActionsHost) | 387 if (url.host_piece() == chrome::kChromeUIUserActionsHost) |
| 388 return &NewWebUI<UserActionsUI>; | 388 return &NewWebUI<UserActionsUI>; |
| 389 if (url.host_piece() == chrome::kChromeUIVersionHost) | 389 if (url.host_piece() == chrome::kChromeUIVersionHost) |
| 390 return &NewWebUI<VersionUI>; | 390 return &NewWebUI<VersionUI>; |
| 391 | 391 |
| 392 /**************************************************************************** | 392 /**************************************************************************** |
| 393 * OS Specific #defines | 393 * OS Specific #defines |
| 394 ***************************************************************************/ | 394 ***************************************************************************/ |
| 395 #if !defined(OS_ANDROID) | 395 #if !defined(OS_ANDROID) |
|
Dan Beam
2017/06/03 00:11:02
^ this is how it doesn't break android ;)
| |
| 396 #if !defined(OS_CHROMEOS) | 396 #if !defined(OS_CHROMEOS) |
| 397 // AppLauncherPage is not needed on Android or ChromeOS. | 397 // AppLauncherPage is not needed on Android or ChromeOS. |
| 398 if (url.host_piece() == chrome::kChromeUIAppLauncherPageHost && profile && | 398 if (url.host_piece() == chrome::kChromeUIAppLauncherPageHost && profile && |
| 399 extensions::ExtensionSystem::Get(profile)->extension_service()) { | 399 extensions::ExtensionSystem::Get(profile)->extension_service()) { |
| 400 return &NewWebUI<AppLauncherPageUI>; | 400 return &NewWebUI<AppLauncherPageUI>; |
| 401 } | 401 } |
| 402 #endif // !defined(OS_CHROMEOS) | 402 #endif // !defined(OS_CHROMEOS) |
| 403 | 403 |
| 404 // Bookmarks are part of NTP on Android. | 404 // Bookmarks are part of NTP on Android. |
| 405 if (url.host_piece() == chrome::kChromeUIBookmarksHost) { | 405 if (url.host_piece() == chrome::kChromeUIBookmarksHost) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 416 return &NewWebUI<MdFeedbackUI>; | 416 return &NewWebUI<MdFeedbackUI>; |
| 417 } | 417 } |
| 418 // Help is implemented with native UI elements on Android. | 418 // Help is implemented with native UI elements on Android. |
| 419 if (url.host_piece() == chrome::kChromeUIHelpFrameHost) | 419 if (url.host_piece() == chrome::kChromeUIHelpFrameHost) |
| 420 return &NewWebUI<HelpUI>; | 420 return &NewWebUI<HelpUI>; |
| 421 // Identity API is not available on Android. | 421 // Identity API is not available on Android. |
| 422 if (url.host_piece() == chrome::kChromeUIIdentityInternalsHost) | 422 if (url.host_piece() == chrome::kChromeUIIdentityInternalsHost) |
| 423 return &NewWebUI<IdentityInternalsUI>; | 423 return &NewWebUI<IdentityInternalsUI>; |
| 424 if (url.host_piece() == chrome::kChromeUINewTabHost) | 424 if (url.host_piece() == chrome::kChromeUINewTabHost) |
| 425 return &NewWebUI<NewTabUI>; | 425 return &NewWebUI<NewTabUI>; |
| 426 if (url.host_piece() == chrome::kChromeUIMdSettingsHost) | 426 if (url.host_piece() == chrome::kChromeUISettingsHost || |
| 427 url.host_piece() == chrome::kChromeUIMdSettingsHost) { | |
| 427 return &NewWebUI<settings::MdSettingsUI>; | 428 return &NewWebUI<settings::MdSettingsUI>; |
| 429 } | |
| 428 // If the material design extensions page is enabled, it gets its own host. | 430 // If the material design extensions page is enabled, it gets its own host. |
| 429 // Otherwise, it's handled by the uber settings page. | 431 // Otherwise, it's handled by the uber settings page. |
| 430 if (url.host_piece() == chrome::kChromeUIExtensionsHost && | 432 if (url.host_piece() == chrome::kChromeUIExtensionsHost && |
| 431 base::FeatureList::IsEnabled(features::kMaterialDesignExtensions)) { | 433 base::FeatureList::IsEnabled(features::kMaterialDesignExtensions)) { |
| 432 return &NewWebUI<extensions::ExtensionsUI>; | 434 return &NewWebUI<extensions::ExtensionsUI>; |
| 433 } | 435 } |
| 434 if (url.host_piece() == chrome::kChromeUIHistoryHost) | 436 if (url.host_piece() == chrome::kChromeUIHistoryHost) |
| 435 return &NewWebUI<MdHistoryUI>; | 437 return &NewWebUI<MdHistoryUI>; |
| 436 // Material Design Settings gets its own host, if enabled. | |
| 437 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings) && | |
| 438 url.host_piece() == chrome::kChromeUISettingsHost) { | |
| 439 return &NewWebUI<settings::MdSettingsUI>; | |
| 440 } | |
| 441 // Settings are implemented with native UI elements on Android. | |
| 442 // Handle chrome://settings if settings in a window is enabled. | |
| 443 if (url.host_piece() == chrome::kChromeUISettingsFrameHost || | |
| 444 (url.host_piece() == chrome::kChromeUISettingsHost && | |
| 445 ::switches::SettingsWindowEnabled())) { | |
|
dpapad
2017/06/01 00:12:54
Don't fully understand what this code did, but can
| |
| 446 return &NewWebUI<options::OptionsUI>; | |
| 447 } | |
| 448 if (url.host_piece() == chrome::kChromeUISyncFileSystemInternalsHost) | 438 if (url.host_piece() == chrome::kChromeUISyncFileSystemInternalsHost) |
| 449 return &NewWebUI<SyncFileSystemInternalsUI>; | 439 return &NewWebUI<SyncFileSystemInternalsUI>; |
| 450 if (url.host_piece() == chrome::kChromeUISystemInfoHost) | 440 if (url.host_piece() == chrome::kChromeUISystemInfoHost) |
| 451 return &NewWebUI<SystemInfoUI>; | 441 return &NewWebUI<SystemInfoUI>; |
| 452 // Uber frame is not used on Android. | 442 // Uber frame is not used on Android. |
| 453 if (url.host_piece() == chrome::kChromeUIUberFrameHost) | 443 if (url.host_piece() == chrome::kChromeUIUberFrameHost) |
| 454 return &NewWebUI<UberFrameUI>; | 444 return &NewWebUI<UberFrameUI>; |
| 455 // Uber page is not used on Android. | 445 // Uber page is not used on Android. |
| 456 if (url.host_piece() == chrome::kChromeUIUberHost) | 446 if (url.host_piece() == chrome::kChromeUIUberHost) |
| 457 return &NewWebUI<UberUI>; | 447 return &NewWebUI<UberUI>; |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 819 | 809 |
| 820 #if BUILDFLAG(ENABLE_EXTENSIONS) | 810 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 821 if (page_url.host_piece() == chrome::kChromeUIExtensionsHost || | 811 if (page_url.host_piece() == chrome::kChromeUIExtensionsHost || |
| 822 page_url.host_piece() == chrome::kChromeUIExtensionsFrameHost) | 812 page_url.host_piece() == chrome::kChromeUIExtensionsFrameHost) |
| 823 return extensions::ExtensionsUI::GetFaviconResourceBytes(scale_factor); | 813 return extensions::ExtensionsUI::GetFaviconResourceBytes(scale_factor); |
| 824 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 814 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 825 #endif // !defined(OS_ANDROID) | 815 #endif // !defined(OS_ANDROID) |
| 826 | 816 |
| 827 return NULL; | 817 return NULL; |
| 828 } | 818 } |
| OLD | NEW |