OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/dom_ui_factory.h" | 5 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/about_flags.h" | 8 #include "chrome/browser/about_flags.h" |
9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
10 #include "chrome/browser/dom_ui/bookmarks_ui.h" | 10 #include "chrome/browser/dom_ui/bookmarks_ui.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 url.SchemeIs(chrome::kChromeUIScheme) || | 227 url.SchemeIs(chrome::kChromeUIScheme) || |
228 url.SchemeIs(chrome::kExtensionScheme); | 228 url.SchemeIs(chrome::kExtensionScheme); |
229 } | 229 } |
230 | 230 |
231 // static | 231 // static |
232 bool DOMUIFactory::UseDOMUIForURL(Profile* profile, const GURL& url) { | 232 bool DOMUIFactory::UseDOMUIForURL(Profile* profile, const GURL& url) { |
233 return GetDOMUIFactoryFunction(profile, url) != NULL; | 233 return GetDOMUIFactoryFunction(profile, url) != NULL; |
234 } | 234 } |
235 | 235 |
236 // static | 236 // static |
237 bool DOMUIFactory::IsURLAcceptableForDOMUI(Profile* profile, const GURL& url) { | |
238 return UseDOMUIForURL(profile, url) || | |
239 // javacsript: URLs are allowed to run in DOM UI pages | |
brettw
2010/11/15 00:04:32
All this stuff should be indented only 4 spaces (6
Charlie Reis
2010/11/15 17:49:27
Done.
| |
240 url.SchemeIs(chrome::kJavaScriptScheme) || | |
241 // It's possible to load about:blank in a DOM UI renderer. | |
242 // See http://crbug.com/42547 | |
243 url.spec() == chrome::kAboutBlankURL || | |
244 // about:crash, about:hang, and about:shorthang are allowed. | |
245 url.spec() == chrome::kAboutCrashURL || | |
246 url.spec() == chrome::kAboutHangURL || | |
247 url.spec() == chrome::kAboutShorthangURL; | |
248 } | |
249 | |
250 // static | |
237 DOMUI* DOMUIFactory::CreateDOMUIForURL(TabContents* tab_contents, | 251 DOMUI* DOMUIFactory::CreateDOMUIForURL(TabContents* tab_contents, |
238 const GURL& url) { | 252 const GURL& url) { |
239 DOMUIFactoryFunction function = GetDOMUIFactoryFunction( | 253 DOMUIFactoryFunction function = GetDOMUIFactoryFunction( |
240 tab_contents->profile(), url); | 254 tab_contents->profile(), url); |
241 if (!function) | 255 if (!function) |
242 return NULL; | 256 return NULL; |
243 return (*function)(tab_contents, url); | 257 return (*function)(tab_contents, url); |
244 } | 258 } |
245 | 259 |
246 // static | 260 // static |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 if (page_url.host() == chrome::kChromeUIPluginsHost) | 319 if (page_url.host() == chrome::kChromeUIPluginsHost) |
306 return PluginsUI::GetFaviconResourceBytes(); | 320 return PluginsUI::GetFaviconResourceBytes(); |
307 | 321 |
308 #if defined(ENABLE_REMOTING) | 322 #if defined(ENABLE_REMOTING) |
309 if (page_url.host() == chrome::kChromeUIRemotingHost) | 323 if (page_url.host() == chrome::kChromeUIRemotingHost) |
310 return RemotingUI::GetFaviconResourceBytes(); | 324 return RemotingUI::GetFaviconResourceBytes(); |
311 #endif | 325 #endif |
312 | 326 |
313 return NULL; | 327 return NULL; |
314 } | 328 } |
OLD | NEW |