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

Side by Side Diff: content/browser/webui/web_ui_controller_factory_registry.cc

Issue 160743002: Remove duplicated code in favor of IsRendererDebugURL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/webui/web_ui_controller_factory_registry.h" 5 #include "content/browser/webui/web_ui_controller_factory_registry.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "content/browser/frame_host/debug_urls.h"
8 #include "content/public/common/url_constants.h" 9 #include "content/public/common/url_constants.h"
9 #include "url/gurl.h" 10 #include "url/gurl.h"
10 11
11 namespace content { 12 namespace content {
12 13
13 base::LazyInstance<std::vector<WebUIControllerFactory*> > g_factories = 14 base::LazyInstance<std::vector<WebUIControllerFactory*> > g_factories =
14 LAZY_INSTANCE_INITIALIZER; 15 LAZY_INSTANCE_INITIALIZER;
15 16
16 void WebUIControllerFactory::RegisterFactory(WebUIControllerFactory* factory) { 17 void WebUIControllerFactory::RegisterFactory(WebUIControllerFactory* factory) {
17 g_factories.Pointer()->push_back(factory); 18 g_factories.Pointer()->push_back(factory);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if ((*factories)[i]->UseWebUIBindingsForURL(browser_context, url)) 74 if ((*factories)[i]->UseWebUIBindingsForURL(browser_context, url))
74 return true; 75 return true;
75 } 76 }
76 return false; 77 return false;
77 } 78 }
78 79
79 bool WebUIControllerFactoryRegistry::IsURLAcceptableForWebUI( 80 bool WebUIControllerFactoryRegistry::IsURLAcceptableForWebUI(
80 BrowserContext* browser_context, 81 BrowserContext* browser_context,
81 const GURL& url) const { 82 const GURL& url) const {
82 return UseWebUIForURL(browser_context, url) || 83 return UseWebUIForURL(browser_context, url) ||
83 // javascript: URLs are allowed to run in Web UI pages.
84 url.SchemeIs(kJavaScriptScheme) ||
85 // It's possible to load about:blank in a Web UI renderer. 84 // It's possible to load about:blank in a Web UI renderer.
86 // See http://crbug.com/42547 85 // See http://crbug.com/42547
87 url.spec() == kAboutBlankURL || 86 url.spec() == kAboutBlankURL ||
88 // Chrome URLs crash, kill, hang, and shorthang are allowed. 87 // javascript: and debug URLs liks chrome://kill are allowed.
nasko 2014/02/12 23:27:29 nit: s/liks/like/
Charlie Reis 2014/02/12 23:41:26 Oops, thanks. Fixed.
89 url == GURL(kChromeUICrashURL) || 88 IsRendererDebugURL(url);
90 url == GURL(kChromeUIKillURL) ||
91 url == GURL(kChromeUIHangURL) ||
92 url == GURL(kChromeUIShorthangURL);
93 } 89 }
94 90
95 WebUIControllerFactoryRegistry::WebUIControllerFactoryRegistry() { 91 WebUIControllerFactoryRegistry::WebUIControllerFactoryRegistry() {
96 } 92 }
97 93
98 WebUIControllerFactoryRegistry::~WebUIControllerFactoryRegistry() { 94 WebUIControllerFactoryRegistry::~WebUIControllerFactoryRegistry() {
99 } 95 }
100 96
101 } // namespace content 97 } // namespace content
OLDNEW
« content/browser/browser_url_handler_impl.cc ('K') | « content/browser/browser_url_handler_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698