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

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

Issue 115825: Move text_field.cc and rename the class to Textfield in preparation for porti... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/gfx/png_decoder.h" 9 #include "base/gfx/png_decoder.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/common/pref_service.h" 29 #include "chrome/common/pref_service.h"
30 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
31 #include "grit/app_resources.h" 31 #include "grit/app_resources.h"
32 #include "grit/chromium_strings.h" 32 #include "grit/chromium_strings.h"
33 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
34 #include "net/base/net_util.h" 34 #include "net/base/net_util.h"
35 #include "third_party/skia/include/core/SkBitmap.h" 35 #include "third_party/skia/include/core/SkBitmap.h"
36 #include "views/controls/button/radio_button.h" 36 #include "views/controls/button/radio_button.h"
37 #include "views/controls/label.h" 37 #include "views/controls/label.h"
38 #include "views/controls/table/table_view.h" 38 #include "views/controls/table/table_view.h"
39 #include "views/controls/text_field.h" 39 #include "views/controls/textfield/textfield.h"
40 #include "views/grid_layout.h" 40 #include "views/grid_layout.h"
41 #include "views/standard_layout.h" 41 #include "views/standard_layout.h"
42 42
43 namespace { 43 namespace {
44 44
45 static const int kStartupRadioGroup = 1; 45 static const int kStartupRadioGroup = 1;
46 static const int kHomePageRadioGroup = 2; 46 static const int kHomePageRadioGroup = 2;
47 static const SkColor kDefaultBrowserLabelColor = SkColorSetRGB(0, 135, 0); 47 static const SkColor kDefaultBrowserLabelColor = SkColorSetRGB(0, 135, 0);
48 static const SkColor kNotDefaultBrowserLabelColor = SkColorSetRGB(135, 0, 0); 48 static const SkColor kNotDefaultBrowserLabelColor = SkColorSetRGB(135, 0, 0);
49 49
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 599
600 void GeneralPageView::ItemChanged(views::ComboBox* combo_box, 600 void GeneralPageView::ItemChanged(views::ComboBox* combo_box,
601 int prev_index, int new_index) { 601 int prev_index, int new_index) {
602 if (combo_box == default_search_engine_combobox_) { 602 if (combo_box == default_search_engine_combobox_) {
603 SetDefaultSearchProvider(); 603 SetDefaultSearchProvider();
604 UserMetricsRecordAction(L"Options_SearchEngineChanged", NULL); 604 UserMetricsRecordAction(L"Options_SearchEngineChanged", NULL);
605 } 605 }
606 } 606 }
607 607
608 /////////////////////////////////////////////////////////////////////////////// 608 ///////////////////////////////////////////////////////////////////////////////
609 // GeneralPageView, views::TextField::Controller implementation: 609 // GeneralPageView, views::Textfield::Controller implementation:
610 610
611 void GeneralPageView::ContentsChanged(views::TextField* sender, 611 void GeneralPageView::ContentsChanged(views::Textfield* sender,
612 const std::wstring& new_contents) { 612 const std::wstring& new_contents) {
613 if (sender == homepage_use_url_textfield_) { 613 if (sender == homepage_use_url_textfield_) {
614 // If the text field contains a valid URL, sync it to prefs. We run it 614 // If the text field contains a valid URL, sync it to prefs. We run it
615 // through the fixer upper to allow input like "google.com" to be converted 615 // through the fixer upper to allow input like "google.com" to be converted
616 // to something valid ("http://google.com"). 616 // to something valid ("http://google.com").
617 std::wstring url_string = URLFixerUpper::FixupURL( 617 std::wstring url_string = URLFixerUpper::FixupURL(
618 homepage_use_url_textfield_->GetText(), std::wstring()); 618 homepage_use_url_textfield_->GetText(), std::wstring());
619 if (GURL(url_string).is_valid()) 619 if (GURL(url_string).is_valid())
620 SetHomepage(url_string); 620 SetHomepage(url_string);
621 } 621 }
622 } 622 }
623 623
624 bool GeneralPageView::HandleKeystroke(views::TextField* sender, 624 bool GeneralPageView::HandleKeystroke(views::Textfield* sender,
625 const views::TextField::Keystroke&) { 625 const views::Textfield::Keystroke&) {
626 return false; 626 return false;
627 } 627 }
628 628
629 /////////////////////////////////////////////////////////////////////////////// 629 ///////////////////////////////////////////////////////////////////////////////
630 // GeneralPageView, OptionsPageView implementation: 630 // GeneralPageView, OptionsPageView implementation:
631 631
632 void GeneralPageView::InitControlLayout() { 632 void GeneralPageView::InitControlLayout() {
633 using views::GridLayout; 633 using views::GridLayout;
634 using views::ColumnSet; 634 using views::ColumnSet;
635 635
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 void GeneralPageView::InitHomepageGroup() { 867 void GeneralPageView::InitHomepageGroup() {
868 homepage_use_newtab_radio_ = new views::RadioButton( 868 homepage_use_newtab_radio_ = new views::RadioButton(
869 l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_NEWTAB), 869 l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_NEWTAB),
870 kHomePageRadioGroup); 870 kHomePageRadioGroup);
871 homepage_use_newtab_radio_->set_listener(this); 871 homepage_use_newtab_radio_->set_listener(this);
872 homepage_use_newtab_radio_->SetMultiLine(true); 872 homepage_use_newtab_radio_->SetMultiLine(true);
873 homepage_use_url_radio_ = new views::RadioButton( 873 homepage_use_url_radio_ = new views::RadioButton(
874 l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_URL), 874 l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_URL),
875 kHomePageRadioGroup); 875 kHomePageRadioGroup);
876 homepage_use_url_radio_->set_listener(this); 876 homepage_use_url_radio_->set_listener(this);
877 homepage_use_url_textfield_ = new views::TextField; 877 homepage_use_url_textfield_ = new views::Textfield;
878 homepage_use_url_textfield_->SetController(this); 878 homepage_use_url_textfield_->SetController(this);
879 homepage_show_home_button_checkbox_ = new views::Checkbox( 879 homepage_show_home_button_checkbox_ = new views::Checkbox(
880 l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_SHOW_BUTTON)); 880 l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_SHOW_BUTTON));
881 homepage_show_home_button_checkbox_->set_listener(this); 881 homepage_show_home_button_checkbox_->set_listener(this);
882 homepage_show_home_button_checkbox_->SetMultiLine(true); 882 homepage_show_home_button_checkbox_->SetMultiLine(true);
883 883
884 using views::GridLayout; 884 using views::GridLayout;
885 using views::ColumnSet; 885 using views::ColumnSet;
886 886
887 views::View* contents = new views::View; 887 views::View* contents = new views::View;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 homepage_use_url_textfield_->SetEnabled(false); 1084 homepage_use_url_textfield_->SetEnabled(false);
1085 homepage_use_url_textfield_->SetReadOnly(true); 1085 homepage_use_url_textfield_->SetReadOnly(true);
1086 } 1086 }
1087 } 1087 }
1088 1088
1089 void GeneralPageView::SetDefaultSearchProvider() { 1089 void GeneralPageView::SetDefaultSearchProvider() {
1090 const int index = default_search_engine_combobox_->GetSelectedItem(); 1090 const int index = default_search_engine_combobox_->GetSelectedItem();
1091 default_search_engines_model_->model()->SetDefaultSearchProvider( 1091 default_search_engines_model_->model()->SetDefaultSearchProvider(
1092 default_search_engines_model_->GetTemplateURLAt(index)); 1092 default_search_engines_model_->GetTemplateURLAt(index));
1093 } 1093 }
OLDNEW
« no previous file with comments | « chrome/browser/views/options/general_page_view.h ('k') | chrome/browser/views/options/languages_page_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698