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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 2914163004: Omnibox UI Experiments: Make suggestions dropdown match omnibox width. (Closed)
Patch Set: Merge remote-tracking branch 'refs/remotes/origin/master' into 024-omnibox-width-views Created 3 years, 6 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
« no previous file with comments | « chrome/browser/flag_descriptions.cc ('k') | components/omnibox/browser/omnibox_field_trial.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/flag_descriptions.cc ('k') | components/omnibox/browser/omnibox_field_trial.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698