| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <windows.h> | 5 #include <windows.h> |
| 6 #include <shlobj.h> | 6 #include <shlobj.h> |
| 7 #include <vsstyle.h> | 7 #include <vsstyle.h> |
| 8 #include <vssym32.h> | 8 #include <vssym32.h> |
| 9 | 9 |
| 10 #include "chrome/browser/views/options/content_page_view.h" | 10 #include "chrome/browser/views/options/content_page_view.h" |
| 11 | 11 |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/gfx/native_theme.h" | 13 #include "base/gfx/native_theme.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/shell_dialogs.h" | 15 #include "chrome/browser/shell_dialogs.h" |
| 16 #include "chrome/browser/views/options/fonts_languages_window_view.h" | 16 #include "chrome/browser/views/options/fonts_languages_window_view.h" |
| 17 #include "chrome/browser/views/options/options_group_view.h" | 17 #include "chrome/browser/views/options/options_group_view.h" |
| 18 #include "chrome/browser/views/password_manager_view.h" | 18 #include "chrome/browser/views/options/passwords_exceptions_window_view.h" |
| 19 #include "chrome/browser/views/password_manager_exceptions_view.h" | |
| 20 #include "chrome/browser/views/standard_layout.h" | 19 #include "chrome/browser/views/standard_layout.h" |
| 21 #include "chrome/common/gfx/chrome_canvas.h" | 20 #include "chrome/common/gfx/chrome_canvas.h" |
| 22 #include "chrome/common/l10n_util.h" | 21 #include "chrome/common/l10n_util.h" |
| 23 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 24 #include "chrome/common/pref_service.h" | 23 #include "chrome/common/pref_service.h" |
| 25 #include "chrome/common/resource_bundle.h" | 24 #include "chrome/common/resource_bundle.h" |
| 26 #include "chrome/views/controls/button/radio_button.h" | 25 #include "chrome/views/controls/button/radio_button.h" |
| 27 #include "chrome/views/controls/text_field.h" | 26 #include "chrome/views/controls/text_field.h" |
| 28 #include "chrome/views/grid_layout.h" | 27 #include "chrome/views/grid_layout.h" |
| 29 #include "chrome/views/widget/widget.h" | 28 #include "chrome/views/widget/widget.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 ContentPageView::ContentPageView(Profile* profile) | 172 ContentPageView::ContentPageView(Profile* profile) |
| 174 : download_location_group_(NULL), | 173 : download_location_group_(NULL), |
| 175 download_default_download_location_display_(NULL), | 174 download_default_download_location_display_(NULL), |
| 176 download_browse_button_(NULL), | 175 download_browse_button_(NULL), |
| 177 download_ask_for_save_location_checkbox_(NULL), | 176 download_ask_for_save_location_checkbox_(NULL), |
| 178 select_file_dialog_(SelectFileDialog::Create(this)), | 177 select_file_dialog_(SelectFileDialog::Create(this)), |
| 179 passwords_exceptions_button_(NULL), | 178 passwords_exceptions_button_(NULL), |
| 180 passwords_group_(NULL), | 179 passwords_group_(NULL), |
| 181 passwords_asktosave_radio_(NULL), | 180 passwords_asktosave_radio_(NULL), |
| 182 passwords_neversave_radio_(NULL), | 181 passwords_neversave_radio_(NULL), |
| 183 passwords_show_passwords_button_(NULL), | |
| 184 fonts_lang_group_(NULL), | 182 fonts_lang_group_(NULL), |
| 185 fonts_and_languages_label_(NULL), | 183 fonts_and_languages_label_(NULL), |
| 186 change_content_fonts_button_(NULL), | 184 change_content_fonts_button_(NULL), |
| 187 OptionsPageView(profile) { | 185 OptionsPageView(profile) { |
| 188 } | 186 } |
| 189 | 187 |
| 190 ContentPageView::~ContentPageView() { | 188 ContentPageView::~ContentPageView() { |
| 191 select_file_dialog_->ListenerDestroyed(); | 189 select_file_dialog_->ListenerDestroyed(); |
| 192 } | 190 } |
| 193 | 191 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 bool enabled = passwords_asktosave_radio_->checked(); | 233 bool enabled = passwords_asktosave_radio_->checked(); |
| 236 if (enabled) { | 234 if (enabled) { |
| 237 UserMetricsRecordAction(L"Options_PasswordManager_Enable", | 235 UserMetricsRecordAction(L"Options_PasswordManager_Enable", |
| 238 profile()->GetPrefs()); | 236 profile()->GetPrefs()); |
| 239 } else { | 237 } else { |
| 240 UserMetricsRecordAction(L"Options_PasswordManager_Disable", | 238 UserMetricsRecordAction(L"Options_PasswordManager_Disable", |
| 241 profile()->GetPrefs()); | 239 profile()->GetPrefs()); |
| 242 } | 240 } |
| 243 ask_to_save_passwords_.SetValue(enabled); | 241 ask_to_save_passwords_.SetValue(enabled); |
| 244 } else if (sender == passwords_exceptions_button_) { | 242 } else if (sender == passwords_exceptions_button_) { |
| 245 UserMetricsRecordAction(L"Options_ShowPasswordManagerExceptions", NULL); | 243 UserMetricsRecordAction(L"Options_ShowPasswordsExceptions", NULL); |
| 246 PasswordManagerExceptionsView::Show(profile()); | 244 PasswordsExceptionsWindowView::Show(profile()); |
| 247 }else if (sender == passwords_show_passwords_button_) { | |
| 248 UserMetricsRecordAction(L"Options_ShowPasswordManager", NULL); | |
| 249 PasswordManagerView::Show(profile()); | |
| 250 } else if (sender == form_autofill_checkbox_) { | 245 } else if (sender == form_autofill_checkbox_) { |
| 251 bool enabled = form_autofill_checkbox_->checked(); | 246 bool enabled = form_autofill_checkbox_->checked(); |
| 252 if (enabled) { | 247 if (enabled) { |
| 253 UserMetricsRecordAction(L"Options_FormAutofill_Enable", | 248 UserMetricsRecordAction(L"Options_FormAutofill_Enable", |
| 254 profile()->GetPrefs()); | 249 profile()->GetPrefs()); |
| 255 } else { | 250 } else { |
| 256 UserMetricsRecordAction(L"Options_FormAutofill_Disable", | 251 UserMetricsRecordAction(L"Options_FormAutofill_Disable", |
| 257 profile()->GetPrefs()); | 252 profile()->GetPrefs()); |
| 258 } | 253 } |
| 259 form_autofill_.SetValue(enabled); | 254 form_autofill_.SetValue(enabled); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 passwords_asktosave_radio_ = new views::RadioButton( | 401 passwords_asktosave_radio_ = new views::RadioButton( |
| 407 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_ASKTOSAVE), | 402 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_ASKTOSAVE), |
| 408 kPasswordSavingRadioGroup); | 403 kPasswordSavingRadioGroup); |
| 409 passwords_asktosave_radio_->set_listener(this); | 404 passwords_asktosave_radio_->set_listener(this); |
| 410 passwords_asktosave_radio_->SetMultiLine(true); | 405 passwords_asktosave_radio_->SetMultiLine(true); |
| 411 passwords_neversave_radio_ = new views::RadioButton( | 406 passwords_neversave_radio_ = new views::RadioButton( |
| 412 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_NEVERSAVE), | 407 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_NEVERSAVE), |
| 413 kPasswordSavingRadioGroup); | 408 kPasswordSavingRadioGroup); |
| 414 passwords_neversave_radio_->set_listener(this); | 409 passwords_neversave_radio_->set_listener(this); |
| 415 passwords_neversave_radio_->SetMultiLine(true); | 410 passwords_neversave_radio_->SetMultiLine(true); |
| 416 passwords_show_passwords_button_ = new views::NativeButton( | |
| 417 this, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_SHOWPASSWORDS)); | |
| 418 passwords_exceptions_button_ = new views::NativeButton( | 411 passwords_exceptions_button_ = new views::NativeButton( |
| 419 this, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_EXCEPTIONS)); | 412 this, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_EXCEPTIONS)); |
| 420 | 413 |
| 421 using views::GridLayout; | 414 using views::GridLayout; |
| 422 using views::ColumnSet; | 415 using views::ColumnSet; |
| 423 | 416 |
| 424 views::View* contents = new views::View; | 417 views::View* contents = new views::View; |
| 425 GridLayout* layout = new GridLayout(contents); | 418 GridLayout* layout = new GridLayout(contents); |
| 426 contents->SetLayoutManager(layout); | 419 contents->SetLayoutManager(layout); |
| 427 | 420 |
| 428 const int single_column_view_set_id = 1; | 421 const int single_column_view_set_id = 1; |
| 429 ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id); | 422 ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id); |
| 430 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, | 423 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, |
| 431 GridLayout::USE_PREF, 0, 0); | 424 GridLayout::USE_PREF, 0, 0); |
| 432 | 425 |
| 433 const int double_column_view_set_id = 0; | 426 const int double_column_view_set_id = 0; |
| 434 column_set = layout->AddColumnSet(double_column_view_set_id); | 427 column_set = layout->AddColumnSet(double_column_view_set_id); |
| 435 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 428 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
| 436 GridLayout::USE_PREF, 0, 0); | 429 GridLayout::USE_PREF, 0, 0); |
| 437 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 430 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
| 438 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 431 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
| 439 GridLayout::USE_PREF, 0, 0); | 432 GridLayout::USE_PREF, 0, 0); |
| 440 | 433 |
| 441 layout->StartRow(0, single_column_view_set_id); | 434 layout->StartRow(0, single_column_view_set_id); |
| 442 layout->AddView(passwords_asktosave_radio_); | 435 layout->AddView(passwords_asktosave_radio_); |
| 443 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 436 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
| 444 layout->StartRow(0, single_column_view_set_id); | 437 layout->StartRow(0, single_column_view_set_id); |
| 445 layout->AddView(passwords_neversave_radio_); | 438 layout->AddView(passwords_neversave_radio_); |
| 446 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); | 439 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); |
| 447 layout->StartRow(0, double_column_view_set_id); | 440 layout->StartRow(0, single_column_view_set_id); |
| 448 layout->AddView(passwords_show_passwords_button_); | |
| 449 layout->AddView(passwords_exceptions_button_); | 441 layout->AddView(passwords_exceptions_button_); |
| 450 | 442 |
| 451 passwords_group_ = new OptionsGroupView( | 443 passwords_group_ = new OptionsGroupView( |
| 452 contents, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME), L"", | 444 contents, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME), L"", |
| 453 true); | 445 true); |
| 454 } | 446 } |
| 455 | 447 |
| 456 void ContentPageView::InitFormAutofillGroup() { | 448 void ContentPageView::InitFormAutofillGroup() { |
| 457 form_autofill_checkbox_ = new views::Checkbox( | 449 form_autofill_checkbox_ = new views::Checkbox( |
| 458 l10n_util::GetString(IDS_AUTOFILL_SAVEFORMS)); | 450 l10n_util::GetString(IDS_AUTOFILL_SAVEFORMS)); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 fonts_lang_group_ = new OptionsGroupView( | 501 fonts_lang_group_ = new OptionsGroupView( |
| 510 contents, | 502 contents, |
| 511 l10n_util::GetString(IDS_OPTIONS_FONTSANDLANGUAGES_GROUP_NAME), | 503 l10n_util::GetString(IDS_OPTIONS_FONTSANDLANGUAGES_GROUP_NAME), |
| 512 L"", true); | 504 L"", true); |
| 513 } | 505 } |
| 514 | 506 |
| 515 void ContentPageView::UpdateDownloadDirectoryDisplay() { | 507 void ContentPageView::UpdateDownloadDirectoryDisplay() { |
| 516 download_default_download_location_display_->SetFile( | 508 download_default_download_location_display_->SetFile( |
| 517 FilePath::FromWStringHack(default_download_location_.GetValue())); | 509 FilePath::FromWStringHack(default_download_location_.GetValue())); |
| 518 } | 510 } |
| OLD | NEW |