From 76e7da2f3993ed156cc633d84f0c0d8ce3475e47 Mon Sep 17 00:00:00 2001 From: "pkasting@chromium.org" Date: Fri, 18 Jun 2010 22:44:49 +0000 Subject: 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 --- chrome/browser/gtk/bookmark_editor_gtk.cc | 5 ++--- chrome/browser/gtk/options/general_page_gtk.cc | 5 ++--- chrome/browser/gtk/options/url_picker_dialog_gtk.cc | 8 +++----- 3 files changed, 7 insertions(+), 11 deletions(-) (limited to 'chrome/browser/gtk') diff --git a/chrome/browser/gtk/bookmark_editor_gtk.cc b/chrome/browser/gtk/bookmark_editor_gtk.cc index d2de0ae..318ba91 100644 --- a/chrome/browser/gtk/bookmark_editor_gtk.cc +++ b/chrome/browser/gtk/bookmark_editor_gtk.cc @@ -278,9 +278,8 @@ void BookmarkEditorGtk::Reset() { GURL BookmarkEditorGtk::GetInputURL() const { if (!url_entry_) return GURL(); // Happens when we're editing a folder. - - return GURL(URLFixerUpper::FixupURL( - gtk_entry_get_text(GTK_ENTRY(url_entry_)), "")); + return URLFixerUpper::FixupURL(gtk_entry_get_text(GTK_ENTRY(url_entry_)), + std::string()); } std::wstring BookmarkEditorGtk::GetInputTitle() const { diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc index d36fbac..0df5b20 100644 --- a/chrome/browser/gtk/options/general_page_gtk.cc +++ b/chrome/browser/gtk/options/general_page_gtk.cc @@ -650,9 +650,8 @@ void GeneralPageGtk::SetHomepage(const GURL& homepage) { } void GeneralPageGtk::SetHomepageFromEntry() { - GURL url(URLFixerUpper::FixupURL( - gtk_entry_get_text(GTK_ENTRY(homepage_use_url_entry_)), "")); - SetHomepage(url); + SetHomepage(URLFixerUpper::FixupURL( + gtk_entry_get_text(GTK_ENTRY(homepage_use_url_entry_)), std::string())); } void GeneralPageGtk::EnableCustomHomepagesControls(bool enable) { diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc index dd51798..515eb47 100644 --- a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc +++ b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc @@ -180,9 +180,8 @@ UrlPickerDialogGtk::~UrlPickerDialogGtk() { } void UrlPickerDialogGtk::AddURL() { - GURL url(URLFixerUpper::FixupURL( - gtk_entry_get_text(GTK_ENTRY(url_entry_)), "")); - callback_->Run(url); + callback_->Run(URLFixerUpper::FixupURL( + gtk_entry_get_text(GTK_ENTRY(url_entry_)), std::string())); } void UrlPickerDialogGtk::EnableControls() { @@ -263,8 +262,7 @@ void UrlPickerDialogGtk::OnHistorySelectionChanged( void UrlPickerDialogGtk::OnHistoryRowActivated(GtkWidget* tree_view, GtkTreePath* path, GtkTreeViewColumn* column) { - GURL url(URLFixerUpper::FixupURL(GetURLForPath(path), "")); - callback_->Run(url); + callback_->Run(URLFixerUpper::FixupURL(GetURLForPath(path), std::string())); gtk_widget_destroy(dialog_); } -- cgit v1.1