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

Side by Side Diff: chrome/browser/views/options/content_page_view.cc

Issue 579020: linux: Implement the new AutoFill section of the Options dialog. (Closed)
Patch Set: fix for mac side Created 10 years, 10 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 | « chrome/browser/views/options/content_page_view.h ('k') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/options/content_page_view.h" 5 #include "chrome/browser/views/options/content_page_view.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 #include <vsstyle.h> 9 #include <vsstyle.h>
10 #include <vssym32.h> 10 #include <vssym32.h>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 } // namespace 48 } // namespace
49 49
50 ContentPageView::ContentPageView(Profile* profile) 50 ContentPageView::ContentPageView(Profile* profile)
51 : passwords_exceptions_button_(NULL), 51 : passwords_exceptions_button_(NULL),
52 passwords_group_(NULL), 52 passwords_group_(NULL),
53 passwords_asktosave_radio_(NULL), 53 passwords_asktosave_radio_(NULL),
54 passwords_neversave_radio_(NULL), 54 passwords_neversave_radio_(NULL),
55 change_autofill_settings_button_(NULL), 55 change_autofill_settings_button_(NULL),
56 form_autofill_asktosave_radio_(NULL), 56 form_autofill_enable_radio_(NULL),
57 form_autofill_neversave_radio_(NULL), 57 form_autofill_disable_radio_(NULL),
58 themes_group_(NULL), 58 themes_group_(NULL),
59 themes_reset_button_(NULL), 59 themes_reset_button_(NULL),
60 themes_gallery_link_(NULL), 60 themes_gallery_link_(NULL),
61 browsing_data_group_(NULL), 61 browsing_data_group_(NULL),
62 import_button_(NULL), 62 import_button_(NULL),
63 sync_group_(NULL), 63 sync_group_(NULL),
64 sync_status_label_(NULL), 64 sync_status_label_(NULL),
65 sync_action_link_(NULL), 65 sync_action_link_(NULL),
66 sync_start_stop_button_(NULL), 66 sync_start_stop_button_(NULL),
67 sync_service_(NULL), 67 sync_service_(NULL),
(...skipping 18 matching lines...) Expand all
86 sender == passwords_neversave_radio_) { 86 sender == passwords_neversave_radio_) {
87 bool enabled = passwords_asktosave_radio_->checked(); 87 bool enabled = passwords_asktosave_radio_->checked();
88 if (enabled) { 88 if (enabled) {
89 UserMetricsRecordAction("Options_PasswordManager_Enable", 89 UserMetricsRecordAction("Options_PasswordManager_Enable",
90 profile()->GetPrefs()); 90 profile()->GetPrefs());
91 } else { 91 } else {
92 UserMetricsRecordAction("Options_PasswordManager_Disable", 92 UserMetricsRecordAction("Options_PasswordManager_Disable",
93 profile()->GetPrefs()); 93 profile()->GetPrefs());
94 } 94 }
95 ask_to_save_passwords_.SetValue(enabled); 95 ask_to_save_passwords_.SetValue(enabled);
96 } else if (sender == form_autofill_asktosave_radio_ || 96 } else if (sender == form_autofill_enable_radio_ ||
97 sender == form_autofill_neversave_radio_) { 97 sender == form_autofill_disable_radio_) {
98 bool enabled = form_autofill_asktosave_radio_->checked(); 98 bool enabled = form_autofill_enable_radio_->checked();
99 if (enabled) { 99 if (enabled) {
100 UserMetricsRecordAction("Options_FormAutofill_Enable", 100 UserMetricsRecordAction("Options_FormAutofill_Enable",
101 profile()->GetPrefs()); 101 profile()->GetPrefs());
102 } else { 102 } else {
103 UserMetricsRecordAction("Options_FormAutofill_Disable", 103 UserMetricsRecordAction("Options_FormAutofill_Disable",
104 profile()->GetPrefs()); 104 profile()->GetPrefs());
105 } 105 }
106 ask_to_save_form_autofill_.SetValue(enabled); 106 ask_to_save_form_autofill_.SetValue(enabled);
107 } else if (sender == passwords_exceptions_button_) { 107 } else if (sender == passwords_exceptions_button_) {
108 UserMetricsRecordAction("Options_ShowPasswordsExceptions", NULL); 108 UserMetricsRecordAction("Options_ShowPasswordsExceptions", NULL);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 void ContentPageView::NotifyPrefChanged(const std::wstring* pref_name) { 208 void ContentPageView::NotifyPrefChanged(const std::wstring* pref_name) {
209 if (!pref_name || *pref_name == prefs::kPasswordManagerEnabled) { 209 if (!pref_name || *pref_name == prefs::kPasswordManagerEnabled) {
210 if (ask_to_save_passwords_.GetValue()) { 210 if (ask_to_save_passwords_.GetValue()) {
211 passwords_asktosave_radio_->SetChecked(true); 211 passwords_asktosave_radio_->SetChecked(true);
212 } else { 212 } else {
213 passwords_neversave_radio_->SetChecked(true); 213 passwords_neversave_radio_->SetChecked(true);
214 } 214 }
215 } 215 }
216 if (!pref_name || *pref_name == prefs::kFormAutofillEnabled) { 216 if (!pref_name || *pref_name == prefs::kFormAutofillEnabled) {
217 if (ask_to_save_form_autofill_.GetValue()) { 217 if (ask_to_save_form_autofill_.GetValue()) {
218 form_autofill_asktosave_radio_->SetChecked(true); 218 form_autofill_enable_radio_->SetChecked(true);
219 } else { 219 } else {
220 form_autofill_neversave_radio_->SetChecked(true); 220 form_autofill_disable_radio_->SetChecked(true);
221 } 221 }
222 } 222 }
223 if (!pref_name || *pref_name == prefs::kCurrentThemeID) { 223 if (!pref_name || *pref_name == prefs::kCurrentThemeID) {
224 themes_reset_button_->SetEnabled( 224 themes_reset_button_->SetEnabled(
225 is_using_default_theme_.GetValue().length() > 0); 225 is_using_default_theme_.GetValue().length() > 0);
226 } 226 }
227 } 227 }
228 228
229 /////////////////////////////////////////////////////////////////////////////// 229 ///////////////////////////////////////////////////////////////////////////////
230 // ContentsPageView, views::View overrides: 230 // ContentsPageView, views::View overrides:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); 295 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
296 layout->StartRow(0, single_column_view_set_id); 296 layout->StartRow(0, single_column_view_set_id);
297 layout->AddView(passwords_exceptions_button_); 297 layout->AddView(passwords_exceptions_button_);
298 298
299 passwords_group_ = new OptionsGroupView( 299 passwords_group_ = new OptionsGroupView(
300 contents, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME), L"", 300 contents, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME), L"",
301 true); 301 true);
302 } 302 }
303 303
304 void ContentPageView::InitFormAutofillGroup() { 304 void ContentPageView::InitFormAutofillGroup() {
305 form_autofill_asktosave_radio_ = new views::RadioButton( 305 form_autofill_enable_radio_ = new views::RadioButton(
306 l10n_util::GetString(IDS_OPTIONS_AUTOFILL_SAVE), 306 l10n_util::GetString(IDS_OPTIONS_AUTOFILL_ENABLE),
307 kFormAutofillRadioGroup); 307 kFormAutofillRadioGroup);
308 form_autofill_asktosave_radio_->set_listener(this); 308 form_autofill_enable_radio_->set_listener(this);
309 form_autofill_asktosave_radio_->SetMultiLine(true); 309 form_autofill_enable_radio_->SetMultiLine(true);
310 form_autofill_neversave_radio_ = new views::RadioButton( 310 form_autofill_disable_radio_ = new views::RadioButton(
311 l10n_util::GetString(IDS_OPTIONS_AUTOFILL_NEVERSAVE), 311 l10n_util::GetString(IDS_OPTIONS_AUTOFILL_DISABLE),
312 kFormAutofillRadioGroup); 312 kFormAutofillRadioGroup);
313 form_autofill_neversave_radio_->set_listener(this); 313 form_autofill_disable_radio_->set_listener(this);
314 form_autofill_neversave_radio_->SetMultiLine(true); 314 form_autofill_disable_radio_->SetMultiLine(true);
315 315
316 change_autofill_settings_button_ = new views::NativeButton( 316 change_autofill_settings_button_ = new views::NativeButton(
317 this, l10n_util::GetString(IDS_OPTIONS_AUTOFILL_SETTINGS)); 317 this, l10n_util::GetString(IDS_OPTIONS_AUTOFILL_SETTINGS));
318 318
319 using views::GridLayout; 319 using views::GridLayout;
320 using views::ColumnSet; 320 using views::ColumnSet;
321 321
322 views::View* contents = new views::View; 322 views::View* contents = new views::View;
323 GridLayout* layout = new GridLayout(contents); 323 GridLayout* layout = new GridLayout(contents);
324 contents->SetLayoutManager(layout); 324 contents->SetLayoutManager(layout);
325 325
326 const int fill_column_view_set_id = 0; 326 const int fill_column_view_set_id = 0;
327 const int leading_column_view_set_id = 1; 327 const int leading_column_view_set_id = 1;
328 ColumnSet* column_set = layout->AddColumnSet(fill_column_view_set_id); 328 ColumnSet* column_set = layout->AddColumnSet(fill_column_view_set_id);
329 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, 329 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1,
330 GridLayout::USE_PREF, 0, 0); 330 GridLayout::USE_PREF, 0, 0);
331 column_set = layout->AddColumnSet(leading_column_view_set_id); 331 column_set = layout->AddColumnSet(leading_column_view_set_id);
332 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, 332 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1,
333 GridLayout::USE_PREF, 0, 0); 333 GridLayout::USE_PREF, 0, 0);
334 334
335 layout->StartRow(0, fill_column_view_set_id); 335 layout->StartRow(0, fill_column_view_set_id);
336 layout->AddView(form_autofill_asktosave_radio_); 336 layout->AddView(form_autofill_enable_radio_);
337 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 337 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
338 layout->StartRow(0, fill_column_view_set_id); 338 layout->StartRow(0, fill_column_view_set_id);
339 layout->AddView(form_autofill_neversave_radio_); 339 layout->AddView(form_autofill_disable_radio_);
340 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 340 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
341 layout->StartRow(0, leading_column_view_set_id); 341 layout->StartRow(0, leading_column_view_set_id);
342 layout->AddView(change_autofill_settings_button_); 342 layout->AddView(change_autofill_settings_button_);
343 343
344 form_autofill_group_ = new OptionsGroupView( 344 form_autofill_group_ = new OptionsGroupView(
345 contents, l10n_util::GetString(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME), 345 contents, l10n_util::GetString(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME),
346 L"", true); 346 L"", true);
347 } 347 }
348 348
349 void ContentPageView::InitThemesGroup() { 349 void ContentPageView::InitThemesGroup() {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 sync_action_link_->SetText(link_label); 462 sync_action_link_->SetText(link_label);
463 sync_action_link_->SetVisible(!link_label.empty()); 463 sync_action_link_->SetVisible(!link_label.empty());
464 if (status_has_error) { 464 if (status_has_error) {
465 sync_status_label_->set_background(CreateErrorBackground()); 465 sync_status_label_->set_background(CreateErrorBackground());
466 sync_action_link_->set_background(CreateErrorBackground()); 466 sync_action_link_->set_background(CreateErrorBackground());
467 } else { 467 } else {
468 sync_status_label_->set_background(NULL); 468 sync_status_label_->set_background(NULL);
469 sync_action_link_->set_background(NULL); 469 sync_action_link_->set_background(NULL);
470 } 470 }
471 } 471 }
OLDNEW
« no previous file with comments | « chrome/browser/views/options/content_page_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698