diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-18 22:44:49 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-18 22:44:49 +0000 |
commit | 76e7da2f3993ed156cc633d84f0c0d8ce3475e47 (patch) | |
tree | 0bf83bcc78d1c22ce608289415d1bcd39761694c /chrome/browser/browser.cc | |
parent | 2f1412eee183dfb9e04777827aae4a8766fc9f45 (diff) | |
download | chromium_src-76e7da2f3993ed156cc633d84f0c0d8ce3475e47.zip chromium_src-76e7da2f3993ed156cc633d84f0c0d8ce3475e47.tar.gz chromium_src-76e7da2f3993ed156cc633d84f0c0d8ce3475e47.tar.bz2 |
Make FixupURL() return a GURL instead of a string (i.e. do fixup + canonicalization). Nearly every caller was already doing this.
This in turn allows us to do better fixup/canonicalization of view-source: URLs. We now convert "view-source:google.com" into "view-source:http://google.com/".
With a few changes scattered through the omnibox code, this also means we can do HTTP-stripping on view-source: URLs, and support the user typing in things like the case above. This also fixes some weirdness where if you tried to type something starting with "view-source:", the What You Typed match in the dropdown would show only a scheme, or a scheme plus "http:", in some cases.
BUG=46612
TEST="view-source:google.com" should work.
Review URL: http://codereview.chromium.org/2817011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50290 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 53f9cf8..d3e481c 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1438,8 +1438,8 @@ void Browser::ViewSource() { TabContents* current_tab = GetSelectedTabContents(); NavigationEntry* entry = current_tab->controller().GetLastCommittedEntry(); if (entry) { - GURL url("view-source:" + entry->url().spec()); - OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); + OpenURL(GURL(chrome::kViewSourceScheme + std::string(":") + + entry->url().spec()), GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); } } @@ -3828,17 +3828,15 @@ GURL Browser::GetHomePage() const { if (command_line.HasSwitch(switches::kHomePage)) { FilePath browser_directory; PathService::Get(base::DIR_CURRENT, &browser_directory); - std::string new_homepage = URLFixerUpper::FixupRelativeFile( - browser_directory, - command_line.GetSwitchValuePath(switches::kHomePage)); - GURL home_page = GURL(new_homepage); + GURL home_page(URLFixerUpper::FixupRelativeFile(browser_directory, + command_line.GetSwitchValuePath(switches::kHomePage))); if (home_page.is_valid()) return home_page; } if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) return GURL(chrome::kChromeUINewTabURL); - GURL home_page = GURL(URLFixerUpper::FixupURL( + GURL home_page(URLFixerUpper::FixupURL( WideToUTF8(profile_->GetPrefs()->GetString(prefs::kHomePage)), std::string())); if (!home_page.is_valid()) |