Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: chrome/browser/tab_contents/tab_contents_factory.cc

Issue 27238: Clean up some style and organization in the browser about handler. No code... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 29 matching lines...) Expand all
40 // static 40 // static
41 TabContents* TabContents::CreateWithType(TabContentsType type, 41 TabContents* TabContents::CreateWithType(TabContentsType type,
42 Profile* profile, 42 Profile* profile,
43 SiteInstance* instance) { 43 SiteInstance* instance) {
44 TabContents* contents = NULL; 44 TabContents* contents = NULL;
45 45
46 switch (type) { 46 switch (type) {
47 case TAB_CONTENTS_WEB: 47 case TAB_CONTENTS_WEB:
48 contents = new WebContents(profile, instance, NULL, MSG_ROUTING_NONE, NULL ); 48 contents = new WebContents(profile, instance, NULL, MSG_ROUTING_NONE, NULL );
49 break; 49 break;
50 case TAB_CONTENTS_ABOUT_UI:
51 contents = new BrowserAboutHandler(profile, instance, NULL);
52 break;
53 // TODO(port): remove this platform define, either by porting the tab contents 50 // TODO(port): remove this platform define, either by porting the tab contents
54 // types or removing them completely. 51 // types or removing them completely.
55 #if defined(OS_WIN) 52 #if defined(OS_WIN)
56 case TAB_CONTENTS_HTML_DIALOG: 53 case TAB_CONTENTS_HTML_DIALOG:
57 contents = new HtmlDialogContents(profile, instance, NULL); 54 contents = new HtmlDialogContents(profile, instance, NULL);
58 break; 55 break;
59 #endif // defined(OS_WIN) 56 #endif // defined(OS_WIN)
60 case TAB_CONTENTS_DEBUGGER: 57 case TAB_CONTENTS_DEBUGGER:
61 case TAB_CONTENTS_NEW_TAB_UI: 58 case TAB_CONTENTS_NEW_TAB_UI:
62 case TAB_CONTENTS_DOM_UI: 59 case TAB_CONTENTS_DOM_UI:
(...skipping 12 matching lines...) Expand all
75 } 72 }
76 73
77 if (contents) 74 if (contents)
78 contents->CreateView(); 75 contents->CreateView();
79 76
80 return contents; 77 return contents;
81 } 78 }
82 79
83 // static 80 // static
84 TabContentsType TabContents::TypeForURL(GURL* url) { 81 TabContentsType TabContents::TypeForURL(GURL* url) {
82 // The BrowserURLHandler::HandleBrowserURL call should just be inside the
83 // NavigationController once this class is deleted.
85 DCHECK(url); 84 DCHECK(url);
86 if (g_extra_types) { 85 if (g_extra_types) {
87 TabContentsFactoryMap::const_iterator it = g_extra_types->begin(); 86 TabContentsFactoryMap::const_iterator it = g_extra_types->begin();
88 for (; it != g_extra_types->end(); ++it) { 87 for (; it != g_extra_types->end(); ++it) {
89 if (it->second->CanHandleURL(*url)) 88 if (it->second->CanHandleURL(*url))
90 return it->first; 89 return it->first;
91 } 90 }
92 } 91 }
93 92
94 // TODO(port): port the rest of this function. 93 // TODO(port): port the rest of this function.
95 #if defined(OS_WIN) 94 #if defined(OS_WIN)
96 // Try to handle as a browser URL. If successful, |url| will end up 95 // Try to handle as a browser URL. If successful, |url| will end up
97 // containing the real url being loaded (browser url's are just an alias). 96 // containing the real url being loaded (browser url's are just an alias).
98 TabContentsType type(TAB_CONTENTS_UNKNOWN_TYPE); 97 TabContentsType type(TAB_CONTENTS_UNKNOWN_TYPE);
99 if (BrowserURLHandler::HandleBrowserURL(url, &type)) 98 if (BrowserURLHandler::HandleBrowserURL(url, &type))
100 return type; 99 return type;
101 100
102 if (HtmlDialogContents::IsHtmlDialogUrl(*url)) 101 if (HtmlDialogContents::IsHtmlDialogUrl(*url))
103 return TAB_CONTENTS_HTML_DIALOG; 102 return TAB_CONTENTS_HTML_DIALOG;
104 103
105 if (DebuggerContents::IsDebuggerUrl(*url)) 104 if (DebuggerContents::IsDebuggerUrl(*url))
106 return TAB_CONTENTS_DEBUGGER; 105 return TAB_CONTENTS_DEBUGGER;
107 106
108 if (url->SchemeIs(DOMUIContents::GetScheme().c_str())) 107 if (url->SchemeIs(DOMUIContents::GetScheme().c_str()))
109 return TAB_CONTENTS_DOM_UI; 108 return TAB_CONTENTS_DOM_UI;
110 #elif defined(OS_POSIX) 109 #elif defined(OS_POSIX)
111 TabContentsType type(TAB_CONTENTS_UNKNOWN_TYPE); 110 TabContentsType type(TAB_CONTENTS_UNKNOWN_TYPE);
112 if (BrowserURLHandler::HandleBrowserURL(url, &type) && 111 if (BrowserURLHandler::HandleBrowserURL(url, &type)) {
113 type == TAB_CONTENTS_ABOUT_UI) {
114 return type; 112 return type;
115 } 113 }
116 if (url->SchemeIs(DOMUIContents::GetScheme().c_str())) 114 if (url->SchemeIs(DOMUIContents::GetScheme().c_str()))
117 return TAB_CONTENTS_DOM_UI; 115 return TAB_CONTENTS_DOM_UI;
118 NOTIMPLEMENTED(); 116 NOTIMPLEMENTED();
119 #endif 117 #endif
120 118
121 // NOTE: Even the empty string can be loaded by a WebContents. 119 // NOTE: Even the empty string can be loaded by a WebContents.
122 return TAB_CONTENTS_WEB; 120 return TAB_CONTENTS_WEB;
123 } 121 }
(...skipping 15 matching lines...) Expand all
139 g_extra_types->erase(type); 137 g_extra_types->erase(type);
140 if (g_extra_types->empty()) { 138 if (g_extra_types->empty()) {
141 delete g_extra_types; 139 delete g_extra_types;
142 g_extra_types = NULL; 140 g_extra_types = NULL;
143 } 141 }
144 } 142 }
145 143
146 return prev_factory; 144 return prev_factory;
147 } 145 }
148 146
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/navigation_entry.h ('k') | chrome/browser/tab_contents/tab_contents_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698