Index: chrome/browser/ui/views/location_bar/location_bar_view.cc |
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
index f23d8467e16dc0ae5204caed528a6548a86403d3..a962a9e1518d1226bc0f1cfada820fa748c3ae11 100644 |
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc |
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
@@ -7,6 +7,7 @@ |
#include <algorithm> |
#include <map> |
+#include "base/feature_list.h" |
#include "base/i18n/rtl.h" |
#include "base/memory/ptr_util.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -51,6 +52,7 @@ |
#include "chrome/grit/generated_resources.h" |
#include "components/bookmarks/common/bookmark_pref_names.h" |
#include "components/favicon/content/content_favicon_driver.h" |
+#include "components/omnibox/browser/omnibox_field_trial.h" |
#include "components/omnibox/browser/omnibox_popup_model.h" |
#include "components/omnibox/browser/omnibox_popup_view.h" |
#include "components/prefs/pref_service.h" |
@@ -370,12 +372,25 @@ void LocationBarView::GetOmniboxPopupPositioningInfo( |
int* left_margin, |
int* right_margin, |
int top_edge_overlap) { |
- *top_left_screen_coord = gfx::Point(0, parent()->height() - top_edge_overlap); |
+ // The popup contents are always sized matching the location bar size. |
+ const int popup_contents_left = x(); |
+ const int popup_contents_right = bounds().right(); |
+ |
+ // The popup itself may either be the same width as the contents, or as wide |
+ // as the toolbar. |
+ bool narrow_popup = |
+ base::FeatureList::IsEnabled(omnibox::kUIExperimentNarrowDropdown); |
+ const int popup_left = narrow_popup ? popup_contents_left : 0; |
+ const int popup_right = |
+ narrow_popup ? popup_contents_right : parent()->width(); |
+ |
+ *top_left_screen_coord = |
+ gfx::Point(popup_left, parent()->height() - top_edge_overlap); |
views::View::ConvertPointToScreen(parent(), top_left_screen_coord); |
- *popup_width = parent()->width(); |
- *left_margin = x(); |
- *right_margin = *popup_width - bounds().right(); |
+ *popup_width = popup_right - popup_left; |
+ *left_margin = popup_contents_left - popup_left; |
+ *right_margin = popup_right - popup_contents_right; |
} |
//////////////////////////////////////////////////////////////////////////////// |