From 92e175a8152b4a7226cf8715aed8501ed7d83187 Mon Sep 17 00:00:00 2001 From: "tc@google.com" Date: Thu, 12 Mar 2009 17:03:37 +0000 Subject: Some work in refactoring FindBarWin/FindBarView so we can share code across platforms. See http://code.google.com/p/chromium/wiki/FindBarRefactoring for more information about the design. Review URL: http://codereview.chromium.org/42057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11544 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/find_bar_gtk.h | 41 +++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'chrome/browser/gtk/find_bar_gtk.h') diff --git a/chrome/browser/gtk/find_bar_gtk.h b/chrome/browser/gtk/find_bar_gtk.h index 9a38ce9..6ac3c41 100644 --- a/chrome/browser/gtk/find_bar_gtk.h +++ b/chrome/browser/gtk/find_bar_gtk.h @@ -5,33 +5,49 @@ #ifndef CHROME_BROWSER_GTK_FIND_BAR_GTK_H_ #define CHROME_BROWSER_GTK_FIND_BAR_GTK_H_ -#include +#include "chrome/browser/find_bar.h" #include +#include + +class FindBarController; class TabContentsContainerGtk; class WebContents; // Currently this class contains both a model and a view. We may want to // eventually pull out the model specific bits and share with Windows. -class FindBarGtk { +class FindBarGtk : public FindBar { public: FindBarGtk(); - ~FindBarGtk() { } + virtual ~FindBarGtk() { } - // Show the find dialog if it's not already showing. The Find dialog is - // positioned above the web contents area (TabContentsContainerGtk). - void Show(); - void Hide(); + void set_find_bar_controller(FindBarController* find_bar_controller) { + find_bar_controller_ = find_bar_controller; + } // Callback when the text in the find box changes. void ContentsChanged(); - // Callback from BrowserWindowGtk when the web contents changes. - void ChangeWebContents(WebContents* contents); + // Callback when Escape is pressed. + void EscapePressed(); GtkWidget* gtk_widget() const { return container_; } + // Methods from FindBar. + virtual void Show(); + virtual void Hide(bool animate); + virtual void SetFocusAndSelection(); + virtual void ClearResults(const FindNotificationDetails& results); + virtual void StopAnimation(); + virtual void SetFindText(const std::wstring& find_text); + virtual void UpdateUIForFindResult(const FindNotificationDetails& result, + const std::wstring& find_text); + virtual gfx::Rect GetDialogPosition(gfx::Rect avoid_overlapping_rect); + virtual void SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw); + virtual bool IsFindBarVisible(); + virtual void RestoreSavedFocus(); + private: // GtkHBox containing the find bar widgets. GtkWidget* container_; @@ -39,9 +55,10 @@ class FindBarGtk { // The widget where text is entered. GtkWidget* find_text_; - // A non-owning pointer to the web contents associated with the find bar. - // This can be NULL. - WebContents* web_contents_; + // Pointer back to the owning controller. + FindBarController* find_bar_controller_; + + DISALLOW_COPY_AND_ASSIGN(FindBarGtk); }; #endif // CHROME_BROWSER_GTK_FIND_BAR_GTK_H_ -- cgit v1.1