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 #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 "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 registrar_.Add(this, | 105 registrar_.Add(this, |
106 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, | 106 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, |
107 content::Source<WebContents>(web_contents_)); | 107 content::Source<WebContents>(web_contents_)); |
108 registrar_.Add( | 108 registrar_.Add( |
109 this, | 109 this, |
110 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 110 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
111 content::Source<NavigationController>(&web_contents_->GetController())); | 111 content::Source<NavigationController>(&web_contents_->GetController())); |
112 | 112 |
113 MaybeSetPrepopulateText(); | 113 MaybeSetPrepopulateText(); |
114 | 114 |
| 115 // Disappearing Findbox. |
| 116 if (find_tab_helper && find_tab_helper->isloading_at_tabchange()) { |
| 117 find_tab_helper->set_isloading_at_tabchange(false); |
| 118 EndFindSession(kKeepSelectionOnPage, kClearResultsInFindBox); |
| 119 return; |
| 120 } |
| 121 |
115 if (find_tab_helper && find_tab_helper->find_ui_active()) { | 122 if (find_tab_helper && find_tab_helper->find_ui_active()) { |
116 // A tab with a visible find bar just got selected and we need to show the | 123 // A tab with a visible find bar just got selected and we need to show the |
117 // find bar but without animation since it was already animated into its | 124 // find bar but without animation since it was already animated into its |
118 // visible state. We also want to reset the window location so that | 125 // visible state. We also want to reset the window location so that |
119 // we don't surprise the user by popping up to the left for no apparent | 126 // we don't surprise the user by popping up to the left for no apparent |
120 // reason. | 127 // reason. |
121 find_bar_->Show(false); | 128 find_bar_->Show(false); |
122 } | 129 } |
123 | 130 |
124 UpdateFindBarForCurrentResult(); | 131 UpdateFindBarForCurrentResult(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 267 } |
261 | 268 |
262 // Update the find bar with existing results and search text, regardless of | 269 // Update the find bar with existing results and search text, regardless of |
263 // whether or not the find bar is visible, so that if it's subsequently | 270 // whether or not the find bar is visible, so that if it's subsequently |
264 // shown it is showing the right state for this tab. We update the find text | 271 // shown it is showing the right state for this tab. We update the find text |
265 // _first_ since the FindBarView checks its emptiness to see if it should | 272 // _first_ since the FindBarView checks its emptiness to see if it should |
266 // clear the result count display when there's nothing in the box. | 273 // clear the result count display when there's nothing in the box. |
267 find_bar_->SetFindTextAndSelectedRange(find_string, | 274 find_bar_->SetFindTextAndSelectedRange(find_string, |
268 find_tab_helper->selected_range()); | 275 find_tab_helper->selected_range()); |
269 } | 276 } |
OLD | NEW |