| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/find_bar_win.h" | 5 #include "chrome/browser/views/find_bar_win.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/renderer_host/render_view_host.h" | 9 #include "chrome/browser/renderer_host/render_view_host.h" |
| 10 #include "chrome/browser/view_ids.h" | 10 #include "chrome/browser/view_ids.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 Source<TabContents>(web_contents_)); | 218 Source<TabContents>(web_contents_)); |
| 219 NotificationService::current()->RemoveObserver( | 219 NotificationService::current()->RemoveObserver( |
| 220 this, NotificationType::NAV_ENTRY_COMMITTED, | 220 this, NotificationType::NAV_ENTRY_COMMITTED, |
| 221 Source<NavigationController>(web_contents_->controller())); | 221 Source<NavigationController>(web_contents_->controller())); |
| 222 if (animation_->IsAnimating()) | 222 if (animation_->IsAnimating()) |
| 223 animation_->End(); | 223 animation_->End(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 web_contents_ = contents; | 226 web_contents_ = contents; |
| 227 | 227 |
| 228 // Hide any visible find window from the previous tab if NULL |web_contents| |
| 229 // is passed in or if the find UI is not active in the new tab. |
| 230 if (IsVisible() && (!web_contents_ || !web_contents_->find_ui_active())) |
| 231 ShowWindow(SW_HIDE); |
| 232 |
| 228 if (web_contents_) { | 233 if (web_contents_) { |
| 229 if (IsVisible() && web_contents_ && !web_contents_->find_ui_active()) | |
| 230 ShowWindow(SW_HIDE); | |
| 231 | |
| 232 NotificationService::current()->AddObserver( | 234 NotificationService::current()->AddObserver( |
| 233 this, NotificationType::FIND_RESULT_AVAILABLE, | 235 this, NotificationType::FIND_RESULT_AVAILABLE, |
| 234 Source<TabContents>(web_contents_)); | 236 Source<TabContents>(web_contents_)); |
| 235 NotificationService::current()->AddObserver( | 237 NotificationService::current()->AddObserver( |
| 236 this, NotificationType::NAV_ENTRY_COMMITTED, | 238 this, NotificationType::NAV_ENTRY_COMMITTED, |
| 237 Source<NavigationController>(web_contents_->controller())); | 239 Source<NavigationController>(web_contents_->controller())); |
| 238 | 240 |
| 239 // Update the find bar with existing results and search text, regardless of | 241 // Update the find bar with existing results and search text, regardless of |
| 240 // whether or not the find bar is visible, so that if it's subsequently | 242 // whether or not the find bar is visible, so that if it's subsequently |
| 241 // shown it is showing the right state for this tab. We update the find text | 243 // shown it is showing the right state for this tab. We update the find text |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 | 557 |
| 556 // We now need to check if the window is obscuring the search results. | 558 // We now need to check if the window is obscuring the search results. |
| 557 if (!result.selection_rect().IsEmpty()) | 559 if (!result.selection_rect().IsEmpty()) |
| 558 MoveWindowIfNecessary(result.selection_rect(), false); | 560 MoveWindowIfNecessary(result.selection_rect(), false); |
| 559 | 561 |
| 560 // Once we find a match we no longer want to keep track of what had | 562 // Once we find a match we no longer want to keep track of what had |
| 561 // focus. EndFindSession will then set the focus to the page content. | 563 // focus. EndFindSession will then set the focus to the page content. |
| 562 if (result.number_of_matches() > 0) | 564 if (result.number_of_matches() > 0) |
| 563 focus_tracker_.reset(NULL); | 565 focus_tracker_.reset(NULL); |
| 564 } | 566 } |
| OLD | NEW |