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

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

Issue 113940: Make Textfield more portable.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « chrome/browser/views/options/cookies_view.cc ('k') | chrome/browser/views/shelf_item_dialog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } else if (sender == startup_use_current_page_button_) { 563 } else if (sender == startup_use_current_page_button_) {
564 SetStartupURLToCurrentPage(); 564 SetStartupURLToCurrentPage();
565 } else if (sender == homepage_use_newtab_radio_) { 565 } else if (sender == homepage_use_newtab_radio_) {
566 UserMetricsRecordAction(L"Options_Homepage_UseNewTab", 566 UserMetricsRecordAction(L"Options_Homepage_UseNewTab",
567 profile()->GetPrefs()); 567 profile()->GetPrefs());
568 SetHomepage(GetNewTabUIURLString()); 568 SetHomepage(GetNewTabUIURLString());
569 EnableHomepageURLField(false); 569 EnableHomepageURLField(false);
570 } else if (sender == homepage_use_url_radio_) { 570 } else if (sender == homepage_use_url_radio_) {
571 UserMetricsRecordAction(L"Options_Homepage_UseURL", 571 UserMetricsRecordAction(L"Options_Homepage_UseURL",
572 profile()->GetPrefs()); 572 profile()->GetPrefs());
573 SetHomepage(homepage_use_url_textfield_->GetText()); 573 SetHomepage(homepage_use_url_textfield_->text());
574 EnableHomepageURLField(true); 574 EnableHomepageURLField(true);
575 } else if (sender == homepage_show_home_button_checkbox_) { 575 } else if (sender == homepage_show_home_button_checkbox_) {
576 bool show_button = homepage_show_home_button_checkbox_->checked(); 576 bool show_button = homepage_show_home_button_checkbox_->checked();
577 if (show_button) { 577 if (show_button) {
578 UserMetricsRecordAction(L"Options_Homepage_ShowHomeButton", 578 UserMetricsRecordAction(L"Options_Homepage_ShowHomeButton",
579 profile()->GetPrefs()); 579 profile()->GetPrefs());
580 } else { 580 } else {
581 UserMetricsRecordAction(L"Options_Homepage_HideHomeButton", 581 UserMetricsRecordAction(L"Options_Homepage_HideHomeButton",
582 profile()->GetPrefs()); 582 profile()->GetPrefs());
583 } 583 }
(...skipping 24 matching lines...) Expand all
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_->text(), 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
(...skipping 455 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/cookies_view.cc ('k') | chrome/browser/views/shelf_item_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698