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..b0b50a1f2675089533e84ff409a32d35a35227bf 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" |
@@ -42,20 +43,12 @@ |
#include "ui/views/controls/separator.h" |
#include "ui/views/layout/box_layout.h" |
#include "ui/views/painter.h" |
+#include "ui/views/view_properties.h" |
#include "ui/views/view_targeter.h" |
#include "ui/views/widget/widget.h" |
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 +154,27 @@ FindBarView::FindBarView(FindBarHost* host) |
base::MakeUnique<views::ViewTargeter>(this)); |
AddChildViewAt(match_count_text_, 1); |
- separator_->SetBorder(views::CreateEmptyBorder(0, kSeparatorLeftSpacing, 0, |
- kSeparatorRightSpacing)); |
AddChildViewAt(separator_, 2); |
+ ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
+ |
+ find_next_button_->SetProperty(views::kMarginsKey, new gfx::Insets(0, |
Peter Kasting
2017/07/13 04:52:47
For insets, vertical comes first, then horizontal
ananta
2017/07/13 05:22:10
Yeah. I looked at it after I sent out the patch. S
|
+ provider->GetDistanceMetric(DISTANCE_TOAST_BUTTON_VERTICAL))); |
+ close_button_->SetProperty(views::kMarginsKey, new gfx::Insets(0, |
+ provider->GetDistanceMetric(DISTANCE_TOAST_BUTTON_VERTICAL))); |
+ find_text_->SetProperty(views::kMarginsKey, new gfx::Insets(0, |
+ provider->GetDistanceMetric(DISTANCE_TOAST_TEXT_VERTICAL))); |
+ match_count_text_->SetProperty(views::kMarginsKey, new gfx::Insets(0, |
+ provider->GetDistanceMetric(DISTANCE_TOAST_LABEL_VERTICAL))); |
+ |
find_text_->SetBorder(views::NullBorder()); |
views::BoxLayout* manager = |
new views::BoxLayout(views::BoxLayout::kHorizontal, |
- gfx::Insets(kInteriorPadding), kInterChildSpacing); |
+ provider->GetInsetsMetric( |
Peter Kasting
2017/07/13 04:52:47
This shouldn't have dialog contents insets, as tha
ananta
2017/07/13 05:22:10
Thanks. I used views::INSETS_DIALOG_CONTENTS).left
Peter Kasting
2017/07/13 05:31:37
I would probably just add an INSETS_TOAST in the l
ananta
2017/07/13 05:43:48
Done.
|
+ views::INSETS_DIALOG_CONTENTS), |
+ provider->GetDistanceMetric( |
+ views::DISTANCE_RELATED_CONTROL_HORIZONTAL)); |
SetLayoutManager(manager); |
manager->SetFlexForView(find_text_, 1); |
} |