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

Side by Side Diff: chrome/browser/dom_ui/dom_ui_factory.cc

Issue 4862002: Prevent a crash when visiting about:hang in two NTPs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix indent Created 10 years, 1 month 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
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_factory.h ('k') | chrome/browser/dom_ui/new_tab_ui_uitest.cc » ('j') | 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) 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
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_factory.h ('k') | chrome/browser/dom_ui/new_tab_ui_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698