Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6176)

Unified Diff: chrome/browser/views/app_launcher.cc

Issue 1578021: Shift omnibox dropdown in and up on Windows, and square off the top, so it co... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/app_launcher.cc
===================================================================
--- chrome/browser/views/app_launcher.cc (revision 43972)
+++ chrome/browser/views/app_launcher.cc (working copy)
@@ -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 @@
// 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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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);
};

Powered by Google App Engine
This is Rietveld 408576698