| 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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 *new_ui = new HtmlDialogUI(tab_contents); | 35 *new_ui = new HtmlDialogUI(tab_contents); |
| 36 return true; | 36 return true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 if (url.SchemeIs(chrome::kExtensionScheme)) { | 39 if (url.SchemeIs(chrome::kExtensionScheme)) { |
| 40 if (new_ui) | 40 if (new_ui) |
| 41 *new_ui = new ExtensionDOMUI(tab_contents); | 41 *new_ui = new ExtensionDOMUI(tab_contents); |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // TODO(mhm) Make sure this ifdef is removed once print is complete. |
| 46 #if !defined(GOOGLE_CHROME_BUILD) |
| 45 if (url.SchemeIs(chrome::kPrintScheme)) { | 47 if (url.SchemeIs(chrome::kPrintScheme)) { |
| 46 if (new_ui) | 48 if (new_ui) |
| 47 *new_ui = new PrintUI(tab_contents); | 49 *new_ui = new PrintUI(tab_contents); |
| 48 return true; | 50 return true; |
| 49 } | 51 } |
| 52 #endif |
| 50 | 53 |
| 51 #ifdef CHROME_PERSONALIZATION | 54 #ifdef CHROME_PERSONALIZATION |
| 52 if (Personalization::NeedsDOMUI(url)) { | 55 if (Personalization::NeedsDOMUI(url)) { |
| 53 if (new_ui) | 56 if (new_ui) |
| 54 *new_ui = new HtmlDialogUI(tab_contents); | 57 *new_ui = new HtmlDialogUI(tab_contents); |
| 55 return true; | 58 return true; |
| 56 } | 59 } |
| 57 #endif | 60 #endif |
| 58 | 61 |
| 59 // This will get called a lot to check all URLs, so do a quick check of other | 62 // This will get called a lot to check all URLs, so do a quick check of other |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 return true; | 102 return true; |
| 100 } | 103 } |
| 101 | 104 |
| 102 return false; | 105 return false; |
| 103 } | 106 } |
| 104 | 107 |
| 105 // static | 108 // static |
| 106 bool DOMUIFactory::HasDOMUIScheme(const GURL& url) { | 109 bool DOMUIFactory::HasDOMUIScheme(const GURL& url) { |
| 107 return url.SchemeIs(chrome::kChromeInternalScheme) || | 110 return url.SchemeIs(chrome::kChromeInternalScheme) || |
| 108 url.SchemeIs(chrome::kChromeUIScheme) || | 111 url.SchemeIs(chrome::kChromeUIScheme) || |
| 109 url.SchemeIs(chrome::kExtensionScheme); | 112 url.SchemeIs(chrome::kExtensionScheme) || |
| 113 url.SchemeIs(chrome::kPrintScheme); |
| 110 } | 114 } |
| 111 | 115 |
| 112 // static | 116 // static |
| 113 bool DOMUIFactory::UseDOMUIForURL(const GURL& url) { | 117 bool DOMUIFactory::UseDOMUIForURL(const GURL& url) { |
| 114 return CreateDOMUI(url, NULL, NULL); | 118 return CreateDOMUI(url, NULL, NULL); |
| 115 } | 119 } |
| 116 | 120 |
| 117 // static | 121 // static |
| 118 DOMUI* DOMUIFactory::CreateDOMUIForURL(TabContents* tab_contents, | 122 DOMUI* DOMUIFactory::CreateDOMUIForURL(TabContents* tab_contents, |
| 119 const GURL& url) { | 123 const GURL& url) { |
| 120 DOMUI* dom_ui; | 124 DOMUI* dom_ui; |
| 121 if (!CreateDOMUI(url, tab_contents, &dom_ui)) | 125 if (!CreateDOMUI(url, tab_contents, &dom_ui)) |
| 122 return NULL; | 126 return NULL; |
| 123 return dom_ui; | 127 return dom_ui; |
| 124 } | 128 } |
| OLD | NEW |