diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-24 00:10:29 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-24 00:10:29 +0000 |
commit | 4f3dc3751d69f9db1f8ef533a3335201b3bc78bc (patch) | |
tree | e37efecf992ddd4e901c894273cbb1e5bf4260cc /chrome/browser/browser.cc | |
parent | 5e7f161f73f1817b8a0c422c0e4b5eceae6954e7 (diff) | |
download | chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.zip chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.tar.gz chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.tar.bz2 |
The find bar should be owned and managed from the BrowserView, not the WebContentsView, since it's part of the "chrome".
Design Doc: http://dev.chromium.org/developers/design-documents/find-bar
Things done:
- Pulled all of the find bar stuff out of WebContentsView* since it's no longer needed.
- Moved OnFindReply delegate method from RenderViewHostDelegate::View to RenderViewHostDelegate, since it's no longer implemented on the view.
- Moved find control methods to WebContents.
- Added recent find result state to WebContents.
- Updated the UI tests to accommodate the changes in the state that is broadcast when results are discovered.
- Updated the find bar layout to obtain its bounding box from the BrowserView, which knows about toolbars, bookmark bars etc.
- Updated the find bar itself to handle the fact that it can be displayed for multiple different tabs.
- Moved the find bar manipulation methods for testing from TabProxy to BrowserProxy, since the find bar is now a feature of the window, not the tab.
- view.h: Don't lay out child views again if they have a layout manager, it already updated them.
TEST=Find box should work as before.
BUG=3245
Review URL: http://codereview.chromium.org/27025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10231 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index d91c114..9c479a6 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -845,18 +845,17 @@ void Browser::Paste() { void Browser::Find() { UserMetrics::RecordAction(L"Find", profile_); - GetSelectedTabContents()->AsWebContents()->view()->FindInPage(*this, false, - false); + FindInPage(false, false); } void Browser::FindNext() { UserMetrics::RecordAction(L"FindNext", profile_); - AdvanceFindSelection(true); + FindInPage(true, true); } void Browser::FindPrevious() { UserMetrics::RecordAction(L"FindPrevious", profile_); - AdvanceFindSelection(false); + FindInPage(true, false); } void Browser::ZoomIn() { @@ -1238,20 +1237,6 @@ void Browser::CreateNewStripWithContents(TabContents* detached_contents, // won't start if the page is loading. browser->LoadingStateChanged(detached_contents); browser->window()->Show(); - -#if defined(OS_WIN) - // When we detach a tab we need to make sure any associated Find window moves - // along with it to its new home (basically we just make new_window the - // parent of the Find window). - // TODO(brettw) this could probably be improved, see - // WebContentsView::ReparentFindWindow for more. - WebContents* web_contents = detached_contents->AsWebContents(); - if (web_contents) - web_contents->view()->ReparentFindWindow(browser); -#else - // TODO(port): remove the view dependency from this. - NOTIMPLEMENTED() << "need to reparent find window"; -#endif } int Browser::GetDragActions() const { @@ -1398,18 +1383,6 @@ void Browser::TabInsertedAt(TabContents* contents, SyncHistoryWithTabs(tabstrip_model_.GetIndexOfTabContents(contents)); -#if defined(OS_WIN) - // When a tab is dropped into a tab strip we need to make sure that the - // associated Find window is moved along with it. We therefore change the - // parent of the Find window (if the parent is already correctly set this - // does nothing). - // TODO(brettw) this could probably be improved, see - // WebContentsView::ReparentFindWindow for more. - WebContents* web_contents = contents->AsWebContents(); - if (web_contents) - web_contents->view()->ReparentFindWindow(this); -#endif - // Make sure the loading state is updated correctly, otherwise the throbber // won't start if the page is loading. LoadingStateChanged(contents); @@ -2407,11 +2380,14 @@ GURL Browser::GetHomePage() { } #if defined(OS_WIN) -void Browser::AdvanceFindSelection(bool forward_direction) { - GetSelectedTabContents()->AsWebContents()->view()->FindInPage( - *this, true, forward_direction); +void Browser::FindInPage(bool find_next, bool forward_direction) { + window_->ShowFindBar(); + if (find_next) { + GetSelectedTabContents()->AsWebContents()->StartFinding( + std::wstring(), + forward_direction); + } } - #endif // OS_WIN void Browser::CloseFrame() { |