OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {} | 101 : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {} |
102 | 102 |
103 private: | 103 private: |
104 virtual bool OnMousePressed(const views::MouseEvent& event); | 104 virtual bool OnMousePressed(const views::MouseEvent& event); |
105 | 105 |
106 views::Textfield* view_to_focus_on_mousedown_; | 106 views::Textfield* view_to_focus_on_mousedown_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(FocusForwarderView); | 108 DISALLOW_COPY_AND_ASSIGN(FocusForwarderView); |
109 }; | 109 }; |
110 | 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 { | |
114 public: | |
115 SearchTextfieldView(); | |
116 virtual ~SearchTextfieldView(); | |
117 | |
118 virtual void RequestFocus(); | |
119 | |
120 private: | |
121 DISALLOW_COPY_AND_ASSIGN(SearchTextfieldView); | |
122 }; | |
123 | |
124 // Returns the OS-specific view for the find bar that acts as an intermediary | 111 // Returns the OS-specific view for the find bar that acts as an intermediary |
125 // between us and the TabContentsView. | 112 // between us and the TabContentsView. |
126 FindBarHost* find_bar_host() const; | 113 FindBarHost* find_bar_host() const; |
127 | 114 |
128 #if defined(OS_LINUX) | 115 #if defined(OS_LINUX) |
129 // In GTK we get changed signals if we programmatically set the text. If we | 116 // In GTK we get changed signals if we programmatically set the text. If we |
130 // don't ignore them we run into problems. For example, switching tabs back | 117 // don't ignore them we run into problems. For example, switching tabs back |
131 // to one with the find bar visible will cause a search to the next found | 118 // to one with the find bar visible will cause a search to the next found |
132 // text. Also if the find bar had been visible and then hidden and the user | 119 // text. Also if the find bar had been visible and then hidden and the user |
133 // switches back, found text will be highlighted again. | 120 // switches back, found text will be highlighted again. |
134 bool ignore_contents_changed_; | 121 bool ignore_contents_changed_; |
135 #endif | 122 #endif |
136 | 123 |
137 // The controls in the window. | 124 // The controls in the window. |
138 SearchTextfieldView* find_text_; | 125 views::Textfield* find_text_; |
139 views::Label* match_count_text_; | 126 views::Label* match_count_text_; |
140 FocusForwarderView* focus_forwarder_view_; | 127 FocusForwarderView* focus_forwarder_view_; |
141 views::ImageButton* find_previous_button_; | 128 views::ImageButton* find_previous_button_; |
142 views::ImageButton* find_next_button_; | 129 views::ImageButton* find_next_button_; |
143 views::ImageButton* close_button_; | 130 views::ImageButton* close_button_; |
144 | 131 |
145 DISALLOW_COPY_AND_ASSIGN(FindBarView); | 132 DISALLOW_COPY_AND_ASSIGN(FindBarView); |
146 }; | 133 }; |
147 | 134 |
148 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ |
OLD | NEW |