Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: chrome/browser/cocoa/preferences_window_controller.mm

Issue 2102019: Invalid URLs are no longer mangled when reopening the Options window (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | chrome/browser/gtk/options/general_page_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/preferences_window_controller.mm
===================================================================
--- chrome/browser/cocoa/preferences_window_controller.mm (revision 47986)
+++ chrome/browser/cocoa/preferences_window_controller.mm (working copy)
@@ -796,18 +796,19 @@
// Basics panel
// Sets the home page preferences for kNewTabPageIsHomePage and kHomePage. If a
-// blank string is passed in we revert to using NewTab page as the Home page.
-// When setting the Home Page to NewTab page, we preserve the old value of
-// kHomePage (we don't overwrite it). Note: using SetValue() causes the
-// observers not to fire, which is actually a good thing as we could end up in a
-// state where setting the homepage to an empty url would automatically reset
-// the prefs back to using the NTP, so we'd be never be able to change it.
-- (void)setHomepage:(const std::string&)homepage {
- if (homepage.empty() || homepage == GetNewTabUIURLString()) {
+// blank or null-host URL is passed in we revert to using NewTab page
+// as the Home page. Note: using SetValue() causes the observers not to fire,
+// which is actually a good thing as we could end up in a state where setting
+// the homepage to an empty url would automatically reset the prefs back to
+// using the NTP, so we'd be never be able to change it.
+- (void)setHomepage:(const GURL&)homepage {
+ if (!homepage.is_valid() || homepage.spec() == GetNewTabUIURLString()) {
newTabPageIsHomePage_.SetValue(true);
+ if (!homepage.has_host())
+ homepage_.SetValue(std::wstring());
} else {
newTabPageIsHomePage_.SetValue(false);
- homepage_.SetValue(UTF8ToWide(homepage));
+ homepage_.SetValue(UTF8ToWide(homepage.spec()));
}
}
@@ -1013,9 +1014,7 @@
// to something valid ("http://google.com").
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];
+ [self setHomepage:GURL(URLFixerUpper::FixupURL(unfixedURL, std::string()))];
}
// Returns whether the home button should be checked based on the preference.
« no previous file with comments | « AUTHORS ('k') | chrome/browser/gtk/options/general_page_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698