OLD | NEW |
1 // Copyright (c) 2009 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/general_page_view.h" | 5 #include "chrome/browser/views/options/general_page_view.h" |
6 | 6 |
7 #include "app/combobox_model.h" | 7 #include "app/combobox_model.h" |
8 #include "app/gfx/codec/png_codec.h" | 8 #include "app/gfx/codec/png_codec.h" |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 button_stack_layout->AddView(startup_remove_custom_page_button_, | 751 button_stack_layout->AddView(startup_remove_custom_page_button_, |
752 1, 1, GridLayout::FILL, GridLayout::CENTER); | 752 1, 1, GridLayout::FILL, GridLayout::CENTER); |
753 button_stack_layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 753 button_stack_layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
754 button_stack_layout->StartRow(0, single_column_view_set_id); | 754 button_stack_layout->StartRow(0, single_column_view_set_id); |
755 button_stack_layout->AddView(startup_use_current_page_button_, | 755 button_stack_layout->AddView(startup_use_current_page_button_, |
756 1, 1, GridLayout::FILL, GridLayout::CENTER); | 756 1, 1, GridLayout::FILL, GridLayout::CENTER); |
757 layout->AddView(button_stack); | 757 layout->AddView(button_stack); |
758 | 758 |
759 startup_group_ = new OptionsGroupView( | 759 startup_group_ = new OptionsGroupView( |
760 contents, l10n_util::GetString(IDS_OPTIONS_STARTUP_GROUP_NAME), | 760 contents, l10n_util::GetString(IDS_OPTIONS_STARTUP_GROUP_NAME), |
761 EmptyWString(), true); | 761 std::wstring(), true); |
762 } | 762 } |
763 | 763 |
764 void GeneralPageView::InitHomepageGroup() { | 764 void GeneralPageView::InitHomepageGroup() { |
765 homepage_use_newtab_radio_ = new views::RadioButton( | 765 homepage_use_newtab_radio_ = new views::RadioButton( |
766 l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_NEWTAB), | 766 l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_NEWTAB), |
767 kHomePageRadioGroup); | 767 kHomePageRadioGroup); |
768 homepage_use_newtab_radio_->set_listener(this); | 768 homepage_use_newtab_radio_->set_listener(this); |
769 homepage_use_newtab_radio_->SetMultiLine(true); | 769 homepage_use_newtab_radio_->SetMultiLine(true); |
770 homepage_use_url_radio_ = new views::RadioButton( | 770 homepage_use_url_radio_ = new views::RadioButton( |
771 l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_URL), | 771 l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_URL), |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 803 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
804 layout->StartRow(0, double_column_view_set_id); | 804 layout->StartRow(0, double_column_view_set_id); |
805 layout->AddView(homepage_use_url_radio_); | 805 layout->AddView(homepage_use_url_radio_); |
806 layout->AddView(homepage_use_url_textfield_); | 806 layout->AddView(homepage_use_url_textfield_); |
807 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 807 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
808 layout->StartRow(0, single_column_view_set_id); | 808 layout->StartRow(0, single_column_view_set_id); |
809 layout->AddView(homepage_show_home_button_checkbox_); | 809 layout->AddView(homepage_show_home_button_checkbox_); |
810 | 810 |
811 homepage_group_ = new OptionsGroupView( | 811 homepage_group_ = new OptionsGroupView( |
812 contents, l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_GROUP_NAME), | 812 contents, l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_GROUP_NAME), |
813 EmptyWString(), true); | 813 std::wstring(), true); |
814 } | 814 } |
815 | 815 |
816 | 816 |
817 void GeneralPageView::InitDefaultSearchGroup() { | 817 void GeneralPageView::InitDefaultSearchGroup() { |
818 default_search_engines_model_.reset(new SearchEngineListModel(profile())); | 818 default_search_engines_model_.reset(new SearchEngineListModel(profile())); |
819 default_search_engine_combobox_ = | 819 default_search_engine_combobox_ = |
820 new views::Combobox(default_search_engines_model_.get()); | 820 new views::Combobox(default_search_engines_model_.get()); |
821 default_search_engines_model_->SetCombobox(default_search_engine_combobox_); | 821 default_search_engines_model_->SetCombobox(default_search_engine_combobox_); |
822 default_search_engine_combobox_->set_listener(this); | 822 default_search_engine_combobox_->set_listener(this); |
823 | 823 |
(...skipping 15 matching lines...) Expand all Loading... |
839 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 839 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
840 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | 840 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, |
841 GridLayout::USE_PREF, 0, 0); | 841 GridLayout::USE_PREF, 0, 0); |
842 | 842 |
843 layout->StartRow(0, double_column_view_set_id); | 843 layout->StartRow(0, double_column_view_set_id); |
844 layout->AddView(default_search_engine_combobox_); | 844 layout->AddView(default_search_engine_combobox_); |
845 layout->AddView(default_search_manage_engines_button_); | 845 layout->AddView(default_search_manage_engines_button_); |
846 | 846 |
847 default_search_group_ = new OptionsGroupView( | 847 default_search_group_ = new OptionsGroupView( |
848 contents, l10n_util::GetString(IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME), | 848 contents, l10n_util::GetString(IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME), |
849 EmptyWString(), true); | 849 std::wstring(), true); |
850 } | 850 } |
851 | 851 |
852 void GeneralPageView::InitDefaultBrowserGroup() { | 852 void GeneralPageView::InitDefaultBrowserGroup() { |
853 default_browser_status_label_ = new views::Label; | 853 default_browser_status_label_ = new views::Label; |
854 default_browser_status_label_->SetMultiLine(true); | 854 default_browser_status_label_->SetMultiLine(true); |
855 default_browser_status_label_->SetHorizontalAlignment( | 855 default_browser_status_label_->SetHorizontalAlignment( |
856 views::Label::ALIGN_LEFT); | 856 views::Label::ALIGN_LEFT); |
857 default_browser_use_as_default_button_ = new views::NativeButton( | 857 default_browser_use_as_default_button_ = new views::NativeButton( |
858 this, | 858 this, |
859 l10n_util::GetStringF(IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT, | 859 l10n_util::GetStringF(IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT, |
(...skipping 12 matching lines...) Expand all Loading... |
872 GridLayout::USE_PREF, 0, 0); | 872 GridLayout::USE_PREF, 0, 0); |
873 | 873 |
874 layout->StartRow(0, single_column_view_set_id); | 874 layout->StartRow(0, single_column_view_set_id); |
875 layout->AddView(default_browser_status_label_); | 875 layout->AddView(default_browser_status_label_); |
876 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); | 876 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); |
877 layout->StartRow(0, single_column_view_set_id); | 877 layout->StartRow(0, single_column_view_set_id); |
878 layout->AddView(default_browser_use_as_default_button_); | 878 layout->AddView(default_browser_use_as_default_button_); |
879 | 879 |
880 default_browser_group_ = new OptionsGroupView( | 880 default_browser_group_ = new OptionsGroupView( |
881 contents, l10n_util::GetString(IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME), | 881 contents, l10n_util::GetString(IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME), |
882 EmptyWString(), false); | 882 std::wstring(), false); |
883 | 883 |
884 default_browser_worker_->StartCheckDefaultBrowser(); | 884 default_browser_worker_->StartCheckDefaultBrowser(); |
885 } | 885 } |
886 | 886 |
887 void GeneralPageView::SaveStartupPref() { | 887 void GeneralPageView::SaveStartupPref() { |
888 SessionStartupPref pref; | 888 SessionStartupPref pref; |
889 | 889 |
890 if (startup_last_session_radio_->checked()) { | 890 if (startup_last_session_radio_->checked()) { |
891 pref.type = SessionStartupPref::LAST; | 891 pref.type = SessionStartupPref::LAST; |
892 } else if (startup_custom_radio_->checked()) { | 892 } else if (startup_custom_radio_->checked()) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 homepage_use_url_textfield_->SetEnabled(false); | 992 homepage_use_url_textfield_->SetEnabled(false); |
993 homepage_use_url_textfield_->SetReadOnly(true); | 993 homepage_use_url_textfield_->SetReadOnly(true); |
994 } | 994 } |
995 } | 995 } |
996 | 996 |
997 void GeneralPageView::SetDefaultSearchProvider() { | 997 void GeneralPageView::SetDefaultSearchProvider() { |
998 const int index = default_search_engine_combobox_->selected_item(); | 998 const int index = default_search_engine_combobox_->selected_item(); |
999 default_search_engines_model_->model()->SetDefaultSearchProvider( | 999 default_search_engines_model_->model()->SetDefaultSearchProvider( |
1000 default_search_engines_model_->GetTemplateURLAt(index)); | 1000 default_search_engines_model_->GetTemplateURLAt(index)); |
1001 } | 1001 } |
OLD | NEW |