OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/find_bar_controller.h" | 5 #include "chrome/browser/find_bar_controller.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/find_bar.h" | 9 #include "chrome/browser/find_bar.h" |
10 #include "chrome/browser/tab_contents/navigation_entry.h" | 10 #include "chrome/browser/tab_contents/navigation_entry.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // we don't surprise the user by popping up to the left for no apparent | 96 // we don't surprise the user by popping up to the left for no apparent |
97 // reason. | 97 // reason. |
98 gfx::Rect new_pos = find_bar_->GetDialogPosition(gfx::Rect()); | 98 gfx::Rect new_pos = find_bar_->GetDialogPosition(gfx::Rect()); |
99 find_bar_->SetDialogPosition(new_pos, false); | 99 find_bar_->SetDialogPosition(new_pos, false); |
100 } | 100 } |
101 | 101 |
102 UpdateFindBarForCurrentResult(); | 102 UpdateFindBarForCurrentResult(); |
103 } | 103 } |
104 | 104 |
105 //////////////////////////////////////////////////////////////////////////////// | 105 //////////////////////////////////////////////////////////////////////////////// |
106 // FindBarWin, NotificationObserver implementation: | 106 // FindBarHost, NotificationObserver implementation: |
107 | 107 |
108 void FindBarController::Observe(NotificationType type, | 108 void FindBarController::Observe(NotificationType type, |
109 const NotificationSource& source, | 109 const NotificationSource& source, |
110 const NotificationDetails& details) { | 110 const NotificationDetails& details) { |
111 if (type == NotificationType::FIND_RESULT_AVAILABLE) { | 111 if (type == NotificationType::FIND_RESULT_AVAILABLE) { |
112 // Don't update for notifications from TabContentses other than the one we | 112 // Don't update for notifications from TabContentses other than the one we |
113 // are actively tracking. | 113 // are actively tracking. |
114 if (Source<TabContents>(source).ptr() == tab_contents_) { | 114 if (Source<TabContents>(source).ptr() == tab_contents_) { |
115 UpdateFindBarForCurrentResult(); | 115 UpdateFindBarForCurrentResult(); |
116 if (tab_contents_->find_result().final_update() && | 116 if (tab_contents_->find_result().final_update() && |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 if (find_result.number_of_matches() > -1) { | 195 if (find_result.number_of_matches() > -1) { |
196 if (last_reported_matchcount_ > 0 && | 196 if (last_reported_matchcount_ > 0 && |
197 find_result.number_of_matches() == 1 && | 197 find_result.number_of_matches() == 1 && |
198 !find_result.final_update()) | 198 !find_result.final_update()) |
199 return; // Don't let interim result override match count. | 199 return; // Don't let interim result override match count. |
200 last_reported_matchcount_ = find_result.number_of_matches(); | 200 last_reported_matchcount_ = find_result.number_of_matches(); |
201 } | 201 } |
202 | 202 |
203 find_bar_->UpdateUIForFindResult(find_result, tab_contents_->find_text()); | 203 find_bar_->UpdateUIForFindResult(find_result, tab_contents_->find_text()); |
204 } | 204 } |
OLD | NEW |