diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 23:55:06 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 23:55:06 +0000 |
commit | cd3d789910d9bbd81c2a08eee26bffc4ae10ab52 (patch) | |
tree | 2d640336dd883be4f375540ea6573ede6fd3e732 /chrome/browser/tab_contents | |
parent | 90f6e2e8b787268630fcecddd7542e1bfb587ab3 (diff) | |
download | chromium_src-cd3d789910d9bbd81c2a08eee26bffc4ae10ab52.zip chromium_src-cd3d789910d9bbd81c2a08eee26bffc4ae10ab52.tar.gz chromium_src-cd3d789910d9bbd81c2a08eee26bffc4ae10ab52.tar.bz2 |
Clean up the browser about URL handler to not derive from WebContents. It is
instead integrated in the BrowserURLHandler for special schemes. This solves
a number of problems and cleans things up nicely.
Most of the functions were not necessary to have in the header file of the
browser about handler, so I made them local to the .cc file. I moved everything
around, but there was no change to any of the About...() functions.
This improves the about:memory page to not include the memory of the new tab
page it replaced. The entry for itself also has the proper title. This works
by using a meta refresh to the actual page, the the process transition no longer
happens at the same time as the about:memory page computation.
This also fixes problems with the about:network and about:ipc dialogs opening
blank pages and also re-opening the dialog when you close the browser.
Review URL: http://codereview.chromium.org/27238
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
4 files changed, 16 insertions, 17 deletions
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index 374b1804..850a865 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -7,6 +7,7 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" +#include "chrome/browser/browser_about_handler.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/dom_ui/dom_ui_host.h" #include "chrome/browser/sessions/session_types.h" @@ -55,7 +56,6 @@ void SetContentStateIfEmpty(NavigationEntry* entry) { (entry->tab_type() == TAB_CONTENTS_WEB || entry->tab_type() == TAB_CONTENTS_NEW_TAB_UI || entry->tab_type() == TAB_CONTENTS_DOM_UI || - entry->tab_type() == TAB_CONTENTS_ABOUT_UI || entry->tab_type() == TAB_CONTENTS_HTML_DIALOG || entry->IsViewSourceMode())) { entry->set_content_state( @@ -247,6 +247,11 @@ NavigationEntry* NavigationController::GetEntryWithPageID( } void NavigationController::LoadEntry(NavigationEntry* entry) { + // Handle non-navigational URLs that popup dialogs and such, these should not + // actually navigate. + if (HandleNonNavigationAboutURL(entry->url())) + return; + // When navigating to a new page, we don't know for sure if we will actually // end up leaving the current page. The new page load could for example // result in a download or a 'no content' response (e.g., a mailto: URL). @@ -463,17 +468,15 @@ NavigationEntry* NavigationController::CreateNavigationEntry( // If the active contents supports |url|, use it. // Note: in both cases, we give TabContents a chance to rewrite the URL. + // + // TODO(brettw): The BrowserURLHandler::HandleBrowserURL call should just be + // moved here from inside TypeForURL once the tab contents types are removed. TabContents* active = active_contents(); if (active && active->SupportsURL(&real_url)) type = active->type(); else type = TabContents::TypeForURL(&real_url); - - if (url.SchemeIs(chrome::kViewSourceScheme)) { - // Load the inner URL instead, setting the original URL as the "display". - real_url = GURL(url.path()); - } - + NavigationEntry* entry = new NavigationEntry(type, NULL, -1, real_url, referrer, string16(), transition); diff --git a/chrome/browser/tab_contents/navigation_entry.h b/chrome/browser/tab_contents/navigation_entry.h index 9cad672..55ed4f3 100644 --- a/chrome/browser/tab_contents/navigation_entry.h +++ b/chrome/browser/tab_contents/navigation_entry.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_NAVIGATION_ENTRY_H_ -#define CHROME_BROWSER_NAVIGATION_ENTRY_H_ +#ifndef CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ +#define CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ #include "base/basictypes.h" #include "base/scoped_ptr.h" @@ -407,4 +407,4 @@ class NavigationEntry { // Copy and assignment is explicitly allowed for this class. }; -#endif // CHROME_BROWSER_NAVIGATION_ENTRY_H_ +#endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_ENTRY_H_ diff --git a/chrome/browser/tab_contents/tab_contents_factory.cc b/chrome/browser/tab_contents/tab_contents_factory.cc index 0226b4f..01db2d1 100644 --- a/chrome/browser/tab_contents/tab_contents_factory.cc +++ b/chrome/browser/tab_contents/tab_contents_factory.cc @@ -47,9 +47,6 @@ TabContents* TabContents::CreateWithType(TabContentsType type, case TAB_CONTENTS_WEB: contents = new WebContents(profile, instance, NULL, MSG_ROUTING_NONE, NULL); break; - case TAB_CONTENTS_ABOUT_UI: - contents = new BrowserAboutHandler(profile, instance, NULL); - break; // TODO(port): remove this platform define, either by porting the tab contents // types or removing them completely. #if defined(OS_WIN) @@ -82,6 +79,8 @@ TabContents* TabContents::CreateWithType(TabContentsType type, // static TabContentsType TabContents::TypeForURL(GURL* url) { + // The BrowserURLHandler::HandleBrowserURL call should just be inside the + // NavigationController once this class is deleted. DCHECK(url); if (g_extra_types) { TabContentsFactoryMap::const_iterator it = g_extra_types->begin(); @@ -109,8 +108,7 @@ TabContentsType TabContents::TypeForURL(GURL* url) { return TAB_CONTENTS_DOM_UI; #elif defined(OS_POSIX) TabContentsType type(TAB_CONTENTS_UNKNOWN_TYPE); - if (BrowserURLHandler::HandleBrowserURL(url, &type) && - type == TAB_CONTENTS_ABOUT_UI) { + if (BrowserURLHandler::HandleBrowserURL(url, &type)) { return type; } if (url->SchemeIs(DOMUIContents::GetScheme().c_str())) diff --git a/chrome/browser/tab_contents/tab_contents_type.h b/chrome/browser/tab_contents/tab_contents_type.h index 9955258..517e5a9 100644 --- a/chrome/browser/tab_contents/tab_contents_type.h +++ b/chrome/browser/tab_contents/tab_contents_type.h @@ -12,11 +12,9 @@ enum TabContentsType { TAB_CONTENTS_UNKNOWN_TYPE = 0, TAB_CONTENTS_WEB, - TAB_CONTENTS_DOWNLOAD_VIEW, TAB_CONTENTS_CHROME_VIEW_CONTENTS, TAB_CONTENTS_NEW_TAB_UI, TAB_CONTENTS_HTML_DIALOG, - TAB_CONTENTS_ABOUT_UI, TAB_CONTENTS_DEBUGGER, TAB_CONTENTS_DOM_UI, TAB_CONTENTS_NUM_TYPES |