diff options
author | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-12 11:35:18 +0000 |
---|---|---|
committer | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-12 11:35:18 +0000 |
commit | dec720ec4bef489c3ada09f0cf075def343098bc (patch) | |
tree | e07575ea73fcb7a0607064e350d1bb82dc43c25d | |
parent | 21f699408c2e8ca3d17f59cd6bd69d65fc025121 (diff) | |
download | chromium_src-dec720ec4bef489c3ada09f0cf075def343098bc.zip chromium_src-dec720ec4bef489c3ada09f0cf075def343098bc.tar.gz chromium_src-dec720ec4bef489c3ada09f0cf075def343098bc.tar.bz2 |
This is an alternate CL to the fix in http://codereview.chromium.org/5553002.
The earlier fix changes the behaviour of the find bar text field such that
whenever the textfield is focused, all of the text inside it is selected. This
was done to fix a regression where the text was not getting selected when
switching tabs (read description on that issue for more info). However, this
new behaviour could be undesirable as we may not need to select the whole text
everytime find bar gains focus. Hence, in this fix, we undo the changes from
the earlier fix and add the selectall behaviour at the right place (when the
tab is switched).
BUG=none
TEST=Test added in the earlier CL still passes.
Review URL: http://codereview.chromium.org/6188005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71157 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/find_bar/find_bar_controller.cc | 1 | ||||
-rw-r--r-- | chrome/browser/ui/views/find_bar_view.cc | 13 | ||||
-rw-r--r-- | chrome/browser/ui/views/find_bar_view.h | 15 |
3 files changed, 3 insertions, 26 deletions
diff --git a/chrome/browser/ui/find_bar/find_bar_controller.cc b/chrome/browser/ui/find_bar/find_bar_controller.cc index 4f637e8..c0c2162 100644 --- a/chrome/browser/ui/find_bar/find_bar_controller.cc +++ b/chrome/browser/ui/find_bar/find_bar_controller.cc @@ -92,6 +92,7 @@ void FindBarController::ChangeTabContents(TabContents* contents) { // we don't surprise the user by popping up to the left for no apparent // reason. find_bar_->Show(false); + find_bar_->SetFocusAndSelection(); } UpdateFindBarForCurrentResult(); diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index cf2b359..5b643fd 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc @@ -97,7 +97,7 @@ FindBarView::FindBarView(FindBarHost* host) SetID(VIEW_ID_FIND_IN_PAGE); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - find_text_ = new SearchTextfieldView(); + find_text_ = new views::Textfield(); find_text_->SetID(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); find_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont)); find_text_->set_default_width_in_chars(kDefaultCharWidth); @@ -548,17 +548,6 @@ bool FindBarView::FocusForwarderView::OnMousePressed( return true; } -FindBarView::SearchTextfieldView::SearchTextfieldView() { -} - -FindBarView::SearchTextfieldView::~SearchTextfieldView() { -} - -void FindBarView::SearchTextfieldView::RequestFocus() { - views::View::RequestFocus(); - SelectAll(); -} - FindBarHost* FindBarView::find_bar_host() const { return static_cast<FindBarHost*>(host()); } diff --git a/chrome/browser/ui/views/find_bar_view.h b/chrome/browser/ui/views/find_bar_view.h index b535e02..2b743bd 100644 --- a/chrome/browser/ui/views/find_bar_view.h +++ b/chrome/browser/ui/views/find_bar_view.h @@ -108,19 +108,6 @@ class FindBarView : public DropdownBarView, DISALLOW_COPY_AND_ASSIGN(FocusForwarderView); }; - // A wrapper of views::TextField that allows us to select all text when we - // get focus. Represents the text field where the user enters a search term. - class SearchTextfieldView : public views::Textfield { - public: - SearchTextfieldView(); - virtual ~SearchTextfieldView(); - - virtual void RequestFocus(); - - private: - DISALLOW_COPY_AND_ASSIGN(SearchTextfieldView); - }; - // Returns the OS-specific view for the find bar that acts as an intermediary // between us and the TabContentsView. FindBarHost* find_bar_host() const; @@ -135,7 +122,7 @@ class FindBarView : public DropdownBarView, #endif // The controls in the window. - SearchTextfieldView* find_text_; + views::Textfield* find_text_; views::Label* match_count_text_; FocusForwarderView* focus_forwarder_view_; views::ImageButton* find_previous_button_; |