Index: chrome/browser/ui/views/find_bar_view.cc |
diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc |
index 49627d798f76cf6dbe42eead2924251379554333..53842880fe0ab255133d7bef671b158a290ab432 100644 |
--- a/chrome/browser/ui/views/find_bar_view.cc |
+++ b/chrome/browser/ui/views/find_bar_view.cc |
@@ -21,6 +21,7 @@ |
#include "chrome/browser/ui/view_ids.h" |
#include "chrome/browser/ui/views/find_bar_host.h" |
#include "chrome/browser/ui/views/frame/browser_view.h" |
+#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
#include "chrome/grit/generated_resources.h" |
#include "components/strings/grit/components_strings.h" |
#include "ui/base/ime/input_method.h" |
@@ -47,15 +48,6 @@ |
namespace { |
-// These layout constants are all in dp. |
-// The horizontal and vertical insets for the bar. |
-const int kInteriorPadding = 8; |
-// Default spacing between child views. |
-const int kInterChildSpacing = 4; |
-// Additional spacing around the separator. |
-const int kSeparatorLeftSpacing = 12 - kInterChildSpacing; |
-const int kSeparatorRightSpacing = 8 - kInterChildSpacing; |
- |
// The default number of average characters that the text box will be. |
const int kDefaultCharWidth = 30; |
@@ -161,15 +153,22 @@ FindBarView::FindBarView(FindBarHost* host) |
base::MakeUnique<views::ViewTargeter>(this)); |
AddChildViewAt(match_count_text_, 1); |
- separator_->SetBorder(views::CreateEmptyBorder(0, kSeparatorLeftSpacing, 0, |
- kSeparatorRightSpacing)); |
+ ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
+ const int related_control_horizontal = provider->GetDistanceMetric( |
+ views::DISTANCE_RELATED_CONTROL_HORIZONTAL); |
+ |
+ separator_->SetBorder(views::CreateEmptyBorder( |
+ 0, related_control_horizontal, 0, related_control_horizontal)); |
Peter Kasting
2017/07/06 06:29:16
It seems like this will result in 2x "related cont
ananta
2017/07/07 22:51:02
Thanks. With the margins as suggested incorporated
|
+ |
AddChildViewAt(separator_, 2); |
find_text_->SetBorder(views::NullBorder()); |
views::BoxLayout* manager = |
new views::BoxLayout(views::BoxLayout::kHorizontal, |
- gfx::Insets(kInteriorPadding), kInterChildSpacing); |
+ gfx::Insets(provider->GetInsetsMetric( |
+ views::INSETS_BUBBLE_CONTENTS)), |
Peter Kasting
2017/07/06 06:29:16
The bubble insets aren't correct for a toast like
ananta
2017/07/07 22:51:02
Thanks. I added some code to set the margins expli
|
+ related_control_horizontal); |
Peter Kasting
2017/07/06 06:29:16
This is sort of tricky, because on the current spe
ananta
2017/07/07 22:51:02
The next patch uses an inset of 0, 16. Each contro
Peter Kasting
2017/07/10 20:13:08
The buttons get really far apart doing this, becau
|
SetLayoutManager(manager); |
manager->SetFlexForView(find_text_, 1); |
} |