| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tab_contents.h" | 5 #include "chrome/browser/tab_contents.h" |
| 6 | 6 |
| 7 #include "chrome/browser/about_internets_status_view.h" | 7 #include "chrome/browser/about_internets_status_view.h" |
| 8 #include "chrome/browser/browser_about_handler.h" | 8 #include "chrome/browser/browser_about_handler.h" |
| 9 #include "chrome/browser/browser_url_handler.h" | 9 #include "chrome/browser/browser_url_handler.h" |
| 10 #include "chrome/browser/dom_ui/dom_ui_contents.h" |
| 10 #include "chrome/browser/dom_ui/html_dialog_contents.h" | 11 #include "chrome/browser/dom_ui/html_dialog_contents.h" |
| 11 #include "chrome/browser/dom_ui/new_tab_ui.h" | 12 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 12 #include "chrome/browser/ipc_status_view.h" | 13 #include "chrome/browser/ipc_status_view.h" |
| 13 #include "chrome/browser/native_ui_contents.h" | 14 #include "chrome/browser/native_ui_contents.h" |
| 14 #include "chrome/browser/network_status_view.h" | 15 #include "chrome/browser/network_status_view.h" |
| 15 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
| 16 #include "chrome/browser/render_process_host.h" | 17 #include "chrome/browser/render_process_host.h" |
| 17 #include "chrome/browser/debugger/debugger_contents.h" | 18 #include "chrome/browser/debugger/debugger_contents.h" |
| 18 #include "chrome/browser/tab_contents_factory.h" | 19 #include "chrome/browser/tab_contents_factory.h" |
| 19 #include "chrome/browser/view_source_contents.h" | 20 #include "chrome/browser/view_source_contents.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 break; | 69 break; |
| 69 case TAB_CONTENTS_VIEW_SOURCE: | 70 case TAB_CONTENTS_VIEW_SOURCE: |
| 70 contents = new ViewSourceContents(profile, instance); | 71 contents = new ViewSourceContents(profile, instance); |
| 71 break; | 72 break; |
| 72 case TAB_CONTENTS_ABOUT_UI: | 73 case TAB_CONTENTS_ABOUT_UI: |
| 73 contents = new BrowserAboutHandler(profile, instance, NULL); | 74 contents = new BrowserAboutHandler(profile, instance, NULL); |
| 74 break; | 75 break; |
| 75 case TAB_CONTENTS_DEBUGGER: | 76 case TAB_CONTENTS_DEBUGGER: |
| 76 contents = new DebuggerContents(profile, instance); | 77 contents = new DebuggerContents(profile, instance); |
| 77 break; | 78 break; |
| 79 case TAB_CONTENTS_DOM_UI: |
| 80 contents = new DOMUIContents(profile, instance, NULL); |
| 81 break; |
| 78 default: | 82 default: |
| 79 if (g_extra_types) { | 83 if (g_extra_types) { |
| 80 TabContentsFactoryMap::const_iterator it = g_extra_types->find(type); | 84 TabContentsFactoryMap::const_iterator it = g_extra_types->find(type); |
| 81 if (it != g_extra_types->end()) { | 85 if (it != g_extra_types->end()) { |
| 82 contents = it->second->CreateInstance(); | 86 contents = it->second->CreateInstance(); |
| 83 break; | 87 break; |
| 84 } | 88 } |
| 85 } | 89 } |
| 86 NOTREACHED() << "Don't know how to create tab contents of type " << type; | 90 NOTREACHED() << "Don't know how to create tab contents of type " << type; |
| 87 contents = NULL; | 91 contents = NULL; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 112 | 116 |
| 113 if (url->SchemeIs(NativeUIContents::GetScheme().c_str())) | 117 if (url->SchemeIs(NativeUIContents::GetScheme().c_str())) |
| 114 return TAB_CONTENTS_NATIVE_UI; | 118 return TAB_CONTENTS_NATIVE_UI; |
| 115 | 119 |
| 116 if (HtmlDialogContents::IsHtmlDialogUrl(*url)) | 120 if (HtmlDialogContents::IsHtmlDialogUrl(*url)) |
| 117 return TAB_CONTENTS_HTML_DIALOG; | 121 return TAB_CONTENTS_HTML_DIALOG; |
| 118 | 122 |
| 119 if (DebuggerContents::IsDebuggerUrl(*url)) | 123 if (DebuggerContents::IsDebuggerUrl(*url)) |
| 120 return TAB_CONTENTS_DEBUGGER; | 124 return TAB_CONTENTS_DEBUGGER; |
| 121 | 125 |
| 126 if (url->SchemeIs(DOMUIContents::GetScheme().c_str())) |
| 127 return TAB_CONTENTS_DOM_UI; |
| 128 |
| 122 if (url->SchemeIs("view-source")) { | 129 if (url->SchemeIs("view-source")) { |
| 123 // Load the inner URL instead, but render it using a ViewSourceContents. | 130 // Load the inner URL instead, but render it using a ViewSourceContents. |
| 124 *url = GURL(url->path()); | 131 *url = GURL(url->path()); |
| 125 return TAB_CONTENTS_VIEW_SOURCE; | 132 return TAB_CONTENTS_VIEW_SOURCE; |
| 126 } | 133 } |
| 127 | 134 |
| 128 // NOTE: Even the empty string can be loaded by a WebContents. | 135 // NOTE: Even the empty string can be loaded by a WebContents. |
| 129 return TAB_CONTENTS_WEB; | 136 return TAB_CONTENTS_WEB; |
| 130 } | 137 } |
| 131 | 138 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 146 g_extra_types->erase(type); | 153 g_extra_types->erase(type); |
| 147 if (g_extra_types->empty()) { | 154 if (g_extra_types->empty()) { |
| 148 delete g_extra_types; | 155 delete g_extra_types; |
| 149 g_extra_types = NULL; | 156 g_extra_types = NULL; |
| 150 } | 157 } |
| 151 } | 158 } |
| 152 | 159 |
| 153 return prev_factory; | 160 return prev_factory; |
| 154 } | 161 } |
| 155 | 162 |
| OLD | NEW |