OLD | NEW |
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 Loading... |
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 21 matching lines...) Expand all Loading... |
89 sender == passwords_neversave_radio_) { | 89 sender == passwords_neversave_radio_) { |
90 bool enabled = passwords_asktosave_radio_->checked(); | 90 bool enabled = passwords_asktosave_radio_->checked(); |
91 if (enabled) { | 91 if (enabled) { |
92 UserMetricsRecordAction("Options_PasswordManager_Enable", | 92 UserMetricsRecordAction("Options_PasswordManager_Enable", |
93 profile()->GetPrefs()); | 93 profile()->GetPrefs()); |
94 } else { | 94 } else { |
95 UserMetricsRecordAction("Options_PasswordManager_Disable", | 95 UserMetricsRecordAction("Options_PasswordManager_Disable", |
96 profile()->GetPrefs()); | 96 profile()->GetPrefs()); |
97 } | 97 } |
98 ask_to_save_passwords_.SetValue(enabled); | 98 ask_to_save_passwords_.SetValue(enabled); |
99 } else if (sender == form_autofill_asktosave_radio_ || | 99 } else if (sender == form_autofill_enable_radio_ || |
100 sender == form_autofill_neversave_radio_) { | 100 sender == form_autofill_disable_radio_) { |
101 bool enabled = form_autofill_asktosave_radio_->checked(); | 101 bool enabled = form_autofill_enable_radio_->checked(); |
102 if (enabled) { | 102 if (enabled) { |
103 UserMetricsRecordAction("Options_FormAutofill_Enable", | 103 UserMetricsRecordAction("Options_FormAutofill_Enable", |
104 profile()->GetPrefs()); | 104 profile()->GetPrefs()); |
105 } else { | 105 } else { |
106 UserMetricsRecordAction("Options_FormAutofill_Disable", | 106 UserMetricsRecordAction("Options_FormAutofill_Disable", |
107 profile()->GetPrefs()); | 107 profile()->GetPrefs()); |
108 } | 108 } |
109 ask_to_save_form_autofill_.SetValue(enabled); | 109 ask_to_save_form_autofill_.SetValue(enabled); |
110 } else if (sender == passwords_exceptions_button_) { | 110 } else if (sender == passwords_exceptions_button_) { |
111 UserMetricsRecordAction("Options_ShowPasswordsExceptions", NULL); | 111 UserMetricsRecordAction("Options_ShowPasswordsExceptions", NULL); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 void ContentPageView::NotifyPrefChanged(const std::wstring* pref_name) { | 216 void ContentPageView::NotifyPrefChanged(const std::wstring* pref_name) { |
217 if (!pref_name || *pref_name == prefs::kPasswordManagerEnabled) { | 217 if (!pref_name || *pref_name == prefs::kPasswordManagerEnabled) { |
218 if (ask_to_save_passwords_.GetValue()) { | 218 if (ask_to_save_passwords_.GetValue()) { |
219 passwords_asktosave_radio_->SetChecked(true); | 219 passwords_asktosave_radio_->SetChecked(true); |
220 } else { | 220 } else { |
221 passwords_neversave_radio_->SetChecked(true); | 221 passwords_neversave_radio_->SetChecked(true); |
222 } | 222 } |
223 } | 223 } |
224 if (!pref_name || *pref_name == prefs::kFormAutofillEnabled) { | 224 if (!pref_name || *pref_name == prefs::kFormAutofillEnabled) { |
225 if (ask_to_save_form_autofill_.GetValue()) { | 225 if (ask_to_save_form_autofill_.GetValue()) { |
226 form_autofill_asktosave_radio_->SetChecked(true); | 226 form_autofill_enable_radio_->SetChecked(true); |
227 } else { | 227 } else { |
228 form_autofill_neversave_radio_->SetChecked(true); | 228 form_autofill_disable_radio_->SetChecked(true); |
229 } | 229 } |
230 } | 230 } |
231 if (!pref_name || *pref_name == prefs::kCurrentThemeID) { | 231 if (!pref_name || *pref_name == prefs::kCurrentThemeID) { |
232 themes_reset_button_->SetEnabled( | 232 themes_reset_button_->SetEnabled( |
233 is_using_default_theme_.GetValue().length() > 0); | 233 is_using_default_theme_.GetValue().length() > 0); |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 /////////////////////////////////////////////////////////////////////////////// | 237 /////////////////////////////////////////////////////////////////////////////// |
238 // ContentsPageView, views::View overrides: | 238 // ContentsPageView, views::View overrides: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); | 303 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); |
304 layout->StartRow(0, single_column_view_set_id); | 304 layout->StartRow(0, single_column_view_set_id); |
305 layout->AddView(passwords_exceptions_button_); | 305 layout->AddView(passwords_exceptions_button_); |
306 | 306 |
307 passwords_group_ = new OptionsGroupView( | 307 passwords_group_ = new OptionsGroupView( |
308 contents, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME), L"", | 308 contents, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME), L"", |
309 true); | 309 true); |
310 } | 310 } |
311 | 311 |
312 void ContentPageView::InitFormAutofillGroup() { | 312 void ContentPageView::InitFormAutofillGroup() { |
313 form_autofill_asktosave_radio_ = new views::RadioButton( | 313 form_autofill_enable_radio_ = new views::RadioButton( |
314 l10n_util::GetString(IDS_OPTIONS_AUTOFILL_SAVE), | 314 l10n_util::GetString(IDS_OPTIONS_AUTOFILL_ENABLE), |
315 kFormAutofillRadioGroup); | 315 kFormAutofillRadioGroup); |
316 form_autofill_asktosave_radio_->set_listener(this); | 316 form_autofill_enable_radio_->set_listener(this); |
317 form_autofill_asktosave_radio_->SetMultiLine(true); | 317 form_autofill_enable_radio_->SetMultiLine(true); |
318 form_autofill_neversave_radio_ = new views::RadioButton( | 318 form_autofill_disable_radio_ = new views::RadioButton( |
319 l10n_util::GetString(IDS_OPTIONS_AUTOFILL_NEVERSAVE), | 319 l10n_util::GetString(IDS_OPTIONS_AUTOFILL_DISABLE), |
320 kFormAutofillRadioGroup); | 320 kFormAutofillRadioGroup); |
321 form_autofill_neversave_radio_->set_listener(this); | 321 form_autofill_disable_radio_->set_listener(this); |
322 form_autofill_neversave_radio_->SetMultiLine(true); | 322 form_autofill_disable_radio_->SetMultiLine(true); |
323 | 323 |
324 change_autofill_settings_button_ = new views::NativeButton( | 324 change_autofill_settings_button_ = new views::NativeButton( |
325 this, l10n_util::GetString(IDS_OPTIONS_AUTOFILL_SETTINGS)); | 325 this, l10n_util::GetString(IDS_OPTIONS_AUTOFILL_SETTINGS)); |
326 if (!profile()->GetPersonalDataManager()) | 326 if (!profile()->GetPersonalDataManager()) |
327 change_autofill_settings_button_->SetEnabled(false); | 327 change_autofill_settings_button_->SetEnabled(false); |
328 | 328 |
329 | 329 |
330 using views::GridLayout; | 330 using views::GridLayout; |
331 using views::ColumnSet; | 331 using views::ColumnSet; |
332 | 332 |
333 views::View* contents = new views::View; | 333 views::View* contents = new views::View; |
334 GridLayout* layout = new GridLayout(contents); | 334 GridLayout* layout = new GridLayout(contents); |
335 contents->SetLayoutManager(layout); | 335 contents->SetLayoutManager(layout); |
336 | 336 |
337 const int fill_column_view_set_id = 0; | 337 const int fill_column_view_set_id = 0; |
338 const int leading_column_view_set_id = 1; | 338 const int leading_column_view_set_id = 1; |
339 ColumnSet* column_set = layout->AddColumnSet(fill_column_view_set_id); | 339 ColumnSet* column_set = layout->AddColumnSet(fill_column_view_set_id); |
340 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, | 340 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, |
341 GridLayout::USE_PREF, 0, 0); | 341 GridLayout::USE_PREF, 0, 0); |
342 column_set = layout->AddColumnSet(leading_column_view_set_id); | 342 column_set = layout->AddColumnSet(leading_column_view_set_id); |
343 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, | 343 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, |
344 GridLayout::USE_PREF, 0, 0); | 344 GridLayout::USE_PREF, 0, 0); |
345 | 345 |
346 layout->StartRow(0, fill_column_view_set_id); | 346 layout->StartRow(0, fill_column_view_set_id); |
347 layout->AddView(form_autofill_asktosave_radio_); | 347 layout->AddView(form_autofill_enable_radio_); |
348 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 348 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
349 layout->StartRow(0, fill_column_view_set_id); | 349 layout->StartRow(0, fill_column_view_set_id); |
350 layout->AddView(form_autofill_neversave_radio_); | 350 layout->AddView(form_autofill_disable_radio_); |
351 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 351 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
352 layout->StartRow(0, leading_column_view_set_id); | 352 layout->StartRow(0, leading_column_view_set_id); |
353 layout->AddView(change_autofill_settings_button_); | 353 layout->AddView(change_autofill_settings_button_); |
354 | 354 |
355 form_autofill_group_ = new OptionsGroupView( | 355 form_autofill_group_ = new OptionsGroupView( |
356 contents, l10n_util::GetString(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME), | 356 contents, l10n_util::GetString(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME), |
357 L"", true); | 357 L"", true); |
358 } | 358 } |
359 | 359 |
360 void ContentPageView::InitThemesGroup() { | 360 void ContentPageView::InitThemesGroup() { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 sync_action_link_->SetText(link_label); | 480 sync_action_link_->SetText(link_label); |
481 sync_action_link_->SetVisible(!link_label.empty()); | 481 sync_action_link_->SetVisible(!link_label.empty()); |
482 if (status_has_error) { | 482 if (status_has_error) { |
483 sync_status_label_->set_background(CreateErrorBackground()); | 483 sync_status_label_->set_background(CreateErrorBackground()); |
484 sync_action_link_->set_background(CreateErrorBackground()); | 484 sync_action_link_->set_background(CreateErrorBackground()); |
485 } else { | 485 } else { |
486 sync_status_label_->set_background(NULL); | 486 sync_status_label_->set_background(NULL); |
487 sync_action_link_->set_background(NULL); | 487 sync_action_link_->set_background(NULL); |
488 } | 488 } |
489 } | 489 } |
OLD | NEW |