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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // views::ButtonListener: | 74 // views::ButtonListener: |
75 virtual void ButtonPressed(views::Button* sender, | 75 virtual void ButtonPressed(views::Button* sender, |
76 const ui::Event& event) OVERRIDE; | 76 const ui::Event& event) OVERRIDE; |
77 | 77 |
78 // views::TextfieldController: | 78 // views::TextfieldController: |
79 virtual void ContentsChanged(views::Textfield* sender, | 79 virtual void ContentsChanged(views::Textfield* sender, |
80 const string16& new_contents) OVERRIDE; | 80 const string16& new_contents) OVERRIDE; |
81 virtual bool HandleKeyEvent(views::Textfield* sender, | 81 virtual bool HandleKeyEvent(views::Textfield* sender, |
82 const ui::KeyEvent& key_event) OVERRIDE; | 82 const ui::KeyEvent& key_event) OVERRIDE; |
| 83 virtual void OnAfterUserAction(views::Textfield* sender) OVERRIDE; |
| 84 virtual void OnAfterPaste() OVERRIDE; |
83 | 85 |
84 private: | 86 private: |
85 // Update the appearance for the match count label. | 87 // Starts finding |search_text|. If the text is empty, stops finding. |
| 88 void Find(const string16& search_text); |
| 89 |
| 90 // Updates the appearance for the match count label. |
86 void UpdateMatchCountAppearance(bool no_match); | 91 void UpdateMatchCountAppearance(bool no_match); |
87 | 92 |
88 // views::View: | 93 // views::View: |
89 virtual void OnThemeChanged() OVERRIDE; | 94 virtual void OnThemeChanged() OVERRIDE; |
90 | 95 |
91 // We use a hidden view to grab mouse clicks and bring focus to the find | 96 // We use a hidden view to grab mouse clicks and bring focus to the find |
92 // text box. This is because although the find text box may look like it | 97 // text box. This is because although the find text box may look like it |
93 // extends all the way to the find button, it only goes as far as to the | 98 // extends all the way to the find button, it only goes as far as to the |
94 // match_count label. The user, however, expects being able to click anywhere | 99 // match_count label. The user, however, expects being able to click anywhere |
95 // inside what looks like the find text box (including on or around the | 100 // inside what looks like the find text box (including on or around the |
(...skipping 29 matching lines...) Expand all Loading... |
125 private: | 130 private: |
126 bool select_all_on_focus_; | 131 bool select_all_on_focus_; |
127 | 132 |
128 DISALLOW_COPY_AND_ASSIGN(SearchTextfieldView); | 133 DISALLOW_COPY_AND_ASSIGN(SearchTextfieldView); |
129 }; | 134 }; |
130 | 135 |
131 // Returns the OS-specific view for the find bar that acts as an intermediary | 136 // Returns the OS-specific view for the find bar that acts as an intermediary |
132 // between us and the WebContentsView. | 137 // between us and the WebContentsView. |
133 FindBarHost* find_bar_host() const; | 138 FindBarHost* find_bar_host() const; |
134 | 139 |
| 140 // Used to detect if the input text, not including the IME composition text, |
| 141 // has changed or not. |
| 142 string16 last_searched_text_; |
| 143 |
135 // The controls in the window. | 144 // The controls in the window. |
136 SearchTextfieldView* find_text_; | 145 SearchTextfieldView* find_text_; |
137 views::Label* match_count_text_; | 146 views::Label* match_count_text_; |
138 FocusForwarderView* focus_forwarder_view_; | 147 FocusForwarderView* focus_forwarder_view_; |
139 views::ImageButton* find_previous_button_; | 148 views::ImageButton* find_previous_button_; |
140 views::ImageButton* find_next_button_; | 149 views::ImageButton* find_next_button_; |
141 views::ImageButton* close_button_; | 150 views::ImageButton* close_button_; |
142 | 151 |
143 // The preferred height of the find bar. | 152 // The preferred height of the find bar. |
144 int preferred_height_; | 153 int preferred_height_; |
145 | 154 |
146 // The background image for the Find text box, which we draw behind the Find | 155 // The background image for the Find text box, which we draw behind the Find |
147 // box to provide the Chrome look to the edge of the text box. | 156 // box to provide the Chrome look to the edge of the text box. |
148 const gfx::ImageSkia* text_box_background_; | 157 const gfx::ImageSkia* text_box_background_; |
149 | 158 |
150 // The rounded edge on the left side of the Find text box. | 159 // The rounded edge on the left side of the Find text box. |
151 const gfx::ImageSkia* text_box_background_left_; | 160 const gfx::ImageSkia* text_box_background_left_; |
152 | 161 |
153 DISALLOW_COPY_AND_ASSIGN(FindBarView); | 162 DISALLOW_COPY_AND_ASSIGN(FindBarView); |
154 }; | 163 }; |
155 | 164 |
156 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ | 165 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ |
OLD | NEW |