| 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 30 matching lines...) Expand all Loading... |
| 41 // static | 41 // static |
| 42 TabContents* TabContents::CreateWithType(TabContentsType type, | 42 TabContents* TabContents::CreateWithType(TabContentsType type, |
| 43 Profile* profile, | 43 Profile* profile, |
| 44 SiteInstance* instance) { | 44 SiteInstance* instance) { |
| 45 TabContents* contents = NULL; | 45 TabContents* contents = NULL; |
| 46 | 46 |
| 47 switch (type) { | 47 switch (type) { |
| 48 case TAB_CONTENTS_WEB: | 48 case TAB_CONTENTS_WEB: |
| 49 contents = new WebContents(profile, instance, NULL, MSG_ROUTING_NONE, NULL
); | 49 contents = new WebContents(profile, instance, NULL, MSG_ROUTING_NONE, NULL
); |
| 50 break; | 50 break; |
| 51 case TAB_CONTENTS_ABOUT_UI: |
| 52 contents = new BrowserAboutHandler(profile, instance, NULL); |
| 53 break; |
| 51 // 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 |
| 52 // types or removing them completely. | 55 // types or removing them completely. |
| 53 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
| 54 case TAB_CONTENTS_HTML_DIALOG: | 57 case TAB_CONTENTS_HTML_DIALOG: |
| 55 contents = new HtmlDialogContents(profile, instance, NULL); | 58 contents = new HtmlDialogContents(profile, instance, NULL); |
| 56 break; | 59 break; |
| 57 case TAB_CONTENTS_NATIVE_UI: | 60 case TAB_CONTENTS_NATIVE_UI: |
| 58 contents = new NativeUIContents(profile); | 61 contents = new NativeUIContents(profile); |
| 59 break; | 62 break; |
| 60 case TAB_CONTENTS_ABOUT_UI: | |
| 61 contents = new BrowserAboutHandler(profile, instance, NULL); | |
| 62 break; | |
| 63 case TAB_CONTENTS_DEBUGGER: | 63 case TAB_CONTENTS_DEBUGGER: |
| 64 case TAB_CONTENTS_NEW_TAB_UI: | 64 case TAB_CONTENTS_NEW_TAB_UI: |
| 65 case TAB_CONTENTS_DOM_UI: | 65 case TAB_CONTENTS_DOM_UI: |
| 66 contents = new DOMUIContents(profile, instance, NULL); | 66 contents = new DOMUIContents(profile, instance, NULL); |
| 67 break; | 67 break; |
| 68 #endif // defined(OS_WIN) | 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()) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 117 |
| 118 #elif defined(OS_POSIX) | 118 #elif defined(OS_POSIX) |
| 119 TabContentsType type(TAB_CONTENTS_UNKNOWN_TYPE); |
| 120 if (BrowserURLHandler::HandleBrowserURL(url, &type) && |
| 121 type == TAB_CONTENTS_ABOUT_UI) { |
| 122 return type; |
| 123 } |
| 119 NOTIMPLEMENTED(); | 124 NOTIMPLEMENTED(); |
| 120 #endif | 125 #endif |
| 121 | 126 |
| 122 // NOTE: Even the empty string can be loaded by a WebContents. | 127 // NOTE: Even the empty string can be loaded by a WebContents. |
| 123 return TAB_CONTENTS_WEB; | 128 return TAB_CONTENTS_WEB; |
| 124 } | 129 } |
| 125 | 130 |
| 126 // static | 131 // static |
| 127 TabContentsFactory* TabContents::RegisterFactory(TabContentsType type, | 132 TabContentsFactory* TabContents::RegisterFactory(TabContentsType type, |
| 128 TabContentsFactory* factory) { | 133 TabContentsFactory* factory) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 140 g_extra_types->erase(type); | 145 g_extra_types->erase(type); |
| 141 if (g_extra_types->empty()) { | 146 if (g_extra_types->empty()) { |
| 142 delete g_extra_types; | 147 delete g_extra_types; |
| 143 g_extra_types = NULL; | 148 g_extra_types = NULL; |
| 144 } | 149 } |
| 145 } | 150 } |
| 146 | 151 |
| 147 return prev_factory; | 152 return prev_factory; |
| 148 } | 153 } |
| 149 | 154 |
| OLD | NEW |