summaryrefslogtreecommitdiffstats
path: root/chrome/browser/web_contents.cc
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-14 20:23:36 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-14 20:23:36 +0000
commitedc286198b90c629bbf6081440512d02aef603d8 (patch)
tree6a15f556b635515188002bf6296a5334bfb1cf7e /chrome/browser/web_contents.cc
parent3d840f473245973dac230a8d998c666e73348b1d (diff)
downloadchromium_src-edc286198b90c629bbf6081440512d02aef603d8.zip
chromium_src-edc286198b90c629bbf6081440512d02aef603d8.tar.gz
chromium_src-edc286198b90c629bbf6081440512d02aef603d8.tar.bz2
Make the FindInPageController implement its own delegate interface for
RenderViewHost so that we can get rid of the pass-throughs in WebContents. I removed some redundant checks in WebContents when calling view() for render_view_host() since that internally checks the null-ness of render_view_host(). BUG=1323267 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@881 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/web_contents.cc')
-rw-r--r--chrome/browser/web_contents.cc35
1 files changed, 8 insertions, 27 deletions
diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc
index 1774c1d..3732714 100644
--- a/chrome/browser/web_contents.cc
+++ b/chrome/browser/web_contents.cc
@@ -672,7 +672,7 @@ void WebContents::Stop() {
void WebContents::DidBecomeSelected() {
TabContents::DidBecomeSelected();
- if (render_view_host() && view())
+ if (view())
view()->DidBecomeSelected();
CacheManagerHost::GetInstance()->ObserveActivity(process()->host_id());
@@ -685,7 +685,7 @@ void WebContents::WasHidden() {
// is because closing the tab calls WebContents::Destroy(), which removes
// the |render_view_host()|; then when we actually destroy the window,
// OnWindowPosChanged() notices and calls HideContents() (which calls us).
- if (render_view_host() && view())
+ if (view())
view()->WasHidden();
// Loop through children and send WasHidden to them, too.
@@ -719,9 +719,6 @@ void WebContents::StopFinding(bool clear_selection) {
}
void WebContents::OpenFindInPageWindow(const Browser& browser) {
- if (!CanFind())
- return;
-
if (!find_in_page_controller_.get()) {
// Get the Chrome top-level (Frame) window.
HWND hwnd = browser.GetTopLevelHWND();
@@ -739,9 +736,6 @@ void WebContents::ReparentFindWindow(HWND new_parent) {
}
bool WebContents::AdvanceFindSelection(bool forward_direction) {
- if (!CanFind())
- return false;
-
// If no controller has been created or it doesn't know what to search for
// then just return false so that caller knows that it should create and
// show the window.
@@ -1078,6 +1072,12 @@ bool WebContents::IsActiveEntry(int32 page_id) {
///////////////////////////////////////////////////////////////////////////////
// RenderViewHostDelegate implementation:
+RenderViewHostDelegate::FindInPage* WebContents::GetFindInPageDelegate() {
+ // The find in page controller implements this interface for us. Our return
+ // value can be NULL, so it's fine if the find in controller doesn't exist.
+ return find_in_page_controller_.get();
+}
+
Profile* WebContents::GetProfile() const {
return profile();
}
@@ -1894,25 +1894,6 @@ void WebContents::DidFailProvisionalLoadWithError(
Details<ProvisionalLoadDetails>(&details));
}
-void WebContents::FindReply(int request_id,
- int number_of_matches,
- const gfx::Rect& selection_rect,
- int active_match_ordinal,
- bool final_update) {
- // ViewMsgHost_FindResult message received. The find-in-page result
- // is obtained. Fire the notification
- FindNotificationDetails detail(request_id,
- number_of_matches,
- selection_rect,
- active_match_ordinal,
- final_update);
- // Notify all observers of this notification.
- // The current find box owns one such observer.
- NotificationService::current()->
- Notify(NOTIFY_FIND_RESULT_AVAILABLE, Source<TabContents>(this),
- Details<FindNotificationDetails>(&detail));
-}
-
void WebContents::UpdateFavIconURL(RenderViewHost* render_view_host,
int32 page_id,
const GURL& icon_url) {