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/downloads_ui.h" | 7 #include "chrome/browser/dom_ui/downloads_ui.h" |
8 #include "chrome/browser/dom_ui/devtools_ui.h" | 8 #include "chrome/browser/dom_ui/devtools_ui.h" |
9 #include "chrome/browser/dom_ui/history_ui.h" | 9 #include "chrome/browser/dom_ui/history_ui.h" |
10 #include "chrome/browser/dom_ui/html_dialog_ui.h" | 10 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
11 #include "chrome/browser/dom_ui/new_tab_ui.h" | 11 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 12 #include "chrome/browser/dom_ui/print_ui.h" |
12 #include "chrome/browser/extensions/extensions_ui.h" | 13 #include "chrome/browser/extensions/extensions_ui.h" |
13 #include "chrome/browser/extensions/extension_dom_ui.h" | 14 #include "chrome/browser/extensions/extension_dom_ui.h" |
14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
15 #ifdef CHROME_PERSONALIZATION | 16 #ifdef CHROME_PERSONALIZATION |
16 #include "chrome/personalization/personalization.h" | 17 #include "chrome/personalization/personalization.h" |
17 #endif | 18 #endif |
18 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
19 | 20 |
20 // Backend for both querying for and creating new DOMUI objects. If you're just | 21 // Backend for both querying for and creating new DOMUI objects. If you're just |
21 // querying whether there's a DOM UI for the given URL, pass NULL for both the | 22 // querying whether there's a DOM UI for the given URL, pass NULL for both the |
(...skipping 12 matching lines...) Expand all Loading... |
34 *new_ui = new HtmlDialogUI(tab_contents); | 35 *new_ui = new HtmlDialogUI(tab_contents); |
35 return true; | 36 return true; |
36 } | 37 } |
37 | 38 |
38 if (url.SchemeIs(chrome::kExtensionScheme)) { | 39 if (url.SchemeIs(chrome::kExtensionScheme)) { |
39 if (new_ui) | 40 if (new_ui) |
40 *new_ui = new ExtensionDOMUI(tab_contents); | 41 *new_ui = new ExtensionDOMUI(tab_contents); |
41 return true; | 42 return true; |
42 } | 43 } |
43 | 44 |
| 45 if (url.SchemeIs(chrome::kPrintScheme)) { |
| 46 if (new_ui) |
| 47 *new_ui = new PrintUI(tab_contents); |
| 48 return true; |
| 49 } |
| 50 |
44 #ifdef CHROME_PERSONALIZATION | 51 #ifdef CHROME_PERSONALIZATION |
45 if (Personalization::NeedsDOMUI(url)) { | 52 if (Personalization::NeedsDOMUI(url)) { |
46 if (new_ui) | 53 if (new_ui) |
47 *new_ui = new HtmlDialogUI(tab_contents); | 54 *new_ui = new HtmlDialogUI(tab_contents); |
48 return true; | 55 return true; |
49 } | 56 } |
50 #endif | 57 #endif |
51 | 58 |
52 // This will get called a lot to check all URLs, so do a quick check of other | 59 // This will get called a lot to check all URLs, so do a quick check of other |
53 // schemes (gears was handled above) to filter out most URLs. | 60 // schemes (gears was handled above) to filter out most URLs. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 115 } |
109 | 116 |
110 // static | 117 // static |
111 DOMUI* DOMUIFactory::CreateDOMUIForURL(TabContents* tab_contents, | 118 DOMUI* DOMUIFactory::CreateDOMUIForURL(TabContents* tab_contents, |
112 const GURL& url) { | 119 const GURL& url) { |
113 DOMUI* dom_ui; | 120 DOMUI* dom_ui; |
114 if (!CreateDOMUI(url, tab_contents, &dom_ui)) | 121 if (!CreateDOMUI(url, tab_contents, &dom_ui)) |
115 return NULL; | 122 return NULL; |
116 return dom_ui; | 123 return dom_ui; |
117 } | 124 } |
OLD | NEW |