summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-12 18:57:03 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-12 18:57:03 +0000
commita2b35465c42e3bb3f85c22a869e0dce74b5d8a4c (patch)
treee800a3fd638bda7b597b8fd0b76af50d3d049ea5 /chrome/browser
parent5e49b2ce1dc358328ab732520b17414b44081712 (diff)
downloadchromium_src-a2b35465c42e3bb3f85c22a869e0dce74b5d8a4c.zip
chromium_src-a2b35465c42e3bb3f85c22a869e0dce74b5d8a4c.tar.gz
chromium_src-a2b35465c42e3bb3f85c22a869e0dce74b5d8a4c.tar.bz2
Shift omnibox dropdown in and up on Windows, and square off the top, so it connects to the location bar. Also fix info bubble positioning against location bar icons to put the arrow "up against the icon edge" (fixes the arrow overlapping some page action icons).
Remove BubblePositioner, which is now no longer needed. BUG=27570,40730 TEST=Omnibox dropdown should line up with editable area edges, icons and text should line up with icon and text in the omnibox. Info bubbles should still be positioned correctly Review URL: http://codereview.chromium.org/1578021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44268 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc20
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.h12
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.h4
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.mm5
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc7
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.h2
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view.h19
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc39
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_gtk.h6
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.h4
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm13
-rw-r--r--chrome/browser/bubble_positioner.h24
-rw-r--r--chrome/browser/chromeos/compact_location_bar_view.cc11
-rw-r--r--chrome/browser/chromeos/compact_location_bar_view.h7
-rw-r--r--chrome/browser/cocoa/location_bar_view_mac.h2
-rw-r--r--chrome/browser/cocoa/location_bar_view_mac.mm5
-rw-r--r--chrome/browser/cocoa/toolbar_controller.h6
-rw-r--r--chrome/browser/cocoa/toolbar_controller.mm36
-rw-r--r--chrome/browser/cocoa/toolbar_controller_unittest.mm20
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.cc26
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.h7
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc22
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.h7
-rw-r--r--chrome/browser/views/app_launcher.cc42
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc65
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h6
-rw-r--r--chrome/browser/views/bubble_border.cc95
-rw-r--r--chrome/browser/views/bubble_border.h20
-rw-r--r--chrome/browser/views/info_bubble.cc2
-rw-r--r--chrome/browser/views/location_bar_view.cc77
-rw-r--r--chrome/browser/views/location_bar_view.h14
-rw-r--r--chrome/browser/views/toolbar_view.cc27
-rw-r--r--chrome/browser/views/toolbar_view.h7
33 files changed, 237 insertions, 422 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index 207dd0d..b8a73f0 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -17,7 +17,6 @@
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
-#include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/defaults.h"
@@ -33,9 +32,11 @@
#include "net/base/escape.h"
#if defined(TOOLKIT_VIEWS)
+#include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h"
#include "chrome/browser/views/location_bar_view.h"
#include "gfx/skia_utils_gtk.h"
#else
+#include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/browser/gtk/location_bar_view_gtk.h"
#endif
@@ -114,7 +115,11 @@ AutocompleteEditViewGtk::AutocompleteEditViewGtk(
Profile* profile,
CommandUpdater* command_updater,
bool popup_window_mode,
- const BubblePositioner* bubble_positioner)
+#if defined(TOOLKIT_VIEWS)
+ const views::View* location_bar)
+#else
+ const GtkWidget* location_bar)
+#endif
: text_view_(NULL),
tag_table_(NULL),
text_buffer_(NULL),
@@ -123,10 +128,13 @@ AutocompleteEditViewGtk::AutocompleteEditViewGtk(
secure_scheme_tag_(NULL),
security_error_scheme_tag_(NULL),
model_(new AutocompleteEditModel(this, controller, profile)),
- popup_view_(AutocompletePopupView::CreatePopupView(gfx::Font(), this,
- model_.get(),
- profile,
- bubble_positioner)),
+#if defined(TOOLKIT_VIEWS)
+ popup_view_(new AutocompletePopupContentsView(
+ gfx::Font(), this, model_.get(), profile, location_bar)),
+#else
+ popup_view_(new AutocompletePopupViewGtk(this, model_.get(), profile,
+ location_bar)),
+#endif
controller_(controller),
toolbar_model_(toolbar_model),
command_updater_(command_updater),
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
index 69bc3be..7f11f7a 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,9 +25,11 @@
class AutocompleteEditController;
class AutocompleteEditModel;
class AutocompletePopupView;
-class BubblePositioner;
class Profile;
class TabContents;
+namespace views {
+class View;
+}
#if !defined(TOOLKIT_VIEWS)
class GtkThemeProvider;
@@ -53,7 +55,11 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
Profile* profile,
CommandUpdater* command_updater,
bool popup_window_mode,
- const BubblePositioner* bubble_positioner);
+#if defined(TOOLKIT_VIEWS)
+ const views::View* location_bar);
+#else
+ const GtkWidget* location_bar);
+#endif
~AutocompleteEditViewGtk();
// Initialize, create the underlying widgets, etc.
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
index 069c6de4..80f18e8 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,7 +13,6 @@
class AutocompleteEditController;
class AutocompletePopupViewMac;
-class BubblePositioner;
class Clipboard;
class Profile;
class ToolbarModel;
@@ -24,7 +23,6 @@ class AutocompleteEditViewMac : public AutocompleteEditView,
public AutocompleteTextFieldObserver {
public:
AutocompleteEditViewMac(AutocompleteEditController* controller,
- const BubblePositioner* bubble_positioner,
ToolbarModel* toolbar_model,
Profile* profile,
CommandUpdater* command_updater,
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index ba19e51..ecbd38c 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -166,14 +166,13 @@ NSImage* AutocompleteEditViewMac::ImageForResource(int resource_id) {
// the window |field_| is in.
AutocompleteEditViewMac::AutocompleteEditViewMac(
AutocompleteEditController* controller,
- const BubblePositioner* bubble_positioner,
ToolbarModel* toolbar_model,
Profile* profile,
CommandUpdater* command_updater,
AutocompleteTextField* field)
: model_(new AutocompleteEditModel(this, controller, profile)),
- popup_view_(new AutocompletePopupViewMac(
- this, model_.get(), bubble_positioner, profile, field)),
+ popup_view_(new AutocompletePopupViewMac(this, model_.get(), profile,
+ field)),
controller_(controller),
toolbar_model_(toolbar_model),
command_updater_(command_updater),
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 46639ab..45386c4 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -28,7 +28,6 @@
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/autocomplete/autocomplete_accessibility.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
-#include "chrome/browser/autocomplete/autocomplete_popup_view.h"
#include "chrome/browser/autocomplete/keyword_provider.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/command_updater.h"
@@ -387,10 +386,10 @@ AutocompleteEditViewWin::AutocompleteEditViewWin(
Profile* profile,
CommandUpdater* command_updater,
bool popup_window_mode,
- const BubblePositioner* bubble_positioner)
+ const views::View* location_bar)
: model_(new AutocompleteEditModel(this, controller, profile)),
- popup_view_(AutocompletePopupView::CreatePopupView(
- font, this, model_.get(), profile, bubble_positioner)),
+ popup_view_(new AutocompletePopupContentsView(font, this, model_.get(),
+ profile, location_bar)),
controller_(controller),
parent_view_(parent_view),
toolbar_model_(toolbar_model),
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.h b/chrome/browser/autocomplete/autocomplete_edit_view_win.h
index 82762ae..33af6a7 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.h
@@ -69,7 +69,7 @@ class AutocompleteEditViewWin
Profile* profile,
CommandUpdater* command_updater,
bool popup_window_mode,
- const BubblePositioner* bubble_positioner);
+ const views::View* location_bar);
~AutocompleteEditViewWin();
views::View* parent_view() const { return parent_view_; }
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view.h b/chrome/browser/autocomplete/autocomplete_popup_view.h
index 41b21a6..5674e4b 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view.h
+++ b/chrome/browser/autocomplete/autocomplete_popup_view.h
@@ -13,15 +13,7 @@
#include "build/build_config.h"
-class AutocompleteEditView;
class AutocompletePopupModel;
-class BubblePositioner;
-namespace gfx {
-class Font;
-}
-class AutocompleteEditViewWin;
-class AutocompleteEditModel;
-class Profile;
class AutocompletePopupView {
public:
@@ -48,17 +40,6 @@ class AutocompletePopupView {
// Returns the popup's model.
virtual AutocompletePopupModel* GetModel() = 0;
-
-#if !defined(OS_MACOSX)
- // Create a popup view implementation. It may make sense for this to become
- // platform independent eventually.
- static AutocompletePopupView* CreatePopupView(
- const gfx::Font& font,
- AutocompleteEditView* edit_view,
- AutocompleteEditModel* edit_model,
- Profile* profile,
- const BubblePositioner* bubble_positioner);
-#endif
};
#endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_H_
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
index b43b3d1..6225dc6 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,7 +18,6 @@
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
-#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/browser/gtk/gtk_util.h"
@@ -223,10 +222,10 @@ AutocompletePopupViewGtk::AutocompletePopupViewGtk(
AutocompleteEditView* edit_view,
AutocompleteEditModel* edit_model,
Profile* profile,
- const BubblePositioner* bubble_positioner)
+ const GtkWidget* location_bar)
: model_(new AutocompletePopupModel(this, edit_model, profile)),
edit_view_(edit_view),
- bubble_positioner_(bubble_positioner),
+ location_bar_(location_bar),
window_(gtk_window_new(GTK_WINDOW_POPUP)),
layout_(NULL),
theme_provider_(GtkThemeProvider::GetFrom(profile)),
@@ -372,15 +371,18 @@ void AutocompletePopupViewGtk::Observe(NotificationType type,
}
void AutocompletePopupViewGtk::Show(size_t num_results) {
- gfx::Rect rect = bubble_positioner_->GetLocationStackBounds();
- rect.set_y(rect.bottom());
- rect.set_height((num_results * kHeightPerResult) + (kBorderThickness * 2));
-
- gtk_window_move(GTK_WINDOW(window_), rect.x(), rect.y());
- gtk_widget_set_size_request(window_, rect.width(), rect.height());
- gtk_widget_show(window_);
- StackWindow();
- opened_ = true;
+ gint origin_x, origin_y;
+ gdk_window_get_origin(location_bar_->window, &origin_x, &origin_y);
+ const GtkAllocation& allocation = location_bar_->allocation;
+ gtk_window_move(GTK_WINDOW(window_),
+ origin_x + allocation.x - kBorderThickness,
+ origin_y + allocation.y + allocation.height - kBorderThickness - 1);
+ gtk_widget_set_size_request(window_,
+ allocation.width + (kBorderThickness * 2),
+ (num_results * kHeightPerResult) + (kBorderThickness * 2));
+ gtk_widget_show(window_);
+ StackWindow();
+ opened_ = true;
}
void AutocompletePopupViewGtk::Hide() {
@@ -566,14 +568,3 @@ gboolean AutocompletePopupViewGtk::HandleExpose(GtkWidget* widget,
return TRUE;
}
-
-// static
-AutocompletePopupView* AutocompletePopupView::CreatePopupView(
- const gfx::Font& font,
- AutocompleteEditView* edit_view,
- AutocompleteEditModel* edit_model,
- Profile* profile,
- const BubblePositioner* bubble_positioner) {
- return new AutocompletePopupViewGtk(edit_view, edit_model, profile,
- bubble_positioner);
-}
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h
index 0413006..555b531 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -27,7 +27,7 @@ class AutocompletePopupViewGtk : public AutocompletePopupView,
AutocompletePopupViewGtk(AutocompleteEditView* edit_view,
AutocompleteEditModel* edit_model,
Profile* profile,
- const BubblePositioner* bubble_positioner);
+ const GtkWidget* location_bar);
~AutocompletePopupViewGtk();
// Overridden from AutocompletePopupView:
@@ -88,7 +88,7 @@ class AutocompletePopupViewGtk : public AutocompletePopupView,
scoped_ptr<AutocompletePopupModel> model_;
AutocompleteEditView* edit_view_;
- const BubblePositioner* bubble_positioner_;
+ const GtkWidget* location_bar_;
// Our popup window, which is the only widget used, and we paint it on our
// own. This widget shouldn't be exposed outside of this class.
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.h b/chrome/browser/autocomplete/autocomplete_popup_view_mac.h
index a430f58..56d20fd 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.h
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -32,7 +32,6 @@ class AutocompletePopupViewMac : public AutocompletePopupView {
public:
AutocompletePopupViewMac(AutocompleteEditViewMac* edit_view,
AutocompleteEditModel* edit_model,
- const BubblePositioner* bubble_positioner,
Profile* profile,
NSTextField* field);
virtual ~AutocompletePopupViewMac();
@@ -109,7 +108,6 @@ class AutocompletePopupViewMac : public AutocompletePopupView {
scoped_ptr<AutocompletePopupModel> model_;
AutocompleteEditViewMac* edit_view_;
- const BubblePositioner* bubble_positioner_; // owned by toolbar controller
NSTextField* field_; // owned by tab controller
// Child window containing a matrix which implements the popup.
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index e09da8c..31ccff4 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,7 +10,6 @@
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
-#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/cocoa/event_utils.h"
#include "gfx/rect.h"
#include "grit/theme_resources.h"
@@ -246,12 +245,10 @@ NSAttributedString* AutocompletePopupViewMac::MatchText(
AutocompletePopupViewMac::AutocompletePopupViewMac(
AutocompleteEditViewMac* edit_view,
AutocompleteEditModel* edit_model,
- const BubblePositioner* bubble_positioner,
Profile* profile,
NSTextField* field)
: model_(new AutocompletePopupModel(this, edit_model, profile)),
edit_view_(edit_view),
- bubble_positioner_(bubble_positioner),
field_(field),
popup_(nil) {
DCHECK(edit_view);
@@ -318,8 +315,12 @@ void AutocompletePopupViewMac::UpdatePopupAppearance() {
CreatePopupIfNeeded();
// Layout the popup and size it to land underneath the field.
- NSRect r =
- NSRectFromCGRect(bubble_positioner_->GetLocationStackBounds().ToCGRect());
+ // The field has a single-pixel border on the left and right. This
+ // needs to be factored out so that the popup window's border (which
+ // is outside the frame) lines up.
+ const int kLocationStackEdgeWidth = 1;
+ NSRect r = NSInsetRect([field_ convertRect:[field_ bounds] toView:nil],
+ kLocationStackEdgeWidth, 0);
r.origin = [[field_ window] convertBaseToScreen:r.origin];
DCHECK_GT(r.size.width, 0.0);
diff --git a/chrome/browser/bubble_positioner.h b/chrome/browser/bubble_positioner.h
deleted file mode 100644
index 7ea4df0..0000000
--- a/chrome/browser/bubble_positioner.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_BUBBLE_POSITIONER_H_
-#define CHROME_BROWSER_BUBBLE_POSITIONER_H_
-
-namespace gfx {
-class Rect;
-}
-
-// An object in the browser UI can implement this interface to provide display
-// bounds for the omnibox bubble and info bubble views.
-class BubblePositioner {
- public:
- // Returns the bounds of the "location bar" stack (including star/go buttons
- // where relevant). The omnibox dropdown uses this to calculate its width and
- // y-coordinate, and views showing InfoBubbles use it to find the y-coordinate
- // they should show at, so that all "bubble" UIs show up at the same vertical
- // position.
- virtual gfx::Rect GetLocationStackBounds() const = 0;
-};
-
-#endif // CHROME_BROWSER_BUBBLE_POSITIONER_H_
diff --git a/chrome/browser/chromeos/compact_location_bar_view.cc b/chrome/browser/chromeos/compact_location_bar_view.cc
index 31f2c0f..9f7c066 100644
--- a/chrome/browser/chromeos/compact_location_bar_view.cc
+++ b/chrome/browser/chromeos/compact_location_bar_view.cc
@@ -34,7 +34,6 @@
#include "views/window/window.h"
namespace chromeos {
-const int kAutocompletePopupWidth = 700;
const int kDefaultLocationEntryWidth = 250;
const int kCompactLocationLeftMargin = 5;
const int kCompactLocationRightMargin = 10;
@@ -246,14 +245,4 @@ std::wstring CompactLocationBarView::GetTitle() const {
return std::wstring();
}
-////////////////////////////////////////////////////////////////////////////////
-// BubblePositioner overrides:
-gfx::Rect CompactLocationBarView::GetLocationStackBounds() const {
- gfx::Point lower_left(0, height());
- ConvertPointToScreen(this, &lower_left);
- gfx::Rect popup = gfx::Rect(lower_left.x(), lower_left.y(),
- kAutocompletePopupWidth, 0);
- return popup.AdjustToFit(GetWidget()->GetWindow()->GetBounds());
-}
-
} // namespace chromeos
diff --git a/chrome/browser/chromeos/compact_location_bar_view.h b/chrome/browser/chromeos/compact_location_bar_view.h
index 8ffe0de..ec284b0 100644
--- a/chrome/browser/chromeos/compact_location_bar_view.h
+++ b/chrome/browser/chromeos/compact_location_bar_view.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_CHROMEOS_COMPACT_LOCATION_BAR_VIEW_H_
#include "base/basictypes.h"
-#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/chromeos/compact_location_bar_host.h"
#include "chrome/browser/views/dropdown_bar_view.h"
@@ -33,8 +32,7 @@ namespace chromeos {
// navigation bar mode.
class CompactLocationBarView : public DropdownBarView,
public views::ButtonListener,
- public AutocompleteEditController,
- public BubblePositioner {
+ public AutocompleteEditController {
public:
explicit CompactLocationBarView(CompactLocationBarHost* host);
~CompactLocationBarView();
@@ -76,9 +74,6 @@ class CompactLocationBarView : public DropdownBarView,
virtual SkBitmap GetFavIcon() const;
virtual std::wstring GetTitle() const;
- // BubblePositioner implementation.
- virtual gfx::Rect GetLocationStackBounds() const;
-
CompactLocationBarHost* clb_host() {
return static_cast<CompactLocationBarHost*>(host());
}
diff --git a/chrome/browser/cocoa/location_bar_view_mac.h b/chrome/browser/cocoa/location_bar_view_mac.h
index ac55c21..029cfe2 100644
--- a/chrome/browser/cocoa/location_bar_view_mac.h
+++ b/chrome/browser/cocoa/location_bar_view_mac.h
@@ -23,7 +23,6 @@
#include "third_party/skia/include/core/SkBitmap.h"
@class AutocompleteTextField;
-class BubblePositioner;
class CommandUpdater;
class ContentSettingImageModel;
@class ExtensionPopupController;
@@ -40,7 +39,6 @@ class LocationBarViewMac : public AutocompleteEditController,
public NotificationObserver {
public:
LocationBarViewMac(AutocompleteTextField* field,
- const BubblePositioner* bubble_positioner,
CommandUpdater* command_updater,
ToolbarModel* toolbar_model,
Profile* profile,
diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm
index 37a55c2..9c16199 100644
--- a/chrome/browser/cocoa/location_bar_view_mac.mm
+++ b/chrome/browser/cocoa/location_bar_view_mac.mm
@@ -94,13 +94,12 @@ std::wstring CalculateMinString(const std::wstring& description) {
LocationBarViewMac::LocationBarViewMac(
AutocompleteTextField* field,
- const BubblePositioner* bubble_positioner,
CommandUpdater* command_updater,
ToolbarModel* toolbar_model,
Profile* profile,
Browser* browser)
- : edit_view_(new AutocompleteEditViewMac(this, bubble_positioner,
- toolbar_model, profile, command_updater, field)),
+ : edit_view_(new AutocompleteEditViewMac(this, toolbar_model, profile,
+ command_updater, field)),
command_updater_(command_updater),
field_(field),
disposition_(CURRENT_TAB),
diff --git a/chrome/browser/cocoa/toolbar_controller.h b/chrome/browser/cocoa/toolbar_controller.h
index 2413075..c038077 100644
--- a/chrome/browser/cocoa/toolbar_controller.h
+++ b/chrome/browser/cocoa/toolbar_controller.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,7 +22,6 @@ class AppMenuModel;
@class BackForwardMenuController;
class Browser;
@class BrowserActionsController;
-class BubblePositioner;
class CommandUpdater;
@class DelayedMenuButton;
class LocationBar;
@@ -70,8 +69,6 @@ class ToolbarModel;
// Used for monitoring the optional toolbar button prefs.
scoped_ptr<ToolbarControllerInternal::PrefObserverBridge> prefObserver_;
- // Used to position the omnibox bubble.
- scoped_ptr<BubblePositioner> bubblePositioner_;
BooleanPrefMember showHomeButton_;
BooleanPrefMember showPageOptionButtons_;
BOOL hasToolbar_; // If NO, we may have only the location bar.
@@ -171,7 +168,6 @@ class ToolbarModel;
- (NSArray*)toolbarViews;
- (void)showOptionalHomeButton;
- (void)showOptionalPageWrenchButtons;
-- (gfx::Rect)locationStackBounds;
// Return a hover button for the current event.
- (NSButton*)hoverButtonForEvent:(NSEvent*)theEvent;
@end
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm
index a05c0e4..085c493 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -15,7 +15,6 @@
#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_window.h"
-#include "chrome/browser/bubble_positioner.h"
#import "chrome/browser/cocoa/autocomplete_text_field.h"
#import "chrome/browser/cocoa/autocomplete_text_field_editor.h"
#import "chrome/browser/cocoa/back_forward_menu_controller.h"
@@ -85,26 +84,6 @@ const CGFloat kAnimationDuration = 0.2;
- (void)adjustLocationAndGoPositionsBy:(CGFloat)dX animate:(BOOL)animate;
@end
-namespace {
-
-// A C++ class used to correctly position the omnibox.
-class BubblePositionerMac : public BubblePositioner {
- public:
- BubblePositionerMac(ToolbarController* controller)
- : controller_(controller) { }
- virtual ~BubblePositionerMac() { }
-
- // BubblePositioner:
- virtual gfx::Rect GetLocationStackBounds() const {
- return [controller_ locationStackBounds];
- }
-
- private:
- ToolbarController* controller_; // weak, owns us
-};
-
-} // namespace
-
namespace ToolbarControllerInternal {
// A C++ delegate that handles enabling/disabling menu items and handling when
@@ -231,9 +210,7 @@ class PrefObserverBridge : public NotificationObserver {
[wrenchButton_ setShowsBorderOnlyWhileMouseInside:YES];
[self initCommandStatus:commands_];
- bubblePositioner_.reset(new BubblePositionerMac(self));
locationBarView_.reset(new LocationBarViewMac(locationBar_,
- bubblePositioner_.get(),
commands_, toolbarModel_,
profile_, browser_));
[locationBar_ setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
@@ -820,19 +797,6 @@ class PrefObserverBridge : public NotificationObserver {
}
-- (gfx::Rect)locationStackBounds {
- // The field has a single-pixel border on the left and right. This
- // needs to be factored out so that the popup window's border (which
- // is outside the frame) lines up.
- const int kLocationStackEdgeWidth = 1;
-
- const NSRect locationFrame = [locationBar_ frame];
- gfx::Rect stack_bounds(
- NSRectToCGRect([[self view] convertRect:locationFrame toView:nil]));
- stack_bounds.Inset(kLocationStackEdgeWidth, 0);
- return stack_bounds;
-}
-
// (URLDropTargetController protocol)
- (void)dropURLs:(NSArray*)urls inView:(NSView*)view at:(NSPoint)point {
// TODO(viettrungluu): This code is more or less copied from the code in
diff --git a/chrome/browser/cocoa/toolbar_controller_unittest.mm b/chrome/browser/cocoa/toolbar_controller_unittest.mm
index 60eff6c..08e3176 100644
--- a/chrome/browser/cocoa/toolbar_controller_unittest.mm
+++ b/chrome/browser/cocoa/toolbar_controller_unittest.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -226,24 +226,6 @@ TEST_F(ToolbarControllerTest, StarIconInWindowCoordinates) {
EXPECT_TRUE(NSContainsRect(all, star));
}
-TEST_F(ToolbarControllerTest, BubblePosition) {
- NSView* locationBar = [[bar_ toolbarViews] objectAtIndex:kLocationIndex];
-
- // The window frame (in window base coordinates).
- NSRect all = [[[bar_ view] window] frame];
- // The frame of the location bar in window base coordinates.
- NSRect locationFrame =
- [locationBar convertRect:[locationBar bounds] toView:nil];
- // The frame of the location stack in window base coordinates. The horizontal
- // coordinates here are used for the omnibox dropdown.
- gfx::Rect locationStackFrame = [bar_ locationStackBounds];
-
- // The location stack should be just within the border of the
- // location bar.
- EXPECT_EQ(locationStackFrame.x(), NSMinX(locationFrame) + 1);
- EXPECT_EQ(locationStackFrame.right(), NSMaxX(locationFrame) - 1);
-}
-
TEST_F(ToolbarControllerTest, HoverButtonForEvent) {
scoped_nsobject<HitView> view([[HitView alloc]
initWithFrame:NSMakeRect(0,0,100,100)]);
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc
index ebde04c..de012d3 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_toolbar_gtk.cc
@@ -71,7 +71,7 @@ const int kToolbarWidgetSpacing = 2;
BrowserToolbarGtk::BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window)
: toolbar_(NULL),
- location_bar_(new LocationBarViewGtk(this, browser)),
+ location_bar_(new LocationBarViewGtk(browser)),
model_(browser->toolbar_model()),
page_menu_model_(this, browser),
app_menu_model_(this, browser),
@@ -434,30 +434,6 @@ void BrowserToolbarGtk::UpdateTabContents(TabContents* contents,
actions_toolbar_->Update();
}
-gfx::Rect BrowserToolbarGtk::GetLocationStackBounds() const {
- GtkWidget* left;
- GtkWidget* right;
- if (base::i18n::IsRTL()) {
- left = go_->widget();
- right = reload_.get();
- } else {
- left = reload_.get();
- right = go_->widget();
- }
-
- gint origin_x, origin_y;
- DCHECK_EQ(left->window, right->window);
- gdk_window_get_origin(left->window, &origin_x, &origin_y);
-
- gint right_x = origin_x + right->allocation.x + 1;
- gint left_x = origin_x + left->allocation.x + left->allocation.width - 1;
- DCHECK_LE(left_x, right_x);
-
- gfx::Rect stack_bounds(left_x, origin_y + left->allocation.y - 2,
- right_x - left_x, left->allocation.height);
- return stack_bounds;
-}
-
// BrowserToolbarGtk, private --------------------------------------------------
CustomDrawButton* BrowserToolbarGtk::BuildToolbarButton(
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.h b/chrome/browser/gtk/browser_toolbar_gtk.h
index c57499b..53210dc 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.h
+++ b/chrome/browser/gtk/browser_toolbar_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,7 +12,6 @@
#include "app/menus/simple_menu_model.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/app_menu_model.h"
-#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/gtk/custom_button.h"
#include "chrome/browser/gtk/menu_bar_helper.h"
@@ -44,7 +43,6 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
public menus::SimpleMenuModel::Delegate,
public MenuGtk::Delegate,
public NotificationObserver,
- public BubblePositioner,
public MenuBarHelper::Delegate {
public:
explicit BrowserToolbarGtk(Browser* browser, BrowserWindowGtk* window);
@@ -113,9 +111,6 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver,
// Message that we should react to a state change.
void UpdateTabContents(TabContents* contents, bool should_restore_state);
- // BubblePositioner:
- virtual gfx::Rect GetLocationStackBounds() const;
-
// MenuBarHelper::Delegate implementation ------------------------------------
virtual void PopupForButton(GtkWidget* button);
virtual void PopupForButtonNextTo(GtkWidget* button,
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index 36af9ec..343092e 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -138,9 +138,7 @@ std::wstring CalculateMinString(const std::wstring& description) {
const GdkColor LocationBarViewGtk::kBackgroundColor =
GDK_COLOR_RGB(255, 255, 255);
-LocationBarViewGtk::LocationBarViewGtk(
- const BubblePositioner* bubble_positioner,
- Browser* browser)
+LocationBarViewGtk::LocationBarViewGtk(Browser* browser)
: star_image_(NULL),
starred_(false),
security_icon_event_box_(NULL),
@@ -163,7 +161,6 @@ LocationBarViewGtk::LocationBarViewGtk(
command_updater_(browser->command_updater()),
toolbar_model_(browser->toolbar_model()),
browser_(browser),
- bubble_positioner_(bubble_positioner),
disposition_(CURRENT_TAB),
transition_(PageTransition::TYPED),
first_run_bubble_(this),
@@ -185,14 +182,8 @@ LocationBarViewGtk::~LocationBarViewGtk() {
void LocationBarViewGtk::Init(bool popup_window_mode) {
popup_window_mode_ = popup_window_mode;
- location_entry_.reset(new AutocompleteEditViewGtk(this,
- toolbar_model_,
- profile_,
- command_updater_,
- popup_window_mode_,
- bubble_positioner_));
- location_entry_->Init();
+ // Create the widget first, so we can pass it to the AutocompleteEditViewGtk.
hbox_.Own(gtk_hbox_new(FALSE, kInnerPadding));
gtk_container_set_border_width(GTK_CONTAINER(hbox_.get()), kHboxBorder);
// We will paint for the alignment, to paint the background and border.
@@ -201,6 +192,15 @@ void LocationBarViewGtk::Init(bool popup_window_mode) {
// the home button on/off.
gtk_widget_set_redraw_on_allocate(hbox_.get(), TRUE);
+ // Now initialize the AutocompleteEditViewGtk.
+ location_entry_.reset(new AutocompleteEditViewGtk(this,
+ toolbar_model_,
+ profile_,
+ command_updater_,
+ popup_window_mode_,
+ hbox_.get()));
+ location_entry_->Init();
+
security_info_label_ = gtk_label_new(NULL);
gtk_widget_modify_base(security_info_label_, GTK_STATE_NORMAL,
&LocationBarViewGtk::kBackgroundColor);
diff --git a/chrome/browser/gtk/location_bar_view_gtk.h b/chrome/browser/gtk/location_bar_view_gtk.h
index a607129..15f76f2 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/gtk/location_bar_view_gtk.h
@@ -30,7 +30,6 @@
#include "webkit/glue/window_open_disposition.h"
class AutocompleteEditViewGtk;
-class BubblePositioner;
class Browser;
class CommandUpdater;
class ContentSettingImageModel;
@@ -47,8 +46,7 @@ class LocationBarViewGtk : public AutocompleteEditController,
public LocationBarTesting,
public NotificationObserver {
public:
- LocationBarViewGtk(const BubblePositioner* bubble_positioner,
- Browser* browser_);
+ explicit LocationBarViewGtk(Browser* browser_);
virtual ~LocationBarViewGtk();
void Init(bool popup_window_mode);
@@ -361,9 +359,6 @@ class LocationBarViewGtk : public AutocompleteEditController,
ToolbarModel* toolbar_model_;
Browser* browser_;
- // We need to hold on to this just to it pass to the edit.
- const BubblePositioner* bubble_positioner_;
-
// When we get an OnAutocompleteAccept notification from the autocomplete
// edit, we save the input string so we can give it back to the browser on
// the LocationBar interface via GetInputString().
diff --git a/chrome/browser/views/app_launcher.cc b/chrome/browser/views/app_launcher.cc
index fd55086..35c8b07 100644
--- a/chrome/browser/views/app_launcher.cc
+++ b/chrome/browser/views/app_launcher.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_window.h"
-#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/in_process_webkit/webkit_context.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -54,8 +53,9 @@ const int kNavigationEntryYMargin = 1;
// Padding between the navigation bar and the render view contents.
const int kNavigationBarBottomPadding = 3;
-// NavigationBar size.
+// NavigationBar constants.
const int kNavigationBarHeight = 25;
+const int kNavigationBarBorderThickness = 1;
// The delta applied to the default font size for the omnibox.
const int kAutocompleteEditFontDelta = 3;
@@ -147,8 +147,7 @@ void TabContentsDelegateImpl::OpenURLFromTab(TabContents* source,
// mode.
class NavigationBar : public views::View,
- public AutocompleteEditController,
- public BubblePositioner {
+ public AutocompleteEditController {
public:
explicit NavigationBar(AppLauncher* app_launcher)
: app_launcher_(app_launcher),
@@ -156,7 +155,12 @@ class NavigationBar : public views::View,
SetFocusable(true);
location_entry_view_ = new views::NativeViewHost;
AddChildView(location_entry_view_);
- set_border(views::Border::CreateSolidBorder(1, SK_ColorGRAY));
+ set_border(views::Border::CreateSolidBorder(kNavigationBarBorderThickness,
+ SK_ColorGRAY));
+
+ AddChildView(&popup_positioning_view_);
+ popup_positioning_view_.SetVisible(false);
+ popup_positioning_view_.set_parent_owned(false);
}
virtual ~NavigationBar() {
@@ -186,7 +190,8 @@ class NavigationBar : public views::View,
new AutocompleteEditViewWin(font, this, browser->toolbar_model(),
this, GetWidget()->GetNativeView(),
browser->profile(),
- browser->command_updater(), false, this);
+ browser->command_updater(), false,
+ &popup_positioning_view_);
location_entry_.reset(autocomplete_view);
autocomplete_view->Update(NULL);
// The Update call above sets the autocomplete text to the current one in
@@ -196,7 +201,8 @@ class NavigationBar : public views::View,
AutocompleteEditViewGtk* autocomplete_view =
new AutocompleteEditViewGtk(this, browser->toolbar_model(),
browser->profile(),
- browser->command_updater(), false, this);
+ browser->command_updater(), false,
+ &popup_positioning_view_);
autocomplete_view->Init();
gtk_widget_show_all(autocomplete_view->GetNativeView());
gtk_widget_hide(autocomplete_view->GetNativeView());
@@ -216,21 +222,10 @@ class NavigationBar : public views::View,
bounds.width() - 2 * (kNavigationEntryPadding +
kNavigationEntryXMargin),
bounds.height() - kNavigationEntryYMargin * 2);
- }
- // BubblePositioner implementation.
- virtual gfx::Rect GetLocationStackBounds() const {
- gfx::Rect bounds = location_entry_view_->GetBounds(
- views::View::APPLY_MIRRORING_TRANSFORMATION);
- gfx::Point origin(bounds.x(), bounds.bottom() + kNavigationEntryPadding);
- views::View::ConvertPointToScreen(this, &origin);
- gfx::Rect rect = gfx::Rect(origin, gfx::Size(500, 0));
- if (UILayoutIsRightToLeft()) {
- // Align the window to the right side of the entry view when
- // UI is RTL mode.
- rect.set_x(rect.x() - (rect.width() - location_entry_view_->width()));
- }
- return rect;
+ gfx::Rect popup_positioning_bounds(bounds);
+ popup_positioning_bounds.Inset(0, -(kNavigationBarBorderThickness + 1));
+ popup_positioning_view_.SetBounds(popup_positioning_bounds);
}
// AutocompleteController implementation.
@@ -270,6 +265,11 @@ class NavigationBar : public views::View,
NOTIMPLEMENTED();
#endif
+ // This invisible view is provided to the popup in place of |this|, so the
+ // popup can size itself against it using the same offsets it does with the
+ // LocationBarView.
+ views::View popup_positioning_view_;
+
DISALLOW_COPY_AND_ASSIGN(NavigationBar);
};
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
index ae4ad87..7f974a8 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -12,7 +12,6 @@
#include "base/i18n/rtl.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 "gfx/canvas.h"
#include "gfx/color_utils.h"
@@ -91,13 +90,11 @@ const int kIconVerticalPadding = 2;
// bottom of the row. See comment about the use of "minimum" for
// kIconVerticalPadding.
const int kTextVerticalPadding = 3;
-// The padding at the left edge of the row, left of the icon.
-const int kRowLeftPadding = 6;
-// The padding on the right edge of the row, right of the text.
-const int kRowRightPadding = 3;
+// The padding at the edges of the row.
+const int kRowPadding = 3;
// The horizontal distance between the right edge of the icon and the left edge
// of the text.
-const int kIconTextSpacing = 9;
+const int kIconTextSpacing = 4;
// The size delta between the font used for the edit and the result rows. Passed
// to gfx::Font::DeriveFont.
#if !defined(OS_CHROMEOS)
@@ -344,14 +341,12 @@ void AutocompleteResultView::Paint(gfx::Canvas* canvas) {
}
void AutocompleteResultView::Layout() {
- icon_bounds_.SetRect(kRowLeftPadding, (height() - icon_size_) / 2,
- icon_size_, icon_size_);
+ icon_bounds_.SetRect(kRowPadding, (height() - icon_size_) / 2, icon_size_,
+ icon_size_);
int text_x = icon_bounds_.right() + kIconTextSpacing;
- text_bounds_.SetRect(
- text_x,
- std::max(0, (height() - font_.height()) / 2),
- std::max(0, bounds().right() - text_x - kRowRightPadding),
- font_.height());
+ text_bounds_.SetRect(text_x, std::max(0, (height() - font_.height()) / 2),
+ std::max(0, bounds().right() - text_x - kRowPadding),
+ font_.height());
}
gfx::Size AutocompleteResultView::GetPreferredSize() {
@@ -476,8 +471,8 @@ int AutocompleteResultView::DrawStringFragment(
gfx::Font display_font = GetFragmentFont(style);
// Clamp text width to the available width within the popup so we elide if
// necessary.
- int string_width = std::min(display_font.GetStringWidth(text),
- width() - kRowRightPadding - x);
+ int string_width =
+ std::min(display_font.GetStringWidth(text), width() - kRowPadding - x);
int string_left = mirroring_context_->GetLeft(x, x + string_width);
const int flags = force_rtl_directionality ?
gfx::Canvas::FORCE_RTL_DIRECTIONALITY : 0;
@@ -508,10 +503,10 @@ AutocompletePopupContentsView::AutocompletePopupContentsView(
AutocompleteEditView* edit_view,
AutocompleteEditModel* edit_model,
Profile* profile,
- const BubblePositioner* bubble_positioner)
+ const views::View* location_bar)
: model_(new AutocompletePopupModel(this, edit_model, profile)),
edit_view_(edit_view),
- bubble_positioner_(bubble_positioner),
+ location_bar_(location_bar),
result_font_(font.DeriveFont(kEditFontAdjust)),
ignore_mouse_drag_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(size_animation_(this)) {
@@ -577,10 +572,13 @@ void AutocompletePopupContentsView::UpdatePopupAppearance() {
}
// Calculate desired bounds.
- 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)));
+ gfx::Rect location_bar_bounds(location_bar_->bounds());
+ gfx::Point location;
+ views::View::ConvertPointToScreen(location_bar_, &location);
+ location_bar_bounds.set_origin(location);
+ location_bar_bounds.set_height(location_bar_bounds.height() - 1);
+ gfx::Rect new_target_bounds(bubble_border_->GetBounds(location_bar_bounds,
+ gfx::Size(location_bar_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
@@ -787,7 +785,19 @@ void AutocompletePopupContentsView::MakeContentsPath(
SkIntToScalar(bounding_rect.bottom()));
SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius());
- path->addRoundRect(rect, radius, radius);
+ SkScalar scaled_radius =
+ SkScalarMul(radius, (SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3);
+ path->moveTo(rect.fRight, rect.fTop);
+ path->lineTo(rect.fRight, rect.fBottom - radius);
+ path->cubicTo(rect.fRight, rect.fBottom - radius + scaled_radius,
+ rect.fRight - radius + scaled_radius, rect.fBottom,
+ rect.fRight - radius, rect.fBottom);
+ path->lineTo(rect.fLeft + radius, rect.fBottom);
+ path->cubicTo(rect.fLeft + radius - scaled_radius, rect.fBottom,
+ rect.fLeft, rect.fBottom - radius + scaled_radius,
+ rect.fLeft, rect.fBottom - radius);
+ path->lineTo(rect.fLeft, rect.fTop);
+ path->close();
}
void AutocompletePopupContentsView::UpdateBlurRegion() {
@@ -860,14 +870,3 @@ size_t AutocompletePopupContentsView::GetIndexForPoint(
}
return AutocompletePopupModel::kNoMatch;
}
-
-// static
-AutocompletePopupView* AutocompletePopupView::CreatePopupView(
- const gfx::Font& font,
- AutocompleteEditView* edit_view,
- AutocompleteEditModel* edit_model,
- Profile* profile,
- const BubblePositioner* bubble_positioner) {
- return new AutocompletePopupContentsView(font, edit_view, edit_model,
- 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 58d3c3a..31237c4 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h
@@ -45,7 +45,7 @@ class AutocompletePopupContentsView : public views::View,
AutocompleteEditView* edit_view,
AutocompleteEditModel* edit_model,
Profile* profile,
- const BubblePositioner* bubble_positioner);
+ const views::View* location_bar);
virtual ~AutocompletePopupContentsView() {}
// Returns the bounds the popup should be shown at. This is the display bounds
@@ -122,8 +122,8 @@ class AutocompletePopupContentsView : public views::View,
// The edit view that invokes us.
AutocompleteEditView* edit_view_;
- // An object that tells the popup how to position itself.
- const BubblePositioner* bubble_positioner_;
+ // An object that the popup positions itself against.
+ const views::View* location_bar_;
// Our border, which can compute our desired bounds.
const BubbleBorder* bubble_border_;
diff --git a/chrome/browser/views/bubble_border.cc b/chrome/browser/views/bubble_border.cc
index 230a0f4..d7bd07f 100644
--- a/chrome/browser/views/bubble_border.cc
+++ b/chrome/browser/views/bubble_border.cc
@@ -1,6 +1,6 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
-// source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
#include "chrome/browser/views/bubble_border.h"
@@ -31,10 +31,6 @@ static const int kArrowInteriorHeight = 7;
gfx::Rect BubbleBorder::GetBounds(const gfx::Rect& position_relative_to,
const gfx::Size& contents_size) const {
- // The spacing (in pixels) between |position_relative_to| and the bubble
- // content.
- const int kBubbleSpacing = 2;
-
// Desired size is size of contents enlarged by the size of the border images.
gfx::Size border_size(contents_size);
gfx::Insets insets;
@@ -43,6 +39,10 @@ gfx::Rect BubbleBorder::GetBounds(const gfx::Rect& position_relative_to,
insets.top() + insets.bottom());
// Screen position depends on the arrow location.
+ // The arrow should overlap the target by some amount since the bottom arrow
+ // has lots of shadow below it and the top arrow is given an equivalent amount
+ // of padding.
+ const int kArrowOverlap = 3;
int x = position_relative_to.x() + (position_relative_to.width() / 2);
if (arrow_is_left())
x -= arrow_x_offset_;
@@ -51,25 +51,26 @@ gfx::Rect BubbleBorder::GetBounds(const gfx::Rect& position_relative_to,
else
x += (arrow_x_offset_ - border_size.width() + 1);
int y = position_relative_to.y();
- if (arrow_is_top()) {
- y += (position_relative_to.height() -
- (top_arrow_->height() - kBubbleSpacing));
- } else if (arrow_location_ == NONE) {
- y += (position_relative_to.height() - (top_->height() - kBubbleSpacing));
- } else {
- y += ((bottom_arrow_->height() - kBubbleSpacing) - border_size.height());
- }
+ if (arrow_is_bottom())
+ y += (kArrowOverlap - border_size.height());
+ else if (arrow_location_ == NONE)
+ y += position_relative_to.height();
+ else
+ y += (position_relative_to.height() - kArrowOverlap);
return gfx::Rect(x, y, border_size.width(), border_size.height());
}
void BubbleBorder::GetInsets(gfx::Insets* insets) const {
- int top = top_->height();
- int bottom = bottom_->height();
- if (arrow_is_top())
- top = std::max(top, top_arrow_->height());
- else if (arrow_location_ != NONE)
- bottom = std::max(bottom, bottom_arrow_->height());
+ int top, bottom;
+ if (arrow_is_bottom()) {
+ top = top_->height();
+ bottom = std::max(bottom_->height(), bottom_arrow_->height());
+ } else {
+ top = (arrow_location_ == NONE) ?
+ 0 : std::max(top_->height(), top_arrow_->height());
+ bottom = bottom_->height();
+ }
insets->Set(top, left_->width(), bottom, right_->width());
}
@@ -132,25 +133,33 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const {
* border_bottom∙∙∙∙└────┴─┤ ▼ ├──────┤ ▼ ├─┴────┘
* view.height()∙∙∙∙∙∙∙∙∙∙∙└───┘ └───┘
*
- * (At most one of the arrows will be drawn)
+ * If |arrow_location_| == NONE, the entire top edge is ommitted, and
+ * |tl_bottom| == |tr_bottom| == 0. Otherwise, one of the four arrows will be
+ * drawn.
*/
gfx::Insets insets;
GetInsets(&insets);
int top = insets.top();
- int border_top = top - t_height;
- int tl_bottom = border_top + tl_height;
- int tr_bottom = border_top + tr_height;
int bottom = view.height() - insets.bottom();
int border_bottom = bottom + b_height;
int bl_y = border_bottom - bl_height;
int br_y = border_bottom - br_height;
- // Top left corner
- canvas->DrawBitmapInt(*top_left_, 0, border_top);
+ int border_top, tl_bottom, tr_bottom;
+ if (arrow_location_ == NONE) {
+ border_top = tl_bottom = tr_bottom = 0;
+ } else {
+ border_top = top - t_height;
+ tl_bottom = border_top + tl_height;
+ tr_bottom = border_top + tr_height;
+
+ // Top left corner
+ canvas->DrawBitmapInt(*top_left_, 0, border_top);
- // Top right corner
- canvas->DrawBitmapInt(*top_right_, width - tr_width, border_top);
+ // Top right corner
+ canvas->DrawBitmapInt(*top_right_, width - tr_width, border_top);
+ }
// Right edge
canvas->TileImageInt(*right_, width - r_width, tr_bottom, r_width,
@@ -167,7 +176,7 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const {
canvas->TileImageInt(*left_, 0, tl_bottom, left_->width(), bl_y - tl_bottom);
// Arrow edge, if necessary
- bool should_draw_top_edge = true;
+ bool should_draw_top_edge = false;
bool should_draw_bottom_edge = true;
if (arrow_location_ != NONE) {
/* Here's what the variables below mean (without loss of generality):
@@ -194,17 +203,8 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const {
SkBitmap* arrow;
int left_of_edge, right_of_edge, edge_y, arrow_y;
SkScalar border_y, tip_y;
- if (arrow_is_top()) {
- should_draw_top_edge = false;
- edge = top_;
- arrow = top_arrow_;
- left_of_edge = tl_width;
- right_of_edge = tr_width;
- edge_y = border_top;
- arrow_y = top - top_arrow_->height();
- border_y = SkIntToScalar(top);
- tip_y = SkIntToScalar(top - kArrowInteriorHeight);
- } else {
+ if (arrow_is_bottom()) {
+ should_draw_top_edge = true;
should_draw_bottom_edge = false;
edge = bottom_;
arrow = bottom_arrow_;
@@ -213,8 +213,17 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const {
edge_y = arrow_y = bottom;
border_y = SkIntToScalar(bottom);
tip_y = SkIntToScalar(bottom + kArrowInteriorHeight);
+ } else {
+ edge = top_;
+ arrow = top_arrow_;
+ left_of_edge = tl_width;
+ right_of_edge = tr_width;
+ edge_y = border_top;
+ arrow_y = top - top_arrow_->height();
+ border_y = SkIntToScalar(top);
+ tip_y = SkIntToScalar(top - kArrowInteriorHeight);
}
- int arrow_width = (arrow_is_top() ? top_arrow_ : bottom_arrow_)->width();
+ int arrow_width = arrow->width();
int arrow_center = arrow_is_left() ?
arrow_x_offset_ : width - arrow_x_offset_ - 1;
int arrow_x = arrow_center - (arrow_width / 2);
@@ -271,6 +280,8 @@ void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const {
void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
// The border of this view creates an anti-aliased round-rect region for the
// contents, which we need to fill with the background color.
+ // NOTE: This doesn't handle an arrow location of "NONE", which has square top
+ // corners.
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kFill_Style);
diff --git a/chrome/browser/views/bubble_border.h b/chrome/browser/views/bubble_border.h
index 3b48048..e2d5de3 100644
--- a/chrome/browser/views/bubble_border.h
+++ b/chrome/browser/views/bubble_border.h
@@ -1,6 +1,6 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
-// source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
#ifndef CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_
#define CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_
@@ -11,8 +11,11 @@
class SkBitmap;
-// Renders a round-rect border, with optional arrow (off by default), and a
-// custom dropshadow. This can be used to produce floating "bubble" objects.
+// Renders a border, with optional arrow (off by default), and a custom
+// dropshadow. This can be used to produce floating "bubble" objects.
+//
+// If the arrow is on, the bubble has four round corner. If not, it has round
+// corners on the bottom and square corners on the top, and lacks a top border.
class BubbleBorder : public views::Border {
public:
// Possible locations for the (optional) arrow.
@@ -68,9 +71,10 @@ class BubbleBorder : public views::Border {
virtual ~BubbleBorder() { }
- // Returns true if there is an arrow and it is positioned on the top edge.
- bool arrow_is_top() const {
- return (arrow_location_ == TOP_LEFT) || (arrow_location_ == TOP_RIGHT);
+ // Returns true if there is an arrow and it is positioned on the bottom edge.
+ bool arrow_is_bottom() const {
+ return (arrow_location_ == BOTTOM_LEFT) ||
+ (arrow_location_ == BOTTOM_RIGHT);
}
// Returns true if there is an arrow and it is positioned on the left side.
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc
index e5c4858..218decd 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/views/info_bubble.cc
@@ -128,6 +128,8 @@ void BorderContents::InitAndGetBounds(
void BorderContents::Paint(gfx::Canvas* canvas) {
// The border of this view creates an anti-aliased round-rect region for the
// contents, which we need to fill with the background color.
+ // NOTE: This doesn't handle an arrow location of "NONE", which has square top
+ // corners.
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kFill_Style);
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index 324731f..4ea36e2 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -17,7 +17,6 @@
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/alternate_nav_url_fetcher.h"
#include "chrome/browser/browser_list.h"
-#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/content_setting_bubble_model.h"
#include "chrome/browser/content_setting_image_model.h"
@@ -126,8 +125,7 @@ LocationBarView::LocationBarView(Profile* profile,
CommandUpdater* command_updater,
ToolbarModel* model,
Delegate* delegate,
- bool popup_window_mode,
- const BubblePositioner* bubble_positioner)
+ bool popup_window_mode)
: profile_(profile),
command_updater_(command_updater),
model_(model),
@@ -140,8 +138,7 @@ LocationBarView::LocationBarView(Profile* profile,
type_to_search_view_(l10n_util::GetString(IDS_OMNIBOX_EMPTY_TEXT)),
star_view_(command_updater),
popup_window_mode_(popup_window_mode),
- first_run_bubble_(this),
- bubble_positioner_(bubble_positioner) {
+ first_run_bubble_(this) {
DCHECK(profile_);
SetID(VIEW_ID_LOCATION_BAR);
SetFocusable(true);
@@ -175,10 +172,10 @@ void LocationBarView::Init() {
#if defined(OS_WIN)
location_entry_.reset(new AutocompleteEditViewWin(font_, this, model_, this,
GetWidget()->GetNativeView(), profile_, command_updater_,
- popup_window_mode_, bubble_positioner_));
+ popup_window_mode_, this));
#else
location_entry_.reset(new AutocompleteEditViewGtk(this, model_, profile_,
- command_updater_, popup_window_mode_, bubble_positioner_));
+ command_updater_, popup_window_mode_, this));
location_entry_->Init();
// Make all the children of the widget visible. NOTE: this won't display
// anything, it just toggles the visible flag.
@@ -217,9 +214,8 @@ void LocationBarView::Init() {
security_info_label_.set_parent_owned(false);
for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
- ContentSettingImageView* content_blocked_view =
- new ContentSettingImageView(static_cast<ContentSettingsType>(i), this,
- profile_, bubble_positioner_);
+ ContentSettingImageView* content_blocked_view = new ContentSettingImageView(
+ static_cast<ContentSettingsType>(i), this, profile_);
content_setting_views_.push_back(content_blocked_view);
AddChildView(content_blocked_view);
content_blocked_view->SetVisible(false);
@@ -402,13 +398,14 @@ void LocationBarView::SetStarToggled(bool on) {
}
void LocationBarView::ShowStarBubble(const GURL& url, bool newly_bookmarked) {
- gfx::Rect bounds(bubble_positioner_->GetLocationStackBounds());
- gfx::Point location;
- views::View::ConvertPointToScreen(&star_view_, &location);
- bounds.set_x(location.x());
- bounds.set_width(star_view_.width());
- browser::ShowBookmarkBubbleView(GetWindow(), bounds, &star_view_, profile_,
- url, newly_bookmarked);
+ gfx::Rect screen_bounds(star_view_.GetImageBounds());
+ // Compensate for some built-in padding in the Star image.
+ screen_bounds.Inset(1, 1, 1, 2);
+ gfx::Point origin(screen_bounds.origin());
+ views::View::ConvertPointToScreen(&star_view_, &origin);
+ screen_bounds.set_origin(origin);
+ browser::ShowBookmarkBubbleView(GetWindow(), screen_bounds, &star_view_,
+ profile_, url, newly_bookmarked);
}
gfx::Size LocationBarView::GetPreferredSize() {
@@ -1188,15 +1185,13 @@ void LocationBarView::KeywordHintView::Layout() {
LocationBarView::ContentSettingImageView::ContentSettingImageView(
ContentSettingsType content_type,
const LocationBarView* parent,
- Profile* profile,
- const BubblePositioner* bubble_positioner)
+ Profile* profile)
: content_setting_image_model_(
ContentSettingImageModel::CreateContentSettingImageModel(
content_type)),
parent_(parent),
profile_(profile),
- info_bubble_(NULL),
- bubble_positioner_(bubble_positioner) {
+ info_bubble_(NULL) {
}
LocationBarView::ContentSettingImageView::~ContentSettingImageView() {
@@ -1237,11 +1232,10 @@ void LocationBarView::ContentSettingImageView::OnMouseReleased(
if (!tab_contents)
return;
- gfx::Rect bounds(bubble_positioner_->GetLocationStackBounds());
- gfx::Point location;
- views::View::ConvertPointToScreen(this, &location);
- bounds.set_x(location.x());
- bounds.set_width(width());
+ gfx::Rect screen_bounds(GetImageBounds());
+ gfx::Point origin(screen_bounds.origin());
+ views::View::ConvertPointToScreen(this, &origin);
+ screen_bounds.set_origin(origin);
ContentSettingBubbleContents* bubble_contents =
new ContentSettingBubbleContents(
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
@@ -1249,7 +1243,8 @@ void LocationBarView::ContentSettingImageView::OnMouseReleased(
content_setting_image_model_->get_content_settings_type()),
profile_, tab_contents);
DCHECK(!info_bubble_);
- info_bubble_ = InfoBubble::Show(GetWindow(), bounds, bubble_contents, this);
+ info_bubble_ =
+ InfoBubble::Show(GetWindow(), screen_bounds, bubble_contents, this);
bubble_contents->set_info_bubble(info_bubble_);
}
@@ -1333,19 +1328,17 @@ void LocationBarView::PageActionImageView::ExecuteAction(int button,
if (popup_showing)
return;
- View* parent = GetParent();
- gfx::Point origin;
- View::ConvertPointToScreen(parent, &origin);
- gfx::Rect rect = parent->bounds();
- rect.set_x(origin.x());
- rect.set_y(origin.y());
+ gfx::Rect screen_bounds(GetImageBounds());
+ gfx::Point origin(screen_bounds.origin());
+ View::ConvertPointToScreen(this, &origin);
+ screen_bounds.set_origin(origin);
popup_ = ExtensionPopup::Show(
page_action_->GetPopupUrl(current_tab_id_),
browser,
browser->profile(),
browser->window()->GetNativeHandle(),
- rect,
+ screen_bounds,
BubbleBorder::TOP_RIGHT,
true, // Activate the popup window.
inspect_with_devtools,
@@ -1378,20 +1371,20 @@ void LocationBarView::PageActionImageView::OnMouseReleased(
button = 2;
} else if (event.IsRightMouseButton()) {
// Get the top left point of this button in screen coordinates.
- gfx::Point point = gfx::Point(0, 0);
- ConvertPointToScreen(this, &point);
+ gfx::Point menu_origin;
+ ConvertPointToScreen(this, &menu_origin);
// Make the menu appear below the button.
- point.Offset(0, height());
+ menu_origin.Offset(0, height());
Extension* extension = profile_->GetExtensionsService()->GetExtensionById(
page_action()->extension_id(), false);
Browser* browser = BrowserView::GetBrowserViewForNativeWindow(
platform_util::GetTopLevel(GetWidget()->GetNativeView()))->browser();
- context_menu_contents_ = new ExtensionContextMenuModel(
- extension, browser, this);
+ context_menu_contents_ =
+ new ExtensionContextMenuModel(extension, browser, this));
context_menu_menu_.reset(new views::Menu2(context_menu_contents_.get()));
- context_menu_menu_->RunContextMenuAt(point);
+ context_menu_menu_->RunContextMenuAt(menu_origin);
return;
}
@@ -1426,8 +1419,8 @@ void LocationBarView::PageActionImageView::UpdateVisibility(
current_tab_id_ = ExtensionTabUtil::GetTabId(contents);
current_url_ = url;
- bool visible = preview_enabled_ ||
- page_action_->GetIsVisible(current_tab_id_);
+ bool visible =
+ preview_enabled_ || page_action_->GetIsVisible(current_tab_id_);
if (visible) {
// Set the tooltip.
tooltip_ = page_action_->GetTitle(current_tab_id_);
diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h
index dee0ee2..2be8812 100644
--- a/chrome/browser/views/location_bar_view.h
+++ b/chrome/browser/views/location_bar_view.h
@@ -37,7 +37,6 @@
#endif
class Browser;
-class BubblePositioner;
class CommandUpdater;
class ContentSettingImageModel;
class ExtensionAction;
@@ -82,8 +81,7 @@ class LocationBarView : public LocationBar,
CommandUpdater* command_updater,
ToolbarModel* model,
Delegate* delegate,
- bool popup_window_mode,
- const BubblePositioner* bubble_positioner);
+ bool popup_window_mode);
virtual ~LocationBarView();
void Init();
@@ -318,8 +316,7 @@ class LocationBarView : public LocationBar,
public:
ContentSettingImageView(ContentSettingsType content_type,
const LocationBarView* parent,
- Profile* profile,
- const BubblePositioner* bubble_positioner);
+ Profile* profile);
virtual ~ContentSettingImageView();
void set_profile(Profile* profile) { profile_ = profile; }
@@ -347,10 +344,6 @@ class LocationBarView : public LocationBar,
// The currently shown info bubble if any.
InfoBubble* info_bubble_;
- // A positioner used to give the info bubble the correct target bounds. The
- // caller maintains ownership of this and must ensure it's kept alive.
- const BubblePositioner* bubble_positioner_;
-
DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView);
};
typedef std::vector<ContentSettingImageView*> ContentSettingViews;
@@ -591,9 +584,6 @@ class LocationBarView : public LocationBar,
// Used schedule a task for the first run info bubble.
ScopedRunnableMethodFactory<LocationBarView> first_run_bubble_;
- // The positioner that places the omnibox and info bubbles.
- const BubblePositioner* bubble_positioner_;
-
// Storage of string needed for accessibility.
std::wstring accessible_name_;
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index 97224d1..e69ff0f 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -305,30 +305,6 @@ void ToolbarView::ButtonPressed(views::Button* sender,
}
////////////////////////////////////////////////////////////////////////////////
-// ToolbarView, BubblePositioner implementation:
-
-gfx::Rect ToolbarView::GetLocationStackBounds() const {
- // The number of pixels from the left or right edges of the location stack to
- // "just inside the visible borders". When the omnibox bubble contents are
- // aligned with this, the visible borders tacked on to the outsides will line
- // up with the visible borders on the location stack.
- const int kLocationStackEdgeWidth = 2;
-
- gfx::Point origin;
- views::View::ConvertPointToScreen(reload_, &origin);
- gfx::Rect stack_bounds(origin.x(), origin.y(),
- reload_->width() + location_bar_->width() + go_->width(),
- location_bar_->height());
- if (UILayoutIsRightToLeft()) {
- stack_bounds.set_x(
- stack_bounds.x() - location_bar_->width() - go_->width());
- }
- // Inset the bounds to just inside the visible edges (see comment above).
- stack_bounds.Inset(kLocationStackEdgeWidth, 0);
- return stack_bounds;
-}
-
-////////////////////////////////////////////////////////////////////////////////
// ToolbarView, NotificationObserver implementation:
void ToolbarView::Observe(NotificationType type,
@@ -620,8 +596,7 @@ void ToolbarView::CreateCenterStack(Profile *profile) {
location_bar_ = new LocationBarView(profile, browser_->command_updater(),
model_, this,
- display_mode_ == DISPLAYMODE_LOCATION,
- this);
+ display_mode_ == DISPLAYMODE_LOCATION);
// The Go button.
go_ = new GoButton(location_bar_, browser_);
diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h
index 86e3249..6e45799 100644
--- a/chrome/browser/views/toolbar_view.h
+++ b/chrome/browser/views/toolbar_view.h
@@ -11,7 +11,6 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/app_menu_model.h"
#include "chrome/browser/back_forward_menu_model.h"
-#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/page_menu_model.h"
#include "chrome/browser/pref_member.h"
@@ -40,8 +39,7 @@ class ToolbarView : public AccessibleToolbarView,
public LocationBarView::Delegate,
public NotificationObserver,
public CommandUpdater::CommandObserver,
- public views::ButtonListener,
- public BubblePositioner {
+ public views::ButtonListener {
public:
explicit ToolbarView(Browser* browser);
virtual ~ToolbarView();
@@ -112,9 +110,6 @@ class ToolbarView : public AccessibleToolbarView,
// Overridden from views::BaseButton::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // BubblePositioner:
- virtual gfx::Rect GetLocationStackBounds() const;
-
// Overridden from NotificationObserver:
virtual void Observe(NotificationType type,
const NotificationSource& source,