| 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/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
| 9 #include "chrome/browser/dom_ui/bookmarks_ui.h" | 9 #include "chrome/browser/dom_ui/bookmarks_ui.h" |
| 10 #include "chrome/browser/dom_ui/bug_report_ui.h" | 10 #include "chrome/browser/dom_ui/bug_report_ui.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // Special case for extensions. | 55 // Special case for extensions. |
| 56 template<> | 56 template<> |
| 57 DOMUI* NewDOMUI<ExtensionDOMUI>(TabContents* contents, const GURL& url) { | 57 DOMUI* NewDOMUI<ExtensionDOMUI>(TabContents* contents, const GURL& url) { |
| 58 // Don't use a DOMUI for non-existent extensions or for incognito tabs. The | 58 // Don't use a DOMUI for non-existent extensions or for incognito tabs. The |
| 59 // latter restriction is because we require extensions to run within a single | 59 // latter restriction is because we require extensions to run within a single |
| 60 // process. | 60 // process. |
| 61 ExtensionsService* service = contents->profile()->GetExtensionsService(); | 61 ExtensionsService* service = contents->profile()->GetExtensionsService(); |
| 62 bool valid_extension = | 62 bool valid_extension = |
| 63 (service && service->GetExtensionById(url.host(), false)); | 63 (service && service->GetExtensionById(url.host(), false)); |
| 64 if (valid_extension && !contents->profile()->IsOffTheRecord()) | 64 if (valid_extension) |
| 65 return new ExtensionDOMUI(contents); | 65 return new ExtensionDOMUI(contents); |
| 66 return NULL; | 66 return NULL; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Returns a function that can be used to create the right type of DOMUI for a | 69 // Returns a function that can be used to create the right type of DOMUI for a |
| 70 // tab, based on its URL. Returns NULL if the URL doesn't have DOMUI associated | 70 // tab, based on its URL. Returns NULL if the URL doesn't have DOMUI associated |
| 71 // with it. Even if the factory function is valid, it may yield a NULL DOMUI | 71 // with it. Even if the factory function is valid, it may yield a NULL DOMUI |
| 72 // when invoked for a particular tab - see NewDOMUI<ExtensionDOMUI>. | 72 // when invoked for a particular tab - see NewDOMUI<ExtensionDOMUI>. |
| 73 static DOMUIFactoryFunction GetDOMUIFactoryFunction(const GURL& url) { | 73 static DOMUIFactoryFunction GetDOMUIFactoryFunction(const GURL& url) { |
| 74 // Currently, any gears: URL means an HTML dialog. | 74 // Currently, any gears: URL means an HTML dialog. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 if (page_url.host() == chrome::kChromeUIPluginsHost) | 242 if (page_url.host() == chrome::kChromeUIPluginsHost) |
| 243 return PluginsUI::GetFaviconResourceBytes(); | 243 return PluginsUI::GetFaviconResourceBytes(); |
| 244 | 244 |
| 245 #if defined(ENABLE_REMOTING) | 245 #if defined(ENABLE_REMOTING) |
| 246 if (page_url.host() == chrome::kChromeUIRemotingHost) | 246 if (page_url.host() == chrome::kChromeUIRemotingHost) |
| 247 return RemotingUI::GetFaviconResourceBytes(); | 247 return RemotingUI::GetFaviconResourceBytes(); |
| 248 #endif | 248 #endif |
| 249 | 249 |
| 250 return NULL; | 250 return NULL; |
| 251 } | 251 } |
| OLD | NEW |