Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc

Issue 16104008: First try at a user management screen for the desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up JS code Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 26 matching lines...) Expand all
37 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 37 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
38 #include "chrome/browser/ui/webui/omnibox/omnibox_ui.h" 38 #include "chrome/browser/ui/webui/omnibox/omnibox_ui.h"
39 #include "chrome/browser/ui/webui/options/options_ui.h" 39 #include "chrome/browser/ui/webui/options/options_ui.h"
40 #include "chrome/browser/ui/webui/performance_monitor/performance_monitor_ui.h" 40 #include "chrome/browser/ui/webui/performance_monitor/performance_monitor_ui.h"
41 #include "chrome/browser/ui/webui/plugins_ui.h" 41 #include "chrome/browser/ui/webui/plugins_ui.h"
42 #include "chrome/browser/ui/webui/predictors/predictors_ui.h" 42 #include "chrome/browser/ui/webui/predictors/predictors_ui.h"
43 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" 43 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
44 #include "chrome/browser/ui/webui/profiler_ui.h" 44 #include "chrome/browser/ui/webui/profiler_ui.h"
45 #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h" 45 #include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h"
46 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_ui.h" 46 #include "chrome/browser/ui/webui/signin/profile_signin_confirmation_ui.h"
47 #include "chrome/browser/ui/webui/signin/user_chooser_ui.h"
47 #include "chrome/browser/ui/webui/signin_internals_ui.h" 48 #include "chrome/browser/ui/webui/signin_internals_ui.h"
48 #include "chrome/browser/ui/webui/sync_internals_ui.h" 49 #include "chrome/browser/ui/webui/sync_internals_ui.h"
49 #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" 50 #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h"
50 #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h" 51 #include "chrome/browser/ui/webui/user_actions/user_actions_ui.h"
51 #include "chrome/browser/ui/webui/version_ui.h" 52 #include "chrome/browser/ui/webui/version_ui.h"
52 #include "chrome/common/chrome_switches.h" 53 #include "chrome/common/chrome_switches.h"
53 #include "chrome/common/extensions/extension_constants.h" 54 #include "chrome/common/extensions/extension_constants.h"
54 #include "chrome/common/extensions/feature_switch.h" 55 #include "chrome/common/extensions/feature_switch.h"
55 #include "chrome/common/pref_names.h" 56 #include "chrome/common/pref_names.h"
56 #include "chrome/common/url_constants.h" 57 #include "chrome/common/url_constants.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ExtensionService* service = profile ? profile->GetExtensionService() : NULL; 162 ExtensionService* service = profile ? profile->GetExtensionService() : NULL;
162 return service && service->ExtensionBindingsAllowed(url); 163 return service && service->ExtensionBindingsAllowed(url);
163 } 164 }
164 165
165 // Returns a function that can be used to create the right type of WebUI for a 166 // Returns a function that can be used to create the right type of WebUI for a
166 // tab, based on its URL. Returns NULL if the URL doesn't have WebUI associated 167 // tab, based on its URL. Returns NULL if the URL doesn't have WebUI associated
167 // with it. 168 // with it.
168 WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, 169 WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
169 Profile* profile, 170 Profile* profile,
170 const GURL& url) { 171 const GURL& url) {
172
Nikita (slow) 2013/06/11 18:22:16 nit: drop empty line
noms 2013/06/12 20:41:54 Done.
171 #if defined(ENABLE_EXTENSIONS) 173 #if defined(ENABLE_EXTENSIONS)
172 if (NeedsExtensionWebUI(profile, url)) 174 if (NeedsExtensionWebUI(profile, url))
173 return &NewWebUI<ExtensionWebUI>; 175 return &NewWebUI<ExtensionWebUI>;
174 #endif 176 #endif
175 177
176 // This will get called a lot to check all URLs, so do a quick check of other 178 // This will get called a lot to check all URLs, so do a quick check of other
177 // schemes to filter out most URLs. 179 // schemes to filter out most URLs.
178 if (!url.SchemeIs(chrome::kChromeDevToolsScheme) && 180 if (!url.SchemeIs(chrome::kChromeDevToolsScheme) &&
179 !url.SchemeIs(chrome::kChromeInternalScheme) && 181 !url.SchemeIs(chrome::kChromeInternalScheme) &&
180 !url.SchemeIs(chrome::kChromeUIScheme)) { 182 !url.SchemeIs(chrome::kChromeUIScheme)) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // use the NTP WebUI. We don't want to return NULL if the sync promo page 380 // use the NTP WebUI. We don't want to return NULL if the sync promo page
379 // is disabled because the page can be disabled mid-flight (for example, 381 // is disabled because the page can be disabled mid-flight (for example,
380 // if sync login finishes). 382 // if sync login finishes).
381 if (SyncPromoUI::ShouldShowSyncPromo(profile)) 383 if (SyncPromoUI::ShouldShowSyncPromo(profile))
382 return &NewWebUI<SyncPromoUI>; 384 return &NewWebUI<SyncPromoUI>;
383 else 385 else
384 return &NewWebUI<NewTabUI>; 386 return &NewWebUI<NewTabUI>;
385 } 387 }
386 #endif 388 #endif
387 389
390 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
391 if (url.host() == chrome::kChromeUIUserChooserHost)
392 return &NewWebUI<UserChooserUI>;
393 #endif
394
388 if (url.host() == chrome::kChromeUIChromeURLsHost || 395 if (url.host() == chrome::kChromeUIChromeURLsHost ||
389 url.host() == chrome::kChromeUICreditsHost || 396 url.host() == chrome::kChromeUICreditsHost ||
390 url.host() == chrome::kChromeUIDNSHost || 397 url.host() == chrome::kChromeUIDNSHost ||
391 url.host() == chrome::kChromeUIMemoryHost || 398 url.host() == chrome::kChromeUIMemoryHost ||
392 url.host() == chrome::kChromeUIMemoryRedirectHost || 399 url.host() == chrome::kChromeUIMemoryRedirectHost ||
393 url.host() == chrome::kChromeUIStatsHost || 400 url.host() == chrome::kChromeUIStatsHost ||
394 url.host() == chrome::kChromeUITermsHost 401 url.host() == chrome::kChromeUITermsHost
395 #if defined(OS_LINUX) || defined(OS_OPENBSD) 402 #if defined(OS_LINUX) || defined(OS_OPENBSD)
396 || url.host() == chrome::kChromeUILinuxProxyConfigHost 403 || url.host() == chrome::kChromeUILinuxProxyConfigHost
397 || url.host() == chrome::kChromeUISandboxHost 404 || url.host() == chrome::kChromeUISandboxHost
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 if (page_url.host() == chrome::kChromeUISettingsFrameHost) 585 if (page_url.host() == chrome::kChromeUISettingsFrameHost)
579 return options::OptionsUI::GetFaviconResourceBytes(scale_factor); 586 return options::OptionsUI::GetFaviconResourceBytes(scale_factor);
580 587
581 // Android doesn't use the plugins pages. 588 // Android doesn't use the plugins pages.
582 if (page_url.host() == chrome::kChromeUIPluginsHost) 589 if (page_url.host() == chrome::kChromeUIPluginsHost)
583 return PluginsUI::GetFaviconResourceBytes(scale_factor); 590 return PluginsUI::GetFaviconResourceBytes(scale_factor);
584 #endif 591 #endif
585 592
586 return NULL; 593 return NULL;
587 } 594 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698