Chromium Code Reviews| Index: chrome/browser/ui/views/find_bar_view.cc |
| diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc |
| index 2920f2a95d137ebc9a1c37ca66968f6d944a76eb..9a1264bce75b92cb8c42789ad0bec9581648749c 100644 |
| --- a/chrome/browser/ui/views/find_bar_view.cc |
| +++ b/chrome/browser/ui/views/find_bar_view.cc |
| @@ -26,6 +26,7 @@ |
| #include "views/background.h" |
| #include "views/controls/button/image_button.h" |
| #include "views/controls/label.h" |
| +#include "views/focus/focus_manager.h" |
| #include "views/widget/widget.h" |
| // The amount of whitespace to have before the find button. |
| @@ -223,6 +224,24 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result, |
| } |
| void FindBarView::SetFocusAndSelection(bool select_all) { |
| +#if defined(OS_CHROMEOS) |
| + // TODO(altimofeev): this workaround is needed only when the FindBar was |
| + // opened from the wrench menu (it also works in the accelerator case, but it |
| + // is not really needed). |
| + |
| + // Restore focus to allow the find bar's external focus tracker save the view |
|
Finnur
2010/11/16 17:08:28
nit: save -> to save.
altimofeev
2010/11/17 09:58:11
Done.
|
| + // that should be activated later (the tracker is created after the wrench |
| + // menu has got the focus). |
|
Finnur
2010/11/16 17:08:28
nit: got -> gotten. You can also use 'received'.
altimofeev
2010/11/17 09:58:11
I have settled on 'received'.
|
| + find_text_->GetFocusManager()->RestoreFocusedView(); |
| + // Request focus for the textfield. |
|
Finnur
2010/11/16 17:08:28
nit: this comment is redundant.
altimofeev
2010/11/17 09:58:11
Done.
|
| + find_text_->RequestFocus(); |
| + // Storing is needed here because the view that has focus before the wrench |
| + // menu activation will get focus just after the wrench menu is closed. |
| + // The FindBar has it's own focus tracker, so it will focus the correct view |
| + // on close. |
| + find_text_->GetFocusManager()->StoreFocusedView(); |
| + // Request focus again since call to StoreFocusedView unfocuses the view. |
|
Finnur
2010/11/16 17:08:28
nit: call -> the call.
altimofeev
2010/11/17 09:58:11
Done.
|
| +#endif |
| find_text_->RequestFocus(); |
| if (select_all && !find_text_->text().empty()) |
| find_text_->SelectAll(); |