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..e28be3b77bf5028a538fd99001cca4e7558e3229 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,28 @@ 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( |
+ provider->GetDistanceMetric(DISTANCE_TOAST_CONTROL_VERTICAL), 0)); |
+ close_button_->SetProperty(views::kMarginsKey, new gfx::Insets( |
+ provider->GetDistanceMetric(DISTANCE_TOAST_CONTROL_VERTICAL), 0)); |
+ find_text_->SetProperty(views::kMarginsKey, new gfx::Insets( |
+ provider->GetDistanceMetric(DISTANCE_TOAST_CONTROL_VERTICAL), 0)); |
+ match_count_text_->SetProperty(views::kMarginsKey, new gfx::Insets( |
+ provider->GetDistanceMetric(DISTANCE_TOAST_LABEL_VERTICAL), 0)); |
+ separator_->SetProperty(views::kMarginsKey, new gfx::Insets( |
+ provider->GetDistanceMetric(DISTANCE_TOAST_LABEL_VERTICAL), 0)); |
+ |
find_text_->SetBorder(views::NullBorder()); |
views::BoxLayout* manager = |
new views::BoxLayout(views::BoxLayout::kHorizontal, |
- gfx::Insets(kInteriorPadding), kInterChildSpacing); |
+ provider->GetInsetsMetric(views::INSETS_TOAST), |
+ provider->GetDistanceMetric( |
+ views::DISTANCE_RELATED_CONTROL_HORIZONTAL)); |
SetLayoutManager(manager); |
manager->SetFlexForView(find_text_, 1); |
} |
@@ -220,9 +226,9 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result, |
return; |
} |
- match_count_text_->SetText(l10n_util::GetStringFUTF16( |
- IDS_FIND_IN_PAGE_COUNT, base::FormatNumber(result.active_match_ordinal()), |
- base::FormatNumber(result.number_of_matches()))); |
+ match_count_text_->SetText( |
+ base::FormatNumber(result.active_match_ordinal()) |
+ + L"/" + base::FormatNumber(result.number_of_matches())); |
Peter Kasting
2017/07/13 06:05:35
This isn't localizable. You need to change IDS_FI
ananta
2017/07/13 06:27:42
Thanks for catching this. Dunno how I assumed that
|
UpdateMatchCountAppearance(result.number_of_matches() == 0 && |
result.final_update()); |