diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 19:30:57 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 19:30:57 +0000 |
commit | 59f6749a6df399704ac85485f8c7864b771daa58 (patch) | |
tree | fda87878394317cc798b67e28ab0ce1b78326a22 | |
parent | 5970e76db0fecf73cccb67253ae5276ab7eb4937 (diff) | |
download | chromium_src-59f6749a6df399704ac85485f8c7864b771daa58.zip chromium_src-59f6749a6df399704ac85485f8c7864b771daa58.tar.gz chromium_src-59f6749a6df399704ac85485f8c7864b771daa58.tar.bz2 |
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
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.mm | 11 |
1 files changed, 5 insertions, 6 deletions
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. |