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/app/theme/theme_resources.h" | 14 #include "chrome/app/theme/theme_resources.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/shell_dialogs.h" | 16 #include "chrome/browser/shell_dialogs.h" |
17 #include "chrome/browser/views/options/fonts_languages_window_view.h" | 17 #include "chrome/browser/views/options/fonts_languages_window_view.h" |
18 #include "chrome/browser/views/options/options_group_view.h" | 18 #include "chrome/browser/views/options/options_group_view.h" |
19 #include "chrome/browser/views/password_manager_view.h" | 19 #include "chrome/browser/views/password_manager_view.h" |
| 20 #include "chrome/browser/views/password_manager_exceptions_view.h" |
20 #include "chrome/browser/views/standard_layout.h" | 21 #include "chrome/browser/views/standard_layout.h" |
21 #include "chrome/common/gfx/chrome_canvas.h" | 22 #include "chrome/common/gfx/chrome_canvas.h" |
22 #include "chrome/common/l10n_util.h" | 23 #include "chrome/common/l10n_util.h" |
23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/pref_service.h" | 25 #include "chrome/common/pref_service.h" |
25 #include "chrome/common/resource_bundle.h" | 26 #include "chrome/common/resource_bundle.h" |
26 #include "chrome/views/checkbox.h" | 27 #include "chrome/views/checkbox.h" |
27 #include "chrome/views/grid_layout.h" | 28 #include "chrome/views/grid_layout.h" |
28 #include "chrome/views/native_button.h" | 29 #include "chrome/views/native_button.h" |
29 #include "chrome/views/radio_button.h" | 30 #include "chrome/views/radio_button.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 155 |
155 //////////////////////////////////////////////////////////////////////////////// | 156 //////////////////////////////////////////////////////////////////////////////// |
156 // ContentPageView, public: | 157 // ContentPageView, public: |
157 | 158 |
158 ContentPageView::ContentPageView(Profile* profile) | 159 ContentPageView::ContentPageView(Profile* profile) |
159 : download_location_group_(NULL), | 160 : download_location_group_(NULL), |
160 download_default_download_location_display_(NULL), | 161 download_default_download_location_display_(NULL), |
161 download_browse_button_(NULL), | 162 download_browse_button_(NULL), |
162 download_ask_for_save_location_checkbox_(NULL), | 163 download_ask_for_save_location_checkbox_(NULL), |
163 select_file_dialog_(SelectFileDialog::Create(this)), | 164 select_file_dialog_(SelectFileDialog::Create(this)), |
| 165 passwords_exceptions_button_(NULL), |
164 passwords_group_(NULL), | 166 passwords_group_(NULL), |
165 passwords_asktosave_radio_(NULL), | 167 passwords_asktosave_radio_(NULL), |
166 passwords_neversave_radio_(NULL), | 168 passwords_neversave_radio_(NULL), |
167 passwords_show_passwords_button_(NULL), | 169 passwords_show_passwords_button_(NULL), |
168 fonts_lang_group_(NULL), | 170 fonts_lang_group_(NULL), |
169 fonts_and_languages_label_(NULL), | 171 fonts_and_languages_label_(NULL), |
170 change_content_fonts_button_(NULL), | 172 change_content_fonts_button_(NULL), |
171 OptionsPageView(profile) { | 173 OptionsPageView(profile) { |
172 } | 174 } |
173 | 175 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 sender == passwords_neversave_radio_) { | 218 sender == passwords_neversave_radio_) { |
217 bool enabled = passwords_asktosave_radio_->IsSelected(); | 219 bool enabled = passwords_asktosave_radio_->IsSelected(); |
218 if (enabled) { | 220 if (enabled) { |
219 UserMetricsRecordAction(L"Options_PasswordManager_Enable", | 221 UserMetricsRecordAction(L"Options_PasswordManager_Enable", |
220 profile()->GetPrefs()); | 222 profile()->GetPrefs()); |
221 } else { | 223 } else { |
222 UserMetricsRecordAction(L"Options_PasswordManager_Disable", | 224 UserMetricsRecordAction(L"Options_PasswordManager_Disable", |
223 profile()->GetPrefs()); | 225 profile()->GetPrefs()); |
224 } | 226 } |
225 ask_to_save_passwords_.SetValue(enabled); | 227 ask_to_save_passwords_.SetValue(enabled); |
226 } else if (sender == passwords_show_passwords_button_) { | 228 } else if (sender == passwords_exceptions_button_) { |
| 229 UserMetricsRecordAction(L"Options_ShowPasswordManagerExceptions", NULL); |
| 230 PasswordManagerExceptionsView::Show(profile()); |
| 231 }else if (sender == passwords_show_passwords_button_) { |
227 UserMetricsRecordAction(L"Options_ShowPasswordManager", NULL); | 232 UserMetricsRecordAction(L"Options_ShowPasswordManager", NULL); |
228 PasswordManagerView::Show(profile()); | 233 PasswordManagerView::Show(profile()); |
229 } else if (sender == form_autofill_checkbox_) { | 234 } else if (sender == form_autofill_checkbox_) { |
230 bool enabled = form_autofill_checkbox_->IsSelected(); | 235 bool enabled = form_autofill_checkbox_->IsSelected(); |
231 if (enabled) { | 236 if (enabled) { |
232 UserMetricsRecordAction(L"Options_FormAutofill_Enable", | 237 UserMetricsRecordAction(L"Options_FormAutofill_Enable", |
233 profile()->GetPrefs()); | 238 profile()->GetPrefs()); |
234 } else { | 239 } else { |
235 UserMetricsRecordAction(L"Options_FormAutofill_Disable", | 240 UserMetricsRecordAction(L"Options_FormAutofill_Disable", |
236 profile()->GetPrefs()); | 241 profile()->GetPrefs()); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 passwords_asktosave_radio_->SetListener(this); | 394 passwords_asktosave_radio_->SetListener(this); |
390 passwords_asktosave_radio_->SetMultiLine(true); | 395 passwords_asktosave_radio_->SetMultiLine(true); |
391 passwords_neversave_radio_ = new views::RadioButton( | 396 passwords_neversave_radio_ = new views::RadioButton( |
392 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_NEVERSAVE), | 397 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_NEVERSAVE), |
393 kPasswordSavingRadioGroup); | 398 kPasswordSavingRadioGroup); |
394 passwords_neversave_radio_->SetListener(this); | 399 passwords_neversave_radio_->SetListener(this); |
395 passwords_neversave_radio_->SetMultiLine(true); | 400 passwords_neversave_radio_->SetMultiLine(true); |
396 passwords_show_passwords_button_ = new views::NativeButton( | 401 passwords_show_passwords_button_ = new views::NativeButton( |
397 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_SHOWPASSWORDS)); | 402 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_SHOWPASSWORDS)); |
398 passwords_show_passwords_button_->SetListener(this); | 403 passwords_show_passwords_button_->SetListener(this); |
| 404 passwords_exceptions_button_ = new views::NativeButton( |
| 405 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_EXCEPTIONS)); |
| 406 passwords_exceptions_button_->SetListener(this); |
399 | 407 |
400 using views::GridLayout; | 408 using views::GridLayout; |
401 using views::ColumnSet; | 409 using views::ColumnSet; |
402 | 410 |
403 views::View* contents = new views::View; | 411 views::View* contents = new views::View; |
404 GridLayout* layout = new GridLayout(contents); | 412 GridLayout* layout = new GridLayout(contents); |
405 contents->SetLayoutManager(layout); | 413 contents->SetLayoutManager(layout); |
406 | 414 |
407 const int single_column_view_set_id = 1; | 415 const int single_column_view_set_id = 1; |
408 ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id); | 416 ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id); |
409 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, | 417 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, |
410 GridLayout::USE_PREF, 0, 0); | 418 GridLayout::USE_PREF, 0, 0); |
411 | 419 |
| 420 const int double_column_view_set_id = 0; |
| 421 column_set = layout->AddColumnSet(double_column_view_set_id); |
| 422 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
| 423 GridLayout::USE_PREF, 0, 0); |
| 424 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
| 425 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
| 426 GridLayout::USE_PREF, 0, 0); |
| 427 |
412 layout->StartRow(0, single_column_view_set_id); | 428 layout->StartRow(0, single_column_view_set_id); |
413 layout->AddView(passwords_asktosave_radio_); | 429 layout->AddView(passwords_asktosave_radio_); |
414 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 430 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
415 layout->StartRow(0, single_column_view_set_id); | 431 layout->StartRow(0, single_column_view_set_id); |
416 layout->AddView(passwords_neversave_radio_); | 432 layout->AddView(passwords_neversave_radio_); |
417 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); | 433 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); |
418 layout->StartRow(0, single_column_view_set_id); | 434 layout->StartRow(0, double_column_view_set_id); |
419 layout->AddView(passwords_show_passwords_button_); | 435 layout->AddView(passwords_show_passwords_button_); |
| 436 layout->AddView(passwords_exceptions_button_); |
420 | 437 |
421 passwords_group_ = new OptionsGroupView( | 438 passwords_group_ = new OptionsGroupView( |
422 contents, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME), L"", | 439 contents, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME), L"", |
423 true); | 440 true); |
424 } | 441 } |
425 | 442 |
426 void ContentPageView::InitFormAutofillGroup() { | 443 void ContentPageView::InitFormAutofillGroup() { |
427 form_autofill_checkbox_ = new views::CheckBox( | 444 form_autofill_checkbox_ = new views::CheckBox( |
428 l10n_util::GetString(IDS_AUTOFILL_SAVEFORMS)); | 445 l10n_util::GetString(IDS_AUTOFILL_SAVEFORMS)); |
429 form_autofill_checkbox_->SetListener(this); | 446 form_autofill_checkbox_->SetListener(this); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 contents, | 497 contents, |
481 l10n_util::GetString(IDS_OPTIONS_FONTSANDLANGUAGES_GROUP_NAME), | 498 l10n_util::GetString(IDS_OPTIONS_FONTSANDLANGUAGES_GROUP_NAME), |
482 L"", true); | 499 L"", true); |
483 } | 500 } |
484 | 501 |
485 void ContentPageView::UpdateDownloadDirectoryDisplay() { | 502 void ContentPageView::UpdateDownloadDirectoryDisplay() { |
486 download_default_download_location_display_->SetFile( | 503 download_default_download_location_display_->SetFile( |
487 default_download_location_.GetValue()); | 504 default_download_location_.GetValue()); |
488 } | 505 } |
489 | 506 |
OLD | NEW |