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

Side by Side Diff: chrome/browser/ui/views/find_bar_view.h

Issue 5553002: Fix Find regression where text is not selected once you... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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) 2010 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 #ifndef CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "chrome/browser/ui/find_bar/find_notification_details.h" 10 #include "chrome/browser/ui/find_bar/find_notification_details.h"
(...skipping 29 matching lines...) Expand all
40 CLOSE_TAG, // The Close button (the 'X'). 40 CLOSE_TAG, // The Close button (the 'X').
41 }; 41 };
42 42
43 explicit FindBarView(FindBarHost* host); 43 explicit FindBarView(FindBarHost* host);
44 virtual ~FindBarView(); 44 virtual ~FindBarView();
45 45
46 // Gets/sets the text displayed in the text box. 46 // Gets/sets the text displayed in the text box.
47 string16 GetFindText() const; 47 string16 GetFindText() const;
48 void SetFindText(const string16& find_text); 48 void SetFindText(const string16& find_text);
49 49
50 // Gets the selected text in the text box.
51 string16 GetFindSelectedText() const;
52
50 // Gets the match count text displayed in the text box. 53 // Gets the match count text displayed in the text box.
51 string16 GetMatchCountText() const; 54 string16 GetMatchCountText() const;
52 55
53 // Updates the label inside the Find text box that shows the ordinal of the 56 // Updates the label inside the Find text box that shows the ordinal of the
54 // active item and how many matches were found. 57 // active item and how many matches were found.
55 void UpdateForResult(const FindNotificationDetails& result, 58 void UpdateForResult(const FindNotificationDetails& result,
56 const string16& find_text); 59 const string16& find_text);
57 60
58 // Clears the current Match Count value in the Find text box. 61 // Clears the current Match Count value in the Find text box.
59 void ClearMatchCount(); 62 void ClearMatchCount();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {} 101 : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {}
99 102
100 private: 103 private:
101 virtual bool OnMousePressed(const views::MouseEvent& event); 104 virtual bool OnMousePressed(const views::MouseEvent& event);
102 105
103 views::Textfield* view_to_focus_on_mousedown_; 106 views::Textfield* view_to_focus_on_mousedown_;
104 107
105 DISALLOW_COPY_AND_ASSIGN(FocusForwarderView); 108 DISALLOW_COPY_AND_ASSIGN(FocusForwarderView);
106 }; 109 };
107 110
111 // A wrapper of views::TextField that allows us to select all text when we
112 // get focus. Represents the text field where the user enters a search term.
113 class SearchTextfieldView : public views::Textfield {
Jay Civelli 2010/12/06 22:14:09 May be that could have been added as a property of
114 public:
115 SearchTextfieldView();
116 virtual ~SearchTextfieldView();
117
118 virtual void RequestFocus();
119
120 private:
121 DISALLOW_COPY_AND_ASSIGN(SearchTextfieldView);
122 };
123
108 // Returns the OS-specific view for the find bar that acts as an intermediary 124 // Returns the OS-specific view for the find bar that acts as an intermediary
109 // between us and the TabContentsView. 125 // between us and the TabContentsView.
110 FindBarHost* find_bar_host() const; 126 FindBarHost* find_bar_host() const;
111 127
112 #if defined(OS_LINUX) 128 #if defined(OS_LINUX)
113 // In gtk we get changed signals if we programatically set the text. If we 129 // In GTK we get changed signals if we programmatically set the text. If we
114 // don't ignore them we run into problems. For example, switching tabs back 130 // don't ignore them we run into problems. For example, switching tabs back
115 // to one with the find bar visible will cause a search to the next found 131 // to one with the find bar visible will cause a search to the next found
116 // text. Also if the find bar had been visible and then hidden and the user 132 // text. Also if the find bar had been visible and then hidden and the user
117 // switches back, found text will be highlighted again. 133 // switches back, found text will be highlighted again.
118 bool ignore_contents_changed_; 134 bool ignore_contents_changed_;
119 #endif 135 #endif
120 136
121 // The controls in the window. 137 // The controls in the window.
122 views::Textfield* find_text_; 138 SearchTextfieldView* find_text_;
123 views::Label* match_count_text_; 139 views::Label* match_count_text_;
124 FocusForwarderView* focus_forwarder_view_; 140 FocusForwarderView* focus_forwarder_view_;
125 views::ImageButton* find_previous_button_; 141 views::ImageButton* find_previous_button_;
126 views::ImageButton* find_next_button_; 142 views::ImageButton* find_next_button_;
127 views::ImageButton* close_button_; 143 views::ImageButton* close_button_;
128 144
129 DISALLOW_COPY_AND_ASSIGN(FindBarView); 145 DISALLOW_COPY_AND_ASSIGN(FindBarView);
130 }; 146 };
131 147
132 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ 148 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/find_bar_host_interactive_uitest.cc ('k') | chrome/browser/ui/views/find_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698