summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-29 19:10:58 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-29 19:10:58 +0000
commitb492c117d70294e8c418b304b16620e4a6e88f0e (patch)
tree94e1ac182c13180066194709ed182561468f736f /chrome/browser
parent2b79be4d4cc515e8ab45901fb5a95a2980a45585 (diff)
downloadchromium_src-b492c117d70294e8c418b304b16620e4a6e88f0e.zip
chromium_src-b492c117d70294e8c418b304b16620e4a6e88f0e.tar.gz
chromium_src-b492c117d70294e8c418b304b16620e4a6e88f0e.tar.bz2
This CL cleans-up the FindBarHost and fixes an assert that happens on the focus manager when closing Chrome (linux toolkit views).
See original review at: http://codereview.chromium.org/220036/show BUG=None TEST=Make sure find works as expected on Chrome Linux toolkit views. TBR=ben Review URL: http://codereview.chromium.org/243035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27524 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/views/find_bar_host.cc18
-rw-r--r--chrome/browser/views/find_bar_host.h3
-rwxr-xr-xchrome/browser/views/find_bar_host_gtk.cc23
-rwxr-xr-xchrome/browser/views/find_bar_host_win.cc30
4 files changed, 11 insertions, 63 deletions
diff --git a/chrome/browser/views/find_bar_host.cc b/chrome/browser/views/find_bar_host.cc
index 2d8c27b..a87edc2 100644
--- a/chrome/browser/views/find_bar_host.cc
+++ b/chrome/browser/views/find_bar_host.cc
@@ -69,6 +69,8 @@ FindBarHost::FindBarHost(BrowserView* browser_view)
}
FindBarHost::~FindBarHost() {
+ focus_manager_->RemoveFocusChangeListener(this);
+ focus_tracker_.reset(NULL);
}
void FindBarHost::Show() {
@@ -131,20 +133,6 @@ void FindBarHost::MoveWindowIfNecessary(const gfx::Rect& selection_rect,
view_->SchedulePaint();
}
-void FindBarHost::OnFinalMessage() {
- // TODO(beng): Destroy the RootView before destroying the Focus Manager will
- // allow us to remove this method.
-
- // We are exiting, so we no longer need to monitor focus changes.
- focus_manager_->RemoveFocusChangeListener(this);
-
- // Destroy the focus tracker now, otherwise by the time we're destroyed the
- // focus manager the focus tracker is referencing may have already been
- // destroyed resulting in the focus tracker trying to reference a deleted
- // focus manager.
- focus_tracker_.reset(NULL);
-};
-
bool FindBarHost::IsVisible() {
return host_->IsVisible();
}
@@ -392,5 +380,3 @@ bool FindBarHost::MaybeForwardKeystrokeToWebpage(
render_view_host->ForwardKeyboardEvent(event);
return true;
}
-
-
diff --git a/chrome/browser/views/find_bar_host.h b/chrome/browser/views/find_bar_host.h
index 6c77776..6c2546f3 100644
--- a/chrome/browser/views/find_bar_host.h
+++ b/chrome/browser/views/find_bar_host.h
@@ -62,8 +62,6 @@ class FindBarHost : public views::AcceleratorTarget,
bool MaybeForwardKeystrokeToWebpage(
const views::Textfield::Keystroke& key_stroke);
- void OnFinalMessage();
-
bool IsVisible();
// FindBar implementation:
@@ -193,4 +191,3 @@ class FindBarHost : public views::AcceleratorTarget,
};
#endif // CHROME_BROWSER_VIEWS_FIND_BAR_HOST_H_
-
diff --git a/chrome/browser/views/find_bar_host_gtk.cc b/chrome/browser/views/find_bar_host_gtk.cc
index 2a08e32..6b05f92 100755
--- a/chrome/browser/views/find_bar_host_gtk.cc
+++ b/chrome/browser/views/find_bar_host_gtk.cc
@@ -12,26 +12,6 @@
#include "chrome/browser/views/frame/browser_view.h"
#include "views/widget/widget_gtk.h"
-class FindBarHostWidget : public views::WidgetGtk {
- public:
- explicit FindBarHostWidget(FindBarHost* find_bar)
- : WidgetGtk(TYPE_CHILD),
- find_bar_(find_bar) {
- // Don't let WidgetGtk manage our lifetime. We want our lifetime to
- // coincide with TabContents.
- set_delete_on_destroy(false);
- }
-
- void OnDestroy(GtkWidget* widget) {
- find_bar_->OnFinalMessage();
- }
-
- private:
- FindBarHost* find_bar_;
-
- DISALLOW_COPY_AND_ASSIGN(FindBarHostWidget);
-};
-
void FindBarHost::UpdateWindowEdges(const gfx::Rect& new_pos) {
// TODO(davemoore) move the windows implementation to CustomFrameWindow so we
// don't have to implement it for gtk
@@ -44,7 +24,7 @@ void FindBarHost::AudibleAlert() {
}
views::Widget* FindBarHost::CreateHost() {
- return new FindBarHostWidget(this);
+ return new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD);
}
void FindBarHost::SetDialogPositionNative(const gfx::Rect& new_pos,
@@ -75,4 +55,3 @@ bool FindBarHost::ShouldForwardKeystrokeToWebpageNative(
const views::Textfield::Keystroke& key_stroke) {
return true;
}
-
diff --git a/chrome/browser/views/find_bar_host_win.cc b/chrome/browser/views/find_bar_host_win.cc
index dc93e34..8ba3c53 100755
--- a/chrome/browser/views/find_bar_host_win.cc
+++ b/chrome/browser/views/find_bar_host_win.cc
@@ -12,26 +12,6 @@
#include "views/controls/scrollbar/native_scroll_bar.h"
#include "views/widget/widget_win.h"
-class FindBarHostWidget : public views::WidgetWin {
- public:
- explicit FindBarHostWidget(FindBarHost* find_bar) : find_bar_(find_bar) {
- // Don't let WidgetWin manage our lifetime. We want our lifetime to
- // coincide with TabContents.
- set_delete_on_destroy(false);
- set_window_style(WS_CHILD | WS_CLIPCHILDREN);
- set_window_ex_style(WS_EX_TOPMOST);
- }
-
- void OnFinalMessage(HWND window) {
- find_bar_->OnFinalMessage();
- }
-
- private:
- FindBarHost* find_bar_;
-
- DISALLOW_COPY_AND_ASSIGN(FindBarHostWidget);
-};
-
// TODO(brettw) this should not be so complicated. The view should really be in
// charge of these regions. CustomFrameWindow will do this for us. It will also
// let us set a path for the window region which will avoid some logic here.
@@ -156,7 +136,14 @@ void FindBarHost::AudibleAlert() {
}
views::Widget* FindBarHost::CreateHost() {
- return new FindBarHostWidget(this);
+ views::WidgetWin* widget = new views::WidgetWin();
+ // Don't let WidgetWin manage our lifetime. We want our lifetime to
+ // coincide with TabContents.
+ widget->set_delete_on_destroy(false);
+ widget->set_window_style(WS_CHILD | WS_CLIPCHILDREN);
+ widget->set_window_ex_style(WS_EX_TOPMOST);
+
+ return widget;
}
void FindBarHost::SetDialogPositionNative(const gfx::Rect& new_pos,
@@ -194,4 +181,3 @@ bool FindBarHost::ShouldForwardKeystrokeToWebpageNative(
// We specifically ignore WM_CHAR. See http://crbug.com/10509.
return key_stroke.message() == WM_KEYDOWN || key_stroke.message() == WM_KEYUP;
}
-