OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 5 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 MaybeSetPrepopulateText(); | 86 MaybeSetPrepopulateText(); |
87 | 87 |
88 if (tab_contents_->find_ui_active()) { | 88 if (tab_contents_->find_ui_active()) { |
89 // A tab with a visible find bar just got selected and we need to show the | 89 // A tab with a visible find bar just got selected and we need to show the |
90 // find bar but without animation since it was already animated into its | 90 // find bar but without animation since it was already animated into its |
91 // visible state. We also want to reset the window location so that | 91 // visible state. We also want to reset the window location so that |
92 // we don't surprise the user by popping up to the left for no apparent | 92 // we don't surprise the user by popping up to the left for no apparent |
93 // reason. | 93 // reason. |
94 find_bar_->Show(false); | 94 find_bar_->Show(false); |
| 95 find_bar_->SetFocusAndSelection(); |
95 } | 96 } |
96 | 97 |
97 UpdateFindBarForCurrentResult(); | 98 UpdateFindBarForCurrentResult(); |
98 } | 99 } |
99 | 100 |
100 //////////////////////////////////////////////////////////////////////////////// | 101 //////////////////////////////////////////////////////////////////////////////// |
101 // FindBarHost, NotificationObserver implementation: | 102 // FindBarHost, NotificationObserver implementation: |
102 | 103 |
103 void FindBarController::Observe(NotificationType type, | 104 void FindBarController::Observe(NotificationType type, |
104 const NotificationSource& source, | 105 const NotificationSource& source, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // shown it is showing the right state for this tab. We update the find text | 220 // shown it is showing the right state for this tab. We update the find text |
220 // _first_ since the FindBarView checks its emptiness to see if it should | 221 // _first_ since the FindBarView checks its emptiness to see if it should |
221 // clear the result count display when there's nothing in the box. | 222 // clear the result count display when there's nothing in the box. |
222 find_bar_->SetFindText(find_string); | 223 find_bar_->SetFindText(find_string); |
223 #else | 224 #else |
224 // Having a per-tab find_string is not compatible with OS X's find pasteboard, | 225 // Having a per-tab find_string is not compatible with OS X's find pasteboard, |
225 // so we always have the same find text in all find bars. This is done through | 226 // so we always have the same find text in all find bars. This is done through |
226 // the find pasteboard mechanism, so don't set the text here. | 227 // the find pasteboard mechanism, so don't set the text here. |
227 #endif | 228 #endif |
228 } | 229 } |
OLD | NEW |