diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-01 23:18:52 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-01 23:18:52 +0000 |
commit | b39085998bc82dd8d5285d29291548c8b587d5c3 (patch) | |
tree | eae2681164f6e4a2859c28e2738cc1d7ae073ca1 | |
parent | 7291d48d34474ba743865ec1176d7b9abc0af580 (diff) | |
download | chromium_src-b39085998bc82dd8d5285d29291548c8b587d5c3.zip chromium_src-b39085998bc82dd8d5285d29291548c8b587d5c3.tar.gz chromium_src-b39085998bc82dd8d5285d29291548c8b587d5c3.tar.bz2 |
Fix a pet peeve: Big empty hole in Chromium builds where the UMA checkbox would be.
BUG=none
TEST=Open advanced prefs in a Chromium build, note no big gaps.
Review URL: http://codereview.chromium.org/556096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37762 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/options/advanced_contents_view.cc | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index 54f0ff0..94750b9 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -534,7 +534,8 @@ void PrivacySection::ButtonPressed( g_browser_process->resource_dispatcher_host()->safe_browsing_service(); MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( safe_browsing_service, &SafeBrowsingService::OnEnable, enabled)); - } else if (sender == reporting_enabled_checkbox_) { + } else if (reporting_enabled_checkbox_ && + (sender == reporting_enabled_checkbox_)) { bool enabled = reporting_enabled_checkbox_->checked(); UserMetricsRecordAction(enabled ? "Options_MetricsReportingCheckbox_Enable" : @@ -567,15 +568,17 @@ void PrivacySection::LinkActivated(views::Link* source, int event_flags) { } void PrivacySection::Layout() { - // We override this to try and set the width of the enable logging checkbox - // to the width of the parent less some fudging since the checkbox's - // preferred size calculation code is dependent on its width, and if we don't - // do this then it will return 0 as a preferred width when GridLayout (called - // from View::Layout) tries to access it. - views::View* parent = GetParent(); - if (parent && parent->width()) { - const int parent_width = parent->width(); - reporting_enabled_checkbox_->SetBounds(0, 0, parent_width - 20, 0); + if (reporting_enabled_checkbox_) { + // We override this to try and set the width of the enable logging checkbox + // to the width of the parent less some fudging since the checkbox's + // preferred size calculation code is dependent on its width, and if we + // don't do this then it will return 0 as a preferred width when GridLayout + // (called from View::Layout) tries to access it. + views::View* parent = GetParent(); + if (parent && parent->width()) { + const int parent_width = parent->width(); + reporting_enabled_checkbox_->SetBounds(0, 0, parent_width - 20, 0); + } } View::Layout(); } @@ -601,14 +604,12 @@ void PrivacySection::InitControlLayout() { enable_safe_browsing_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION)); enable_safe_browsing_checkbox_->set_listener(this); +#if defined(GOOGLE_CHROME_BUILD) reporting_enabled_checkbox_ = new views::Checkbox( l10n_util::GetString(IDS_OPTIONS_ENABLE_LOGGING)); reporting_enabled_checkbox_->SetMultiLine(true); reporting_enabled_checkbox_->set_listener(this); -#if defined(GOOGLE_CHROME_BUILD) reporting_enabled_checkbox_->SetVisible(true); -#else - reporting_enabled_checkbox_->SetVisible(false); #endif learn_more_link_ = new views::Link(l10n_util::GetString(IDS_LEARN_MORE)); learn_more_link_->SetController(this); @@ -651,8 +652,10 @@ void PrivacySection::InitControlLayout() { AddWrappingCheckboxRow(layout, enable_safe_browsing_checkbox_, single_column_view_set_id, false); // The "Help make Google Chrome better" checkbox. - AddLeadingControl(layout, reporting_enabled_checkbox_, - single_column_view_set_id, false); + if (reporting_enabled_checkbox_) { + AddLeadingControl(layout, reporting_enabled_checkbox_, + single_column_view_set_id, false); + } // Init member prefs so we can update the controls if prefs change. alternate_error_pages_.Init(prefs::kAlternateErrorPagesEnabled, @@ -681,7 +684,8 @@ void PrivacySection::NotifyPrefChanged(const std::wstring* pref_name) { } if (!pref_name || *pref_name == prefs::kSafeBrowsingEnabled) enable_safe_browsing_checkbox_->SetChecked(safe_browsing_.GetValue()); - if (!pref_name || *pref_name == prefs::kMetricsReportingEnabled) { + if (reporting_enabled_checkbox_ && + (!pref_name || *pref_name == prefs::kMetricsReportingEnabled)) { reporting_enabled_checkbox_->SetChecked( enable_metrics_recording_.GetValue()); ResolveMetricsReportingEnabled(); @@ -689,6 +693,7 @@ void PrivacySection::NotifyPrefChanged(const std::wstring* pref_name) { } void PrivacySection::ResolveMetricsReportingEnabled() { + DCHECK(reporting_enabled_checkbox_); bool enabled = reporting_enabled_checkbox_->checked(); enabled = OptionsUtil::ResolveMetricsReportingEnabled(enabled); |