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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/browser/chromeos/dom_ui/menu_ui.h" | 44 #include "chrome/browser/chromeos/dom_ui/menu_ui.h" |
45 #include "chrome/browser/chromeos/dom_ui/mobile_setup_ui.h" | 45 #include "chrome/browser/chromeos/dom_ui/mobile_setup_ui.h" |
46 #include "chrome/browser/chromeos/dom_ui/register_page_ui.h" | 46 #include "chrome/browser/chromeos/dom_ui/register_page_ui.h" |
47 #include "chrome/browser/chromeos/dom_ui/system_info_ui.h" | 47 #include "chrome/browser/chromeos/dom_ui/system_info_ui.h" |
48 #include "chrome/browser/chromeos/dom_ui/wrench_menu_ui.h" | 48 #include "chrome/browser/chromeos/dom_ui/wrench_menu_ui.h" |
49 #include "chrome/browser/chromeos/dom_ui/network_menu_ui.h" | 49 #include "chrome/browser/chromeos/dom_ui/network_menu_ui.h" |
50 #include "chrome/browser/dom_ui/filebrowse_ui.h" | 50 #include "chrome/browser/dom_ui/filebrowse_ui.h" |
51 #include "chrome/browser/dom_ui/mediaplayer_ui.h" | 51 #include "chrome/browser/dom_ui/mediaplayer_ui.h" |
52 #endif | 52 #endif |
53 | 53 |
| 54 #if defined(OS_WIN) |
| 55 #include "chrome/browser/dom_ui/conflicts_ui.h" |
| 56 #endif |
| 57 |
54 const DOMUITypeID DOMUIFactory::kNoDOMUI = NULL; | 58 const DOMUITypeID DOMUIFactory::kNoDOMUI = NULL; |
55 | 59 |
56 // A function for creating a new DOMUI. The caller owns the return value, which | 60 // A function for creating a new DOMUI. The caller owns the return value, which |
57 // may be NULL (for example, if the URL refers to an non-existent extension). | 61 // may be NULL (for example, if the URL refers to an non-existent extension). |
58 typedef DOMUI* (*DOMUIFactoryFunction)(TabContents* tab_contents, | 62 typedef DOMUI* (*DOMUIFactoryFunction)(TabContents* tab_contents, |
59 const GURL& url); | 63 const GURL& url); |
60 | 64 |
61 // Template for defining DOMUIFactoryFunction. | 65 // Template for defining DOMUIFactoryFunction. |
62 template<class T> | 66 template<class T> |
63 DOMUI* NewDOMUI(TabContents* contents, const GURL& url) { | 67 DOMUI* NewDOMUI(TabContents* contents, const GURL& url) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return &NewDOMUI<DOMUI>; | 128 return &NewDOMUI<DOMUI>; |
125 | 129 |
126 // We must compare hosts only since some of the DOM UIs append extra stuff | 130 // We must compare hosts only since some of the DOM UIs append extra stuff |
127 // after the host name. | 131 // after the host name. |
128 if (url.host() == chrome::kChromeUIBookmarksHost) | 132 if (url.host() == chrome::kChromeUIBookmarksHost) |
129 return &NewDOMUI<BookmarksUI>; | 133 return &NewDOMUI<BookmarksUI>; |
130 if (url.host() == chrome::kChromeUIBugReportHost) | 134 if (url.host() == chrome::kChromeUIBugReportHost) |
131 return &NewDOMUI<BugReportUI>; | 135 return &NewDOMUI<BugReportUI>; |
132 if (url.host() == chrome::kChromeUIDevToolsHost) | 136 if (url.host() == chrome::kChromeUIDevToolsHost) |
133 return &NewDOMUI<DevToolsUI>; | 137 return &NewDOMUI<DevToolsUI>; |
| 138 #if defined(OS_WIN) |
| 139 if (url.host() == chrome::kChromeUIConflictsHost) |
| 140 return &NewDOMUI<ConflictsUI>; |
| 141 #endif |
134 if (url.host() == chrome::kChromeUIDownloadsHost) | 142 if (url.host() == chrome::kChromeUIDownloadsHost) |
135 return &NewDOMUI<DownloadsUI>; | 143 return &NewDOMUI<DownloadsUI>; |
136 if (url.host() == chrome::kChromeUITextfieldsHost) | 144 if (url.host() == chrome::kChromeUITextfieldsHost) |
137 return &NewDOMUI<TextfieldsUI>; | 145 return &NewDOMUI<TextfieldsUI>; |
138 if (url.host() == chrome::kChromeUIExtensionsHost) | 146 if (url.host() == chrome::kChromeUIExtensionsHost) |
139 return &NewDOMUI<ExtensionsUI>; | 147 return &NewDOMUI<ExtensionsUI>; |
140 if (url.host() == chrome::kChromeUIHistoryHost) | 148 if (url.host() == chrome::kChromeUIHistoryHost) |
141 return &NewDOMUI<HistoryUI>; | 149 return &NewDOMUI<HistoryUI>; |
142 if (url.host() == chrome::kChromeUIHistory2Host) | 150 if (url.host() == chrome::kChromeUIHistory2Host) |
143 return &NewDOMUI<HistoryUI2>; | 151 return &NewDOMUI<HistoryUI2>; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 272 |
265 // The extension scheme is handled in GetFaviconForURL. | 273 // The extension scheme is handled in GetFaviconForURL. |
266 if (page_url.SchemeIs(chrome::kExtensionScheme)) { | 274 if (page_url.SchemeIs(chrome::kExtensionScheme)) { |
267 NOTREACHED(); | 275 NOTREACHED(); |
268 return NULL; | 276 return NULL; |
269 } | 277 } |
270 | 278 |
271 if (!HasDOMUIScheme(page_url)) | 279 if (!HasDOMUIScheme(page_url)) |
272 return NULL; | 280 return NULL; |
273 | 281 |
| 282 #if defined(OS_WIN) |
| 283 if (page_url.host() == chrome::kChromeUIConflictsHost) |
| 284 return ConflictsUI::GetFaviconResourceBytes(); |
| 285 #endif |
| 286 |
274 if (page_url.host() == chrome::kChromeUIDownloadsHost) | 287 if (page_url.host() == chrome::kChromeUIDownloadsHost) |
275 return DownloadsUI::GetFaviconResourceBytes(); | 288 return DownloadsUI::GetFaviconResourceBytes(); |
276 | 289 |
277 if (page_url.host() == chrome::kChromeUIExtensionsHost) | 290 if (page_url.host() == chrome::kChromeUIExtensionsHost) |
278 return ExtensionsUI::GetFaviconResourceBytes(); | 291 return ExtensionsUI::GetFaviconResourceBytes(); |
279 | 292 |
280 if (page_url.host() == chrome::kChromeUIHistoryHost) | 293 if (page_url.host() == chrome::kChromeUIHistoryHost) |
281 return HistoryUI::GetFaviconResourceBytes(); | 294 return HistoryUI::GetFaviconResourceBytes(); |
282 | 295 |
283 if (page_url.host() == chrome::kChromeUIHistory2Host) | 296 if (page_url.host() == chrome::kChromeUIHistory2Host) |
284 return HistoryUI2::GetFaviconResourceBytes(); | 297 return HistoryUI2::GetFaviconResourceBytes(); |
285 | 298 |
286 if (page_url.host() == chrome::kChromeUIFlagsHost) | 299 if (page_url.host() == chrome::kChromeUIFlagsHost) |
287 return FlagsUI::GetFaviconResourceBytes(); | 300 return FlagsUI::GetFaviconResourceBytes(); |
288 | 301 |
289 if (page_url.host() == chrome::kChromeUISettingsHost) | 302 if (page_url.host() == chrome::kChromeUISettingsHost) |
290 return OptionsUI::GetFaviconResourceBytes(); | 303 return OptionsUI::GetFaviconResourceBytes(); |
291 | 304 |
292 if (page_url.host() == chrome::kChromeUIPluginsHost) | 305 if (page_url.host() == chrome::kChromeUIPluginsHost) |
293 return PluginsUI::GetFaviconResourceBytes(); | 306 return PluginsUI::GetFaviconResourceBytes(); |
294 | 307 |
295 #if defined(ENABLE_REMOTING) | 308 #if defined(ENABLE_REMOTING) |
296 if (page_url.host() == chrome::kChromeUIRemotingHost) | 309 if (page_url.host() == chrome::kChromeUIRemotingHost) |
297 return RemotingUI::GetFaviconResourceBytes(); | 310 return RemotingUI::GetFaviconResourceBytes(); |
298 #endif | 311 #endif |
299 | 312 |
300 return NULL; | 313 return NULL; |
301 } | 314 } |
OLD | NEW |