| 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 "base/string_util.h" | 5 #include "base/string_util.h" |
| 6 #include "chrome/browser/browser_about_handler.h" | 6 #include "chrome/browser/browser_about_handler.h" |
| 7 #include "chrome/browser/browser_url_handler.h" | 7 #include "chrome/browser/browser_url_handler.h" |
| 8 #include "chrome/browser/dom_ui/dom_ui_contents.h" | 8 #include "chrome/browser/dom_ui/dom_ui_contents.h" |
| 9 #include "chrome/browser/dom_ui/new_tab_ui.h" | 9 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 break; | 53 break; |
| 54 // TODO(port): remove this platform define, either by porting the tab contents | 54 // TODO(port): remove this platform define, either by porting the tab contents |
| 55 // types or removing them completely. | 55 // types or removing them completely. |
| 56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
| 57 case TAB_CONTENTS_HTML_DIALOG: | 57 case TAB_CONTENTS_HTML_DIALOG: |
| 58 contents = new HtmlDialogContents(profile, instance, NULL); | 58 contents = new HtmlDialogContents(profile, instance, NULL); |
| 59 break; | 59 break; |
| 60 case TAB_CONTENTS_NATIVE_UI: | 60 case TAB_CONTENTS_NATIVE_UI: |
| 61 contents = new NativeUIContents(profile); | 61 contents = new NativeUIContents(profile); |
| 62 break; | 62 break; |
| 63 #endif // defined(OS_WIN) |
| 63 case TAB_CONTENTS_DEBUGGER: | 64 case TAB_CONTENTS_DEBUGGER: |
| 64 case TAB_CONTENTS_NEW_TAB_UI: | 65 case TAB_CONTENTS_NEW_TAB_UI: |
| 65 case TAB_CONTENTS_DOM_UI: | 66 case TAB_CONTENTS_DOM_UI: |
| 66 contents = new DOMUIContents(profile, instance, NULL); | 67 contents = new DOMUIContents(profile, instance, NULL); |
| 67 break; | 68 break; |
| 68 #endif // defined(OS_WIN) | |
| 69 default: | 69 default: |
| 70 if (g_extra_types) { | 70 if (g_extra_types) { |
| 71 TabContentsFactoryMap::const_iterator it = g_extra_types->find(type); | 71 TabContentsFactoryMap::const_iterator it = g_extra_types->find(type); |
| 72 if (it != g_extra_types->end()) { | 72 if (it != g_extra_types->end()) { |
| 73 contents = it->second->CreateInstance(); | 73 contents = it->second->CreateInstance(); |
| 74 break; | 74 break; |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 NOTREACHED() << "Don't know how to create tab contents of type " << type; | 77 NOTREACHED() << "Don't know how to create tab contents of type " << type; |
| 78 contents = NULL; | 78 contents = NULL; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 107 return TAB_CONTENTS_NATIVE_UI; | 107 return TAB_CONTENTS_NATIVE_UI; |
| 108 | 108 |
| 109 if (HtmlDialogContents::IsHtmlDialogUrl(*url)) | 109 if (HtmlDialogContents::IsHtmlDialogUrl(*url)) |
| 110 return TAB_CONTENTS_HTML_DIALOG; | 110 return TAB_CONTENTS_HTML_DIALOG; |
| 111 | 111 |
| 112 if (DebuggerContents::IsDebuggerUrl(*url)) | 112 if (DebuggerContents::IsDebuggerUrl(*url)) |
| 113 return TAB_CONTENTS_DEBUGGER; | 113 return TAB_CONTENTS_DEBUGGER; |
| 114 | 114 |
| 115 if (url->SchemeIs(DOMUIContents::GetScheme().c_str())) | 115 if (url->SchemeIs(DOMUIContents::GetScheme().c_str())) |
| 116 return TAB_CONTENTS_DOM_UI; | 116 return TAB_CONTENTS_DOM_UI; |
| 117 | |
| 118 #elif defined(OS_POSIX) | 117 #elif defined(OS_POSIX) |
| 119 TabContentsType type(TAB_CONTENTS_UNKNOWN_TYPE); | 118 TabContentsType type(TAB_CONTENTS_UNKNOWN_TYPE); |
| 120 if (BrowserURLHandler::HandleBrowserURL(url, &type) && | 119 if (BrowserURLHandler::HandleBrowserURL(url, &type) && |
| 121 type == TAB_CONTENTS_ABOUT_UI) { | 120 type == TAB_CONTENTS_ABOUT_UI) { |
| 122 return type; | 121 return type; |
| 123 } | 122 } |
| 123 if (url->SchemeIs(DOMUIContents::GetScheme().c_str())) |
| 124 return TAB_CONTENTS_DOM_UI; |
| 124 NOTIMPLEMENTED(); | 125 NOTIMPLEMENTED(); |
| 125 #endif | 126 #endif |
| 126 | 127 |
| 127 // NOTE: Even the empty string can be loaded by a WebContents. | 128 // NOTE: Even the empty string can be loaded by a WebContents. |
| 128 return TAB_CONTENTS_WEB; | 129 return TAB_CONTENTS_WEB; |
| 129 } | 130 } |
| 130 | 131 |
| 131 // static | 132 // static |
| 132 TabContentsFactory* TabContents::RegisterFactory(TabContentsType type, | 133 TabContentsFactory* TabContents::RegisterFactory(TabContentsType type, |
| 133 TabContentsFactory* factory) { | 134 TabContentsFactory* factory) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 145 g_extra_types->erase(type); | 146 g_extra_types->erase(type); |
| 146 if (g_extra_types->empty()) { | 147 if (g_extra_types->empty()) { |
| 147 delete g_extra_types; | 148 delete g_extra_types; |
| 148 g_extra_types = NULL; | 149 g_extra_types = NULL; |
| 149 } | 150 } |
| 150 } | 151 } |
| 151 | 152 |
| 152 return prev_factory; | 153 return prev_factory; |
| 153 } | 154 } |
| 154 | 155 |
| OLD | NEW |