From 59f6749a6df399704ac85485f8c7864b771daa58 Mon Sep 17 00:00:00 2001 From: "viettrungluu@chromium.org" Date: Fri, 2 Apr 2010 19:30:57 +0000 Subject: Mac cleanup: avoid double-conversion of URL string. BUG=none TEST=home page text field in prefs continues to work as before Review URL: http://codereview.chromium.org/1529011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43509 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/preferences_window_controller.mm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'chrome') diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index d59d043..a45ac00 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -1128,12 +1128,11 @@ enum { kHomepageNewTabPage, kHomepageURL }; // If the text field contains a valid URL, sync it to prefs. We run it // through the fixer upper to allow input like "google.com" to be converted // to something valid ("http://google.com"). - if (!urlString) - urlString = [NSString stringWithFormat:@"%s", chrome::kChromeUINewTabURL]; - std::string temp = base::SysNSStringToUTF8(urlString); - std::string fixedString = URLFixerUpper::FixupURL(temp, std::string()); - if (GURL(fixedString).is_valid()) - [self setHomepage:fixedString]; + std::string unfixedURL = urlString ? base::SysNSStringToUTF8(urlString) : + chrome::kChromeUINewTabURL; + std::string fixedURL = URLFixerUpper::FixupURL(unfixedURL, std::string()); + if (GURL(fixedURL).is_valid()) + [self setHomepage:fixedURL]; } // Returns whether the home button should be checked based on the preference. -- cgit v1.1