diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 17:03:37 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 17:03:37 +0000 |
commit | 92e175a8152b4a7226cf8715aed8501ed7d83187 (patch) | |
tree | 67ca4faf8de98eef08cbc592f4b16b8d08d739be /chrome/browser/gtk/find_bar_gtk.cc | |
parent | 7985f9159ec6ba70fcdc4c76b6bc8787c074cb50 (diff) | |
download | chromium_src-92e175a8152b4a7226cf8715aed8501ed7d83187.zip chromium_src-92e175a8152b4a7226cf8715aed8501ed7d83187.tar.gz chromium_src-92e175a8152b4a7226cf8715aed8501ed7d83187.tar.bz2 |
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
Diffstat (limited to 'chrome/browser/gtk/find_bar_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/find_bar_gtk.cc | 52 |
1 files changed, 42 insertions, 10 deletions
diff --git a/chrome/browser/gtk/find_bar_gtk.cc b/chrome/browser/gtk/find_bar_gtk.cc index 5bfe1c6..2398770 100644 --- a/chrome/browser/gtk/find_bar_gtk.cc +++ b/chrome/browser/gtk/find_bar_gtk.cc @@ -7,6 +7,7 @@ #include <gdk/gdkkeysyms.h> #include "base/string_util.h" +#include "chrome/browser/find_bar_controller.h" #include "chrome/browser/gtk/tab_contents_container_gtk.h" #include "chrome/browser/tab_contents/web_contents.h" @@ -20,13 +21,13 @@ gboolean EntryContentsChanged(GtkWindow* window, FindBarGtk* find_bar) { gboolean KeyPressEvent(GtkWindow* window, GdkEventKey* event, FindBarGtk* find_bar) { if (GDK_Escape == event->keyval) - find_bar->Hide(); + find_bar->EscapePressed(); return FALSE; } } -FindBarGtk::FindBarGtk() : web_contents_(NULL) { +FindBarGtk::FindBarGtk() { find_text_ = gtk_entry_new(); gtk_widget_show(find_text_); @@ -45,26 +46,57 @@ void FindBarGtk::Show() { gtk_widget_grab_focus(find_text_); } -void FindBarGtk::Hide() { +void FindBarGtk::Hide(bool animate) { + // TODO(tc): Animated slide away. gtk_widget_hide(container_); - if (web_contents_) - web_contents_->StopFinding(true); +} + +void FindBarGtk::SetFocusAndSelection() { +} + +void FindBarGtk::ClearResults(const FindNotificationDetails& results) { +} + +void FindBarGtk::StopAnimation() { + // No animation yet, so do nothing. +} + +void FindBarGtk::SetFindText(const std::wstring& find_text) { +} + +void FindBarGtk::UpdateUIForFindResult(const FindNotificationDetails& result, + const std::wstring& find_text) { +} + +gfx::Rect FindBarGtk::GetDialogPosition(gfx::Rect avoid_overlapping_rect) { + return gfx::Rect(); +} + +void FindBarGtk::SetDialogPosition(const gfx::Rect& new_pos, bool no_redraw) { +} + +bool FindBarGtk::IsFindBarVisible() { + return true; +} + +void FindBarGtk::RestoreSavedFocus() { } void FindBarGtk::ContentsChanged() { - if (!web_contents_) + WebContents* web_contents = find_bar_controller_->web_contents(); + if (!web_contents) return; std::string new_contents(gtk_entry_get_text(GTK_ENTRY(find_text_))); if (new_contents.length() > 0) { - web_contents_->StartFinding(UTF8ToWide(new_contents), true); + web_contents->StartFinding(UTF8ToWide(new_contents), true); } else { // The textbox is empty so we reset. - web_contents_->StopFinding(true); // true = clear selection on page. + web_contents->StopFinding(true); // true = clear selection on page. } } -void FindBarGtk::ChangeWebContents(WebContents* contents) { - web_contents_ = contents; +void FindBarGtk::EscapePressed() { + find_bar_controller_->EndFindSession(); } |