summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/autocomplete
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 22:46:03 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 22:46:03 +0000
commit413df1b5ebacf0f3bc2ad03020e9f93b92717803 (patch)
tree92381b78a0b3a1682523b338428688bd4e23cd9e /chrome/browser/views/autocomplete
parent76665e75f3f10a3171efd3bebfbd9c59a7648a00 (diff)
downloadchromium_src-413df1b5ebacf0f3bc2ad03020e9f93b92717803.zip
chromium_src-413df1b5ebacf0f3bc2ad03020e9f93b92717803.tar.gz
chromium_src-413df1b5ebacf0f3bc2ad03020e9f93b92717803.tar.bz2
Convert the AutocompletePopupPositioner into a BubblePositioner in preparation for using it to position both the Omnibox bubble and InfoBubbles. It now gets the bounds of the location stack, which can be turned into useful coordinates for both items.
This should not result in any visible change. BUG=21028 TEST=none Review URL: http://codereview.chromium.org/194110 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26288 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/autocomplete')
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc25
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h7
2 files changed, 19 insertions, 13 deletions
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
index 2ca8f0d..7efee67 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -14,6 +14,7 @@
#include "base/compiler_specific.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
+#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/views/bubble_border.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -582,7 +583,7 @@ AutocompletePopupContentsView::AutocompletePopupContentsView(
AutocompleteEditView* edit_view,
AutocompleteEditModel* edit_model,
Profile* profile,
- AutocompletePopupPositioner* popup_positioner)
+ const BubblePositioner* bubble_positioner)
#if defined(OS_WIN)
: popup_(new AutocompletePopupWin(this)),
#else
@@ -590,10 +591,14 @@ AutocompletePopupContentsView::AutocompletePopupContentsView(
#endif
model_(new AutocompletePopupModel(this, edit_model, profile)),
edit_view_(edit_view),
- popup_positioner_(popup_positioner),
+ bubble_positioner_(bubble_positioner),
result_font_(font.DeriveFont(kEditFontAdjust)),
ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)) {
- set_border(new BubbleBorder);
+ // The following little dance is required because set_border() requires a
+ // pointer to a non-const object.
+ BubbleBorder* bubble_border = new BubbleBorder;
+ bubble_border_ = bubble_border;
+ set_border(bubble_border);
}
gfx::Rect AutocompletePopupContentsView::GetPopupBounds() const {
@@ -650,12 +655,10 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() {
}
// Calculate desired bounds.
- gfx::Rect new_target_bounds = popup_positioner_->GetPopupBounds();
- new_target_bounds.set_height(total_child_height);
- gfx::Insets insets;
- border()->GetInsets(&insets);
- new_target_bounds.Inset(-insets.left(), -insets.top(), -insets.right(),
- -insets.bottom());
+ gfx::Rect location_stack_bounds =
+ bubble_positioner_->GetLocationStackBounds();
+ gfx::Rect new_target_bounds(bubble_border_->GetBounds(location_stack_bounds,
+ gfx::Size(location_stack_bounds.width(), total_child_height)));
// If we're animating and our target height changes, reset the animation.
// NOTE: If we just reset blindly on _every_ update, then when the user types
@@ -870,7 +873,7 @@ AutocompletePopupView* AutocompletePopupView::CreatePopupView(
AutocompleteEditView* edit_view,
AutocompleteEditModel* edit_model,
Profile* profile,
- AutocompletePopupPositioner* popup_positioner) {
+ const BubblePositioner* bubble_positioner) {
return new AutocompletePopupContentsView(font, edit_view, edit_model,
- profile, popup_positioner);
+ profile, bubble_positioner);
}
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h
index b8baf1b..d5f710e 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h
@@ -55,7 +55,7 @@ class AutocompletePopupContentsView : public views::View,
AutocompleteEditView* edit_view,
AutocompleteEditModel* edit_model,
Profile* profile,
- AutocompletePopupPositioner* popup_positioner);
+ const BubblePositioner* bubble_positioner);
virtual ~AutocompletePopupContentsView() {}
// Returns the bounds the popup should be shown at. This is the display bounds
@@ -117,7 +117,10 @@ class AutocompletePopupContentsView : public views::View,
AutocompleteEditView* edit_view_;
// An object that tells the popup how to position itself.
- AutocompletePopupPositioner* popup_positioner_;
+ const BubblePositioner* bubble_positioner_;
+
+ // Our border, which can compute our desired bounds.
+ const BubbleBorder* bubble_border_;
// The font that we should use for result rows. This is based on the font used
// by the edit that created us.