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

Side by Side Diff: chrome/browser/gtk/options/advanced_contents_gtk.cc

Issue 149581: Add "learn more" link to privacy settings. (Closed)
Patch Set: Created 11 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/gtk/options/advanced_contents_gtk.h" 5 #include "chrome/browser/gtk/options/advanced_contents_gtk.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "chrome/browser/browser_list.h"
9 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/gtk/gtk_chrome_link_button.h"
10 #include "chrome/browser/gtk/options/options_layout_gtk.h" 12 #include "chrome/browser/gtk/options/options_layout_gtk.h"
11 #include "chrome/browser/net/dns_global.h" 13 #include "chrome/browser/net/dns_global.h"
12 #include "chrome/browser/options_page_base.h" 14 #include "chrome/browser/options_page_base.h"
13 #include "chrome/browser/profile.h" 15 #include "chrome/browser/profile.h"
14 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
15 #include "chrome/common/gtk_util.h" 17 #include "chrome/common/gtk_util.h"
16 #include "chrome/common/pref_member.h" 18 #include "chrome/common/pref_member.h"
17 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
18 #include "chrome/installer/util/google_update_settings.h" 20 #include "chrome/installer/util/google_update_settings.h"
19 #include "grit/chromium_strings.h" 21 #include "grit/chromium_strings.h"
20 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
23 #include "grit/locale_settings.h"
21 #include "net/base/cookie_policy.h" 24 #include "net/base/cookie_policy.h"
22 25
23 namespace { 26 namespace {
24 27
25 // The pixel width we wrap labels at. 28 // The pixel width we wrap labels at.
26 // TODO(evanm): make the labels wrap at the appropriate width. 29 // TODO(evanm): make the labels wrap at the appropriate width.
27 const int kWrapWidth = 475; 30 const int kWrapWidth = 475;
28 31
29 GtkWidget* CreateWrappedLabel(int string_id) { 32 GtkWidget* CreateWrappedLabel(int string_id) {
30 GtkWidget* label = gtk_label_new( 33 GtkWidget* label = gtk_label_new(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 109
107 GtkWidget* get_page_widget() const { 110 GtkWidget* get_page_widget() const {
108 return page_; 111 return page_;
109 } 112 }
110 113
111 private: 114 private:
112 // Overridden from OptionsPageBase. 115 // Overridden from OptionsPageBase.
113 virtual void NotifyPrefChanged(const std::wstring* pref_name); 116 virtual void NotifyPrefChanged(const std::wstring* pref_name);
114 117
115 // The callback functions for the options widgets. 118 // The callback functions for the options widgets.
119 static void OnLearnMoreLinkClicked(GtkButton *button,
120 PrivacySection* privacy_section);
116 static void OnEnableLinkDoctorChange(GtkWidget* widget, 121 static void OnEnableLinkDoctorChange(GtkWidget* widget,
117 PrivacySection* options_window); 122 PrivacySection* options_window);
118 static void OnEnableSuggestChange(GtkWidget* widget, 123 static void OnEnableSuggestChange(GtkWidget* widget,
119 PrivacySection* options_window); 124 PrivacySection* options_window);
120 static void OnDNSPrefetchingChange(GtkWidget* widget, 125 static void OnDNSPrefetchingChange(GtkWidget* widget,
121 PrivacySection* options_window); 126 PrivacySection* options_window);
122 static void OnSafeBrowsingChange(GtkWidget* widget, 127 static void OnSafeBrowsingChange(GtkWidget* widget,
123 PrivacySection* options_window); 128 PrivacySection* options_window);
124 static void OnLoggingChange(GtkWidget* widget, 129 static void OnLoggingChange(GtkWidget* widget,
125 PrivacySection* options_window); 130 PrivacySection* options_window);
(...skipping 30 matching lines...) Expand all
156 : OptionsPageBase(profile), 161 : OptionsPageBase(profile),
157 initializing_(true) { 162 initializing_(true) {
158 page_ = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); 163 page_ = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
159 164
160 GtkWidget* section_description_label = CreateWrappedLabel( 165 GtkWidget* section_description_label = CreateWrappedLabel(
161 IDS_OPTIONS_DISABLE_SERVICES); 166 IDS_OPTIONS_DISABLE_SERVICES);
162 gtk_misc_set_alignment(GTK_MISC(section_description_label), 0, 0); 167 gtk_misc_set_alignment(GTK_MISC(section_description_label), 0, 0);
163 gtk_box_pack_start(GTK_BOX(page_), section_description_label, 168 gtk_box_pack_start(GTK_BOX(page_), section_description_label,
164 FALSE, FALSE, 0); 169 FALSE, FALSE, 0);
165 170
166 // TODO(mattm): Learn more link 171 GtkWidget* learn_more_link = gtk_chrome_link_button_new(
172 l10n_util::GetStringUTF8(IDS_LEARN_MORE).c_str());
173 // Stick it in an hbox so it doesn't expand to the whole width.
174 GtkWidget* learn_more_hbox = gtk_hbox_new(FALSE, 0);
175 gtk_box_pack_start(GTK_BOX(learn_more_hbox), learn_more_link,
176 FALSE, FALSE, 0);
177 gtk_box_pack_start(GTK_BOX(page_), learn_more_hbox,
178 FALSE, FALSE, 0);
179 g_signal_connect(learn_more_link, "clicked",
180 G_CALLBACK(OnLearnMoreLinkClicked), this);
167 181
168 enable_link_doctor_checkbox_ = CreateCheckButtonWithWrappedLabel( 182 enable_link_doctor_checkbox_ = CreateCheckButtonWithWrappedLabel(
169 IDS_OPTIONS_LINKDOCTOR_PREF); 183 IDS_OPTIONS_LINKDOCTOR_PREF);
170 gtk_box_pack_start(GTK_BOX(page_), enable_link_doctor_checkbox_, 184 gtk_box_pack_start(GTK_BOX(page_), enable_link_doctor_checkbox_,
171 FALSE, FALSE, 0); 185 FALSE, FALSE, 0);
172 g_signal_connect(enable_link_doctor_checkbox_, "clicked", 186 g_signal_connect(enable_link_doctor_checkbox_, "clicked",
173 G_CALLBACK(OnEnableLinkDoctorChange), this); 187 G_CALLBACK(OnEnableLinkDoctorChange), this);
174 188
175 enable_suggest_checkbox_ = CreateCheckButtonWithWrappedLabel( 189 enable_suggest_checkbox_ = CreateCheckButtonWithWrappedLabel(
176 IDS_OPTIONS_SUGGEST_PREF); 190 IDS_OPTIONS_SUGGEST_PREF);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 profile->GetPrefs(), this); 248 profile->GetPrefs(), this);
235 safe_browsing_.Init(prefs::kSafeBrowsingEnabled, profile->GetPrefs(), this); 249 safe_browsing_.Init(prefs::kSafeBrowsingEnabled, profile->GetPrefs(), this);
236 enable_metrics_recording_.Init(prefs::kMetricsReportingEnabled, 250 enable_metrics_recording_.Init(prefs::kMetricsReportingEnabled,
237 g_browser_process->local_state(), this); 251 g_browser_process->local_state(), this);
238 cookie_behavior_.Init(prefs::kCookieBehavior, profile->GetPrefs(), this); 252 cookie_behavior_.Init(prefs::kCookieBehavior, profile->GetPrefs(), this);
239 253
240 NotifyPrefChanged(NULL); 254 NotifyPrefChanged(NULL);
241 } 255 }
242 256
243 // static 257 // static
258 void PrivacySection::OnLearnMoreLinkClicked(GtkButton *button,
259 PrivacySection* privacy_section) {
260 BrowserList::GetLastActive()->
261 OpenURL(GURL(l10n_util::GetStringUTF8(IDS_LEARN_MORE_PRIVACY_URL)),
262 GURL(), NEW_WINDOW, PageTransition::LINK);
263 }
264
265 // static
244 void PrivacySection::OnEnableLinkDoctorChange(GtkWidget* widget, 266 void PrivacySection::OnEnableLinkDoctorChange(GtkWidget* widget,
245 PrivacySection* privacy_section) { 267 PrivacySection* privacy_section) {
246 if (privacy_section->initializing_) 268 if (privacy_section->initializing_)
247 return; 269 return;
248 bool enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); 270 bool enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
249 privacy_section->UserMetricsRecordAction( 271 privacy_section->UserMetricsRecordAction(
250 enabled ? 272 enabled ?
251 L"Options_LinkDoctorCheckbox_Enable" : 273 L"Options_LinkDoctorCheckbox_Enable" :
252 L"Options_LinkDoctorCheckbox_Disable", 274 L"Options_LinkDoctorCheckbox_Disable",
253 privacy_section->profile()->GetPrefs()); 275 privacy_section->profile()->GetPrefs());
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT), 483 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT),
462 web_content_section_->get_page_widget(), false); 484 web_content_section_->get_page_widget(), false);
463 485
464 security_section_.reset(new SecuritySection(profile_)); 486 security_section_.reset(new SecuritySection(profile_));
465 options_builder.AddOptionGroup( 487 options_builder.AddOptionGroup(
466 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY), 488 l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY),
467 security_section_->get_page_widget(), false); 489 security_section_->get_page_widget(), false);
468 490
469 page_ = options_builder.get_page_widget(); 491 page_ = options_builder.get_page_widget();
470 } 492 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698