| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/dom_ui/bookmarks_ui.h" |
| 7 #include "chrome/browser/dom_ui/downloads_ui.h" | 8 #include "chrome/browser/dom_ui/downloads_ui.h" |
| 8 #include "chrome/browser/dom_ui/devtools_ui.h" | 9 #include "chrome/browser/dom_ui/devtools_ui.h" |
| 9 #include "chrome/browser/dom_ui/history_ui.h" | 10 #include "chrome/browser/dom_ui/history_ui.h" |
| 10 #include "chrome/browser/dom_ui/filebrowse_ui.h" | 11 #include "chrome/browser/dom_ui/filebrowse_ui.h" |
| 11 #include "chrome/browser/dom_ui/html_dialog_ui.h" | 12 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
| 12 #include "chrome/browser/dom_ui/new_tab_ui.h" | 13 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 13 #include "chrome/browser/dom_ui/print_ui.h" | 14 #include "chrome/browser/dom_ui/print_ui.h" |
| 14 #include "chrome/browser/extensions/extension_dom_ui.h" | 15 #include "chrome/browser/extensions/extension_dom_ui.h" |
| 15 #include "chrome/browser/extensions/extensions_service.h" | 16 #include "chrome/browser/extensions/extensions_service.h" |
| 16 #include "chrome/browser/extensions/extensions_ui.h" | 17 #include "chrome/browser/extensions/extensions_ui.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // Special case the new tab page. In older versions of Chrome, the new tab | 77 // Special case the new tab page. In older versions of Chrome, the new tab |
| 77 // page was hosted at chrome-internal:<blah>. This might be in people's saved | 78 // page was hosted at chrome-internal:<blah>. This might be in people's saved |
| 78 // sessions or bookmarks, so we say any URL with that scheme triggers the new | 79 // sessions or bookmarks, so we say any URL with that scheme triggers the new |
| 79 // tab page. | 80 // tab page. |
| 80 if (url.host() == chrome::kChromeUINewTabHost || | 81 if (url.host() == chrome::kChromeUINewTabHost || |
| 81 url.SchemeIs(chrome::kChromeInternalScheme)) | 82 url.SchemeIs(chrome::kChromeInternalScheme)) |
| 82 return &NewDOMUI<NewTabUI>; | 83 return &NewDOMUI<NewTabUI>; |
| 83 | 84 |
| 84 // We must compare hosts only since some of the DOM UIs append extra stuff | 85 // We must compare hosts only since some of the DOM UIs append extra stuff |
| 85 // after the host name. | 86 // after the host name. |
| 86 if (url.host() == chrome::kChromeUIHistoryHost) | 87 if (url.host() == chrome::kChromeUIBookmarksHost) |
| 87 return &NewDOMUI<HistoryUI>; | 88 return &NewDOMUI<BookmarksUI>; |
| 89 if (url.host() == chrome::kChromeUIDevToolsHost) |
| 90 return &NewDOMUI<DevToolsUI>; |
| 88 if (url.host() == chrome::kChromeUIDownloadsHost) | 91 if (url.host() == chrome::kChromeUIDownloadsHost) |
| 89 return &NewDOMUI<DownloadsUI>; | 92 return &NewDOMUI<DownloadsUI>; |
| 90 if (url.host() == chrome::kChromeUIExtensionsHost) | 93 if (url.host() == chrome::kChromeUIExtensionsHost) |
| 91 return &NewDOMUI<ExtensionsUI>; | 94 return &NewDOMUI<ExtensionsUI>; |
| 92 if (url.host() == chrome::kChromeUIDevToolsHost) | 95 if (url.host() == chrome::kChromeUIHistoryHost) |
| 93 return &NewDOMUI<DevToolsUI>; | 96 return &NewDOMUI<HistoryUI>; |
| 94 | 97 |
| 95 #if defined(OS_CHROMEOS) | 98 #if defined(OS_CHROMEOS) |
| 96 if (url.host() == chrome::kChromeUIFileBrowseHost) | 99 if (url.host() == chrome::kChromeUIFileBrowseHost) |
| 97 return &NewDOMUI<FileBrowseUI>; | 100 return &NewDOMUI<FileBrowseUI>; |
| 98 #endif | 101 #endif |
| 99 | 102 |
| 100 return NULL; | 103 return NULL; |
| 101 } | 104 } |
| 102 | 105 |
| 103 // static | 106 // static |
| (...skipping 18 matching lines...) Expand all Loading... |
| 122 // static | 125 // static |
| 123 DOMUI* DOMUIFactory::CreateDOMUIForURL(TabContents* tab_contents, | 126 DOMUI* DOMUIFactory::CreateDOMUIForURL(TabContents* tab_contents, |
| 124 const GURL& url) { | 127 const GURL& url) { |
| 125 DOMUIFactoryFunction function = GetDOMUIFactoryFunction(url); | 128 DOMUIFactoryFunction function = GetDOMUIFactoryFunction(url); |
| 126 if (!function) | 129 if (!function) |
| 127 return NULL; | 130 return NULL; |
| 128 return (*function)(tab_contents, url); | 131 return (*function)(tab_contents, url); |
| 129 } | 132 } |
| 130 | 133 |
| 131 // static | 134 // static |
| 132 RefCountedMemory* DOMUIFactory::GetFaviconResourceBytes( | 135 RefCountedMemory* DOMUIFactory::GetFaviconResourceBytes(const GURL& page_url) { |
| 133 const GURL& page_url) { | |
| 134 if (!HasDOMUIScheme(page_url)) | 136 if (!HasDOMUIScheme(page_url)) |
| 135 return NULL; | 137 return NULL; |
| 136 | 138 |
| 139 if (page_url.host() == chrome::kChromeUIBookmarksHost) |
| 140 return BookmarksUI::GetFaviconResourceBytes(); |
| 141 |
| 142 if (page_url.host() == chrome::kChromeUIDownloadsHost) |
| 143 return DownloadsUI::GetFaviconResourceBytes(); |
| 144 |
| 137 if (page_url.host() == chrome::kChromeUIHistoryHost) | 145 if (page_url.host() == chrome::kChromeUIHistoryHost) |
| 138 return HistoryUI::GetFaviconResourceBytes(); | 146 return HistoryUI::GetFaviconResourceBytes(); |
| 139 | 147 |
| 140 if (page_url.host() == chrome::kChromeUIDownloadsHost) | |
| 141 return DownloadsUI::GetFaviconResourceBytes(); | |
| 142 | |
| 143 if (page_url.host() == chrome::kChromeUIExtensionsHost) | |
| 144 return ExtensionsUI::GetFaviconResourceBytes(); | |
| 145 | |
| 146 return NULL; | 148 return NULL; |
| 147 } | 149 } |
| OLD | NEW |