summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/options
diff options
context:
space:
mode:
authordanno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-24 08:40:36 +0000
committerdanno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-24 08:40:36 +0000
commit59548b46618373a688f300fe282d0fe24d350aa8 (patch)
treeca7ebd988a555be31865c080b36fee52e633813b /chrome/browser/views/options
parent569ca4f6cc7d13349418ff23f30746caf7c26d26 (diff)
downloadchromium_src-59548b46618373a688f300fe282d0fe24d350aa8.zip
chromium_src-59548b46618373a688f300fe282d0fe24d350aa8.tar.gz
chromium_src-59548b46618373a688f300fe282d0fe24d350aa8.tar.bz2
fix forgotten homepage preference on Windows
BUG=47055 TEST=manual Review URL: http://codereview.chromium.org/2815021 Patch from Gábor Fehér <gfeher@google.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50708 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/options')
-rw-r--r--chrome/browser/views/options/general_page_view.cc25
-rw-r--r--chrome/browser/views/options/general_page_view.h8
2 files changed, 18 insertions, 15 deletions
diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc
index c41d1c0..26878eb 100644
--- a/chrome/browser/views/options/general_page_view.cc
+++ b/chrome/browser/views/options/general_page_view.cc
@@ -232,12 +232,12 @@ void GeneralPageView::ButtonPressed(
} else if (sender == homepage_use_newtab_radio_) {
UserMetricsRecordAction(UserMetricsAction("Options_Homepage_UseNewTab"),
profile()->GetPrefs());
- SetHomepage(GURL());
+ UpdateHomepagePrefs();
EnableHomepageURLField(false);
} else if (sender == homepage_use_url_radio_) {
UserMetricsRecordAction(UserMetricsAction("Options_Homepage_UseURL"),
profile()->GetPrefs());
- SetHomepage(GURL(homepage_use_url_textfield_->text()));
+ UpdateHomepagePrefs();
EnableHomepageURLField(true);
} else if (sender == homepage_show_home_button_checkbox_) {
bool show_button = homepage_show_home_button_checkbox_->checked();
@@ -283,12 +283,7 @@ void GeneralPageView::ItemChanged(views::Combobox* combobox,
void GeneralPageView::ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents) {
if (sender == homepage_use_url_textfield_) {
- // 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 the field contains an
- // empty or null-host URL, a blank homepage is synced to prefs.
- SetHomepage(URLFixerUpper::FixupURL(
- UTF16ToUTF8(homepage_use_url_textfield_->text()), std::string()));
+ UpdateHomepagePrefs();
}
}
@@ -746,16 +741,24 @@ void GeneralPageView::AddBookmark(UrlPicker* dialog,
SaveStartupPref();
}
-void GeneralPageView::SetHomepage(const GURL& homepage) {
+void GeneralPageView::UpdateHomepagePrefs() {
+ // 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 the field contains an
+ // empty or null-host URL, a blank homepage is synced to prefs.
+ const GURL& homepage =
+ URLFixerUpper::FixupURL(
+ UTF16ToUTF8(homepage_use_url_textfield_->text()), std::string());
+ bool new_tab_page_is_home_page = homepage_use_newtab_radio_->checked();
if (!homepage.is_valid() ||
UTF8ToWide(homepage.spec()) == GetNewTabUIURLString()) {
- new_tab_page_is_home_page_.SetValue(true);
+ new_tab_page_is_home_page = true;
if (!homepage.has_host())
homepage_.SetValue(std::wstring());
} else {
- new_tab_page_is_home_page_.SetValue(false);
homepage_.SetValue(UTF8ToWide(homepage.spec()));
}
+ new_tab_page_is_home_page_.SetValue(new_tab_page_is_home_page);
}
void GeneralPageView::OnSelectionChanged() {
diff --git a/chrome/browser/views/options/general_page_view.h b/chrome/browser/views/options/general_page_view.h
index 4ef4020..7838fbe 100644
--- a/chrome/browser/views/options/general_page_view.h
+++ b/chrome/browser/views/options/general_page_view.h
@@ -104,10 +104,10 @@ class GeneralPageView : public OptionsPageView,
const std::wstring& title,
const GURL& url);
- // Sets the home page preferences for kNewTabPageIsHomePage and kHomePage.
- // If an empty or null-host GURL is passed in we revert to using NewTab
- // page as the Homepage.
- void SetHomepage(const GURL& homepage);
+ // Copies the home page preferences from the gui controls to
+ // kNewTabPageIsHomePage and kHomePage. If an empty or null-host
+ // URL is specified, then we revert to using NewTab page as the Homepage.
+ void UpdateHomepagePrefs();
// Invoked when the selection of the table view changes. Updates the enabled
// property of the remove button.