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

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

Issue 2371273002: [Experiment, do not commit] Try not using WebUI for extensions w/o bindings. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 WebUIController* NewWebUI<WelcomeUI>(WebUI* web_ui, const GURL& url) { 273 WebUIController* NewWebUI<WelcomeUI>(WebUI* web_ui, const GURL& url) {
274 return new WelcomeUI(web_ui, url); 274 return new WelcomeUI(web_ui, url);
275 } 275 }
276 #endif // !defined(OS_CHROMEOS) 276 #endif // !defined(OS_CHROMEOS)
277 #endif // !defined(OS_ANDROID) 277 #endif // !defined(OS_ANDROID)
278 278
279 #if defined(ENABLE_EXTENSIONS) 279 #if defined(ENABLE_EXTENSIONS)
280 // Only create ExtensionWebUI for URLs that are allowed extension bindings, 280 // Only create ExtensionWebUI for URLs that are allowed extension bindings,
281 // hosted by actual tabs. 281 // hosted by actual tabs.
282 bool NeedsExtensionWebUI(Profile* profile, const GURL& url) { 282 bool NeedsExtensionWebUI(Profile* profile, const GURL& url) {
283 if (!profile) 283 return false;
284 return false;
285
286 const extensions::Extension* extension =
287 extensions::ExtensionRegistry::Get(profile)->enabled_extensions().
288 GetExtensionOrAppByURL(url);
289 // Allow bindings for all packaged extensions and component hosted apps.
290 return extension &&
291 (!extension->is_hosted_app() ||
292 extension->location() == extensions::Manifest::COMPONENT);
293 } 284 }
294 #endif 285 #endif
295 286
296 bool IsAboutUI(const GURL& url) { 287 bool IsAboutUI(const GURL& url) {
297 return (url.host() == chrome::kChromeUIChromeURLsHost || 288 return (url.host() == chrome::kChromeUIChromeURLsHost ||
298 url.host() == chrome::kChromeUICreditsHost || 289 url.host() == chrome::kChromeUICreditsHost ||
299 url.host() == chrome::kChromeUIDNSHost 290 url.host() == chrome::kChromeUIDNSHost
300 #if !defined(OS_ANDROID) 291 #if !defined(OS_ANDROID)
301 || url.host() == chrome::kChromeUITermsHost 292 || url.host() == chrome::kChromeUITermsHost
302 #endif 293 #endif
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 #endif 826 #endif
836 827
837 // Android doesn't use the plugins pages. 828 // Android doesn't use the plugins pages.
838 if (page_url.host() == chrome::kChromeUIPluginsHost) 829 if (page_url.host() == chrome::kChromeUIPluginsHost)
839 return PluginsUI::GetFaviconResourceBytes(scale_factor); 830 return PluginsUI::GetFaviconResourceBytes(scale_factor);
840 831
841 #endif 832 #endif
842 833
843 return NULL; 834 return NULL;
844 } 835 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698