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