| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 const content::NotificationSource& source, | 133 const content::NotificationSource& source, |
| 134 const content::NotificationDetails& details) { | 134 const content::NotificationDetails& details) { |
| 135 FindTabHelper* find_tab_helper = | 135 FindTabHelper* find_tab_helper = |
| 136 FindTabHelper::FromWebContents(web_contents_); | 136 FindTabHelper::FromWebContents(web_contents_); |
| 137 if (type == chrome::NOTIFICATION_FIND_RESULT_AVAILABLE) { | 137 if (type == chrome::NOTIFICATION_FIND_RESULT_AVAILABLE) { |
| 138 // Don't update for notifications from WebContentses other than the one we | 138 // Don't update for notifications from WebContentses other than the one we |
| 139 // are actively tracking. | 139 // are actively tracking. |
| 140 if (content::Source<WebContents>(source).ptr() == web_contents_) { | 140 if (content::Source<WebContents>(source).ptr() == web_contents_) { |
| 141 UpdateFindBarForCurrentResult(); | 141 UpdateFindBarForCurrentResult(); |
| 142 if (find_tab_helper->find_result().final_update() && | 142 if (find_tab_helper->find_result().final_update() && |
| 143 find_tab_helper->find_result().number_of_matches() == 0) { | 143 find_tab_helper->find_result().number_of_matches() == 0 && |
| 144 !find_tab_helper->find_result().was_frame_removal()) { |
| 144 const base::string16& last_search = | 145 const base::string16& last_search = |
| 145 find_tab_helper->previous_find_text(); | 146 find_tab_helper->previous_find_text(); |
| 146 const base::string16& current_search = find_tab_helper->find_text(); | 147 const base::string16& current_search = find_tab_helper->find_text(); |
| 147 if (!base::StartsWith(last_search, current_search, | 148 if (!base::StartsWith(last_search, current_search, |
| 148 base::CompareCase::SENSITIVE)) { | 149 base::CompareCase::SENSITIVE)) { |
| 149 find_bar_->AudibleAlert(); | 150 find_bar_->AudibleAlert(); |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 } | 153 } |
| 153 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { | 154 } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 254 } |
| 254 | 255 |
| 255 // Update the find bar with existing results and search text, regardless of | 256 // Update the find bar with existing results and search text, regardless of |
| 256 // whether or not the find bar is visible, so that if it's subsequently | 257 // whether or not the find bar is visible, so that if it's subsequently |
| 257 // shown it is showing the right state for this tab. We update the find text | 258 // shown it is showing the right state for this tab. We update the find text |
| 258 // _first_ since the FindBarView checks its emptiness to see if it should | 259 // _first_ since the FindBarView checks its emptiness to see if it should |
| 259 // clear the result count display when there's nothing in the box. | 260 // clear the result count display when there's nothing in the box. |
| 260 find_bar_->SetFindTextAndSelectedRange(find_string, | 261 find_bar_->SetFindTextAndSelectedRange(find_string, |
| 261 find_tab_helper->selected_range()); | 262 find_tab_helper->selected_range()); |
| 262 } | 263 } |
| OLD | NEW |