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 "chrome/browser/chrome_thread.h" | 7 #include "chrome/browser/chrome_thread.h" |
8 #include "chrome/browser/dom_ui/bookmarks_ui.h" | 8 #include "chrome/browser/dom_ui/bookmarks_ui.h" |
9 #include "chrome/browser/dom_ui/downloads_ui.h" | 9 #include "chrome/browser/dom_ui/downloads_ui.h" |
10 #include "chrome/browser/dom_ui/devtools_ui.h" | 10 #include "chrome/browser/dom_ui/devtools_ui.h" |
11 #include "chrome/browser/dom_ui/filebrowse_ui.h" | |
12 #include "chrome/browser/dom_ui/history_ui.h" | 11 #include "chrome/browser/dom_ui/history_ui.h" |
13 #include "chrome/browser/dom_ui/html_dialog_ui.h" | 12 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
14 #include "chrome/browser/dom_ui/mediaplayer_ui.h" | |
15 #include "chrome/browser/dom_ui/net_internals_ui.h" | 13 #include "chrome/browser/dom_ui/net_internals_ui.h" |
16 #include "chrome/browser/dom_ui/new_tab_ui.h" | 14 #include "chrome/browser/dom_ui/new_tab_ui.h" |
17 #include "chrome/browser/dom_ui/plugins_ui.h" | 15 #include "chrome/browser/dom_ui/plugins_ui.h" |
18 #include "chrome/browser/extensions/extension_dom_ui.h" | 16 #include "chrome/browser/extensions/extension_dom_ui.h" |
19 #include "chrome/browser/extensions/extensions_service.h" | 17 #include "chrome/browser/extensions/extensions_service.h" |
20 #include "chrome/browser/extensions/extensions_ui.h" | 18 #include "chrome/browser/extensions/extensions_ui.h" |
21 #include "chrome/browser/printing/print_dialog_cloud.h" | 19 #include "chrome/browser/printing/print_dialog_cloud.h" |
22 #include "chrome/browser/profile.h" | 20 #include "chrome/browser/profile.h" |
23 #include "chrome/browser/tab_contents/tab_contents.h" | 21 #include "chrome/browser/tab_contents/tab_contents.h" |
24 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
25 #include "googleurl/src/gurl.h" | 23 #include "googleurl/src/gurl.h" |
26 | 24 |
| 25 #if defined(OS_CHROMEOS) |
| 26 #include "chrome/browser/dom_ui/filebrowse_ui.h" |
| 27 #include "chrome/browser/dom_ui/mediaplayer_ui.h" |
| 28 #include "chrome/browser/dom_ui/options_ui.h" |
| 29 #endif |
| 30 |
27 const DOMUITypeID DOMUIFactory::kNoDOMUI = NULL; | 31 const DOMUITypeID DOMUIFactory::kNoDOMUI = NULL; |
28 | 32 |
29 // A function for creating a new DOMUI. The caller owns the return value, which | 33 // A function for creating a new DOMUI. The caller owns the return value, which |
30 // may be NULL (for example, if the URL refers to an non-existent extension). | 34 // may be NULL (for example, if the URL refers to an non-existent extension). |
31 typedef DOMUI* (*DOMUIFactoryFunction)(TabContents* tab_contents, | 35 typedef DOMUI* (*DOMUIFactoryFunction)(TabContents* tab_contents, |
32 const GURL& url); | 36 const GURL& url); |
33 | 37 |
34 // Template for defining DOMUIFactoryFunction. | 38 // Template for defining DOMUIFactoryFunction. |
35 template<class T> | 39 template<class T> |
36 DOMUI* NewDOMUI(TabContents* contents, const GURL& url) { | 40 DOMUI* NewDOMUI(TabContents* contents, const GURL& url) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 if (url.host() == chrome::kChromeUIHistoryHost) | 103 if (url.host() == chrome::kChromeUIHistoryHost) |
100 return &NewDOMUI<HistoryUI>; | 104 return &NewDOMUI<HistoryUI>; |
101 if (url.host() == chrome::kChromeUINetInternalsHost) | 105 if (url.host() == chrome::kChromeUINetInternalsHost) |
102 return &NewDOMUI<NetInternalsUI>; | 106 return &NewDOMUI<NetInternalsUI>; |
103 if (url.host() == chrome::kChromeUIPluginsHost) | 107 if (url.host() == chrome::kChromeUIPluginsHost) |
104 return &NewDOMUI<PluginsUI>; | 108 return &NewDOMUI<PluginsUI>; |
105 | 109 |
106 #if defined(OS_CHROMEOS) | 110 #if defined(OS_CHROMEOS) |
107 if (url.host() == chrome::kChromeUIFileBrowseHost) | 111 if (url.host() == chrome::kChromeUIFileBrowseHost) |
108 return &NewDOMUI<FileBrowseUI>; | 112 return &NewDOMUI<FileBrowseUI>; |
109 | |
110 if (url.host() == chrome::kChromeUIMediaplayerHost) | 113 if (url.host() == chrome::kChromeUIMediaplayerHost) |
111 return &NewDOMUI<MediaplayerUI>; | 114 return &NewDOMUI<MediaplayerUI>; |
| 115 if (url.host() == chrome::kChromeUIOptionsHost) |
| 116 return &NewDOMUI<OptionsUI>; |
112 #endif | 117 #endif |
113 | 118 |
114 return NULL; | 119 return NULL; |
115 } | 120 } |
116 | 121 |
117 // static | 122 // static |
118 DOMUITypeID DOMUIFactory::GetDOMUIType(const GURL& url) { | 123 DOMUITypeID DOMUIFactory::GetDOMUIType(const GURL& url) { |
119 DOMUIFactoryFunction function = GetDOMUIFactoryFunction(url); | 124 DOMUIFactoryFunction function = GetDOMUIFactoryFunction(url); |
120 return function ? reinterpret_cast<DOMUITypeID>(function) : kNoDOMUI; | 125 return function ? reinterpret_cast<DOMUITypeID>(function) : kNoDOMUI; |
121 } | 126 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return ExtensionsUI::GetFaviconResourceBytes(); | 165 return ExtensionsUI::GetFaviconResourceBytes(); |
161 | 166 |
162 if (page_url.host() == chrome::kChromeUIHistoryHost) | 167 if (page_url.host() == chrome::kChromeUIHistoryHost) |
163 return HistoryUI::GetFaviconResourceBytes(); | 168 return HistoryUI::GetFaviconResourceBytes(); |
164 | 169 |
165 if (page_url.host() == chrome::kChromeUIPluginsHost) | 170 if (page_url.host() == chrome::kChromeUIPluginsHost) |
166 return PluginsUI::GetFaviconResourceBytes(); | 171 return PluginsUI::GetFaviconResourceBytes(); |
167 | 172 |
168 return NULL; | 173 return NULL; |
169 } | 174 } |
OLD | NEW |