OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "chrome/browser/ui/views/dropdown_bar_view.h" | 10 #include "chrome/browser/ui/views/dropdown_bar_view.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {} | 103 : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {} |
104 | 104 |
105 private: | 105 private: |
106 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 106 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
107 | 107 |
108 views::Textfield* view_to_focus_on_mousedown_; | 108 views::Textfield* view_to_focus_on_mousedown_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(FocusForwarderView); | 110 DISALLOW_COPY_AND_ASSIGN(FocusForwarderView); |
111 }; | 111 }; |
112 | 112 |
| 113 // A wrapper of views::TextField that allows us to select all text when we |
| 114 // get focus. Represents the text field where the user enters a search term. |
| 115 class SearchTextfieldView : public views::Textfield { |
| 116 public: |
| 117 SearchTextfieldView(); |
| 118 virtual ~SearchTextfieldView(); |
| 119 |
| 120 virtual void RequestFocus() OVERRIDE; |
| 121 |
| 122 private: |
| 123 DISALLOW_COPY_AND_ASSIGN(SearchTextfieldView); |
| 124 }; |
| 125 |
113 // Returns the OS-specific view for the find bar that acts as an intermediary | 126 // Returns the OS-specific view for the find bar that acts as an intermediary |
114 // between us and the WebContentsView. | 127 // between us and the WebContentsView. |
115 FindBarHost* find_bar_host() const; | 128 FindBarHost* find_bar_host() const; |
116 | 129 |
117 // The controls in the window. | 130 // The controls in the window. |
118 views::Textfield* find_text_; | 131 SearchTextfieldView* find_text_; |
119 views::Label* match_count_text_; | 132 views::Label* match_count_text_; |
120 FocusForwarderView* focus_forwarder_view_; | 133 FocusForwarderView* focus_forwarder_view_; |
121 views::ImageButton* find_previous_button_; | 134 views::ImageButton* find_previous_button_; |
122 views::ImageButton* find_next_button_; | 135 views::ImageButton* find_next_button_; |
123 views::ImageButton* close_button_; | 136 views::ImageButton* close_button_; |
124 | 137 |
125 // The preferred height of the find bar. | 138 // The preferred height of the find bar. |
126 int preferred_height_; | 139 int preferred_height_; |
127 | 140 |
128 // The background image for the Find text box, which we draw behind the Find | 141 // The background image for the Find text box, which we draw behind the Find |
129 // box to provide the Chrome look to the edge of the text box. | 142 // box to provide the Chrome look to the edge of the text box. |
130 const gfx::ImageSkia* text_box_background_; | 143 const gfx::ImageSkia* text_box_background_; |
131 | 144 |
132 // The rounded edge on the left side of the Find text box. | 145 // The rounded edge on the left side of the Find text box. |
133 const gfx::ImageSkia* text_box_background_left_; | 146 const gfx::ImageSkia* text_box_background_left_; |
134 | 147 |
135 DISALLOW_COPY_AND_ASSIGN(FindBarView); | 148 DISALLOW_COPY_AND_ASSIGN(FindBarView); |
136 }; | 149 }; |
137 | 150 |
138 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ | 151 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ |
OLD | NEW |