Chromium Code Reviews| Index: chrome/browser/ui/views/collected_cookies_views.cc |
| diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc |
| index 81e8017673d07a3635aea286cebb9ef7d5c18fbf..b3ce3c96ca740d2c81c42a0a2e812d00b84bea1a 100644 |
| --- a/chrome/browser/ui/views/collected_cookies_views.cc |
| +++ b/chrome/browser/ui/views/collected_cookies_views.cc |
| @@ -21,7 +21,7 @@ |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
| #include "chrome/browser/ui/views/cookie_info_view.h" |
| -#include "chrome/browser/ui/views/harmony/layout_delegate.h" |
| +#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/grit/generated_resources.h" |
| #include "chrome/grit/locale_settings.h" |
| @@ -71,11 +71,11 @@ const int kCookieInfoBottomPadding = 4; |
| // Starts a new row with the added ColumnSet. |
| void StartNewButtonColumnSet(views::GridLayout* layout, |
| const int column_layout_id) { |
| - LayoutDelegate* layout_delegate = LayoutDelegate::Get(); |
| - const int button_padding = layout_delegate->GetMetric( |
| - LayoutDelegate::Metric::RELATED_BUTTON_HORIZONTAL_SPACING); |
| - const int button_size_limit = layout_delegate->GetMetric( |
| - LayoutDelegate::Metric::BUTTON_MAX_LINKABLE_WIDTH); |
| + ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); |
| + const int button_padding = |
| + provider->GetDistanceMetric(views::DISTANCE_RELATED_BUTTON_HORIZONTAL); |
| + const int button_size_limit = |
| + provider->GetDistanceMetric(DISTANCE_BUTTON_MAX_LINKABLE_WIDTH); |
| views::ColumnSet* column_set = layout->AddColumnSet(column_layout_id); |
| column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 0, |
| @@ -291,8 +291,8 @@ gfx::Size CollectedCookiesViews::GetMinimumSize() const { |
| } |
| gfx::Size CollectedCookiesViews::GetPreferredSize() const { |
| - int preferred = LayoutDelegate::Get()->GetDialogPreferredWidth( |
| - LayoutDelegate::DialogWidth::MEDIUM); |
| + int preferred = |
| + ChromeLayoutProvider::Get()->GetDialogPreferredWidth(DialogWidth::MEDIUM); |
| return gfx::Size(preferred ? preferred : View::GetPreferredSize().width(), |
| View::GetPreferredSize().height()); |
| } |
| @@ -316,7 +316,7 @@ void CollectedCookiesViews::Init() { |
| using views::GridLayout; |
| GridLayout* layout = new GridLayout(this); |
| - if (LayoutDelegate::Get()->UseExtraDialogPadding()) |
| + if (ChromeLayoutProvider::Get()->UseExtraDialogPadding()) |
|
Peter Kasting
2017/04/12 21:37:43
Nit: Pull layout provider out to a temp for reuse?
kylix_rd
2017/04/13 16:45:42
Done.
|
| layout->SetInsets(gfx::Insets(kTabbedPaneTopPadding, 0, 0, 0)); |
| SetLayoutManager(layout); |
| @@ -338,17 +338,15 @@ void CollectedCookiesViews::Init() { |
| tabbed_pane->AddTab(label_blocked, CreateBlockedPane()); |
| tabbed_pane->SelectTabAt(0); |
| tabbed_pane->set_listener(this); |
| - if (LayoutDelegate::Get()->UseExtraDialogPadding()) { |
| - layout->AddPaddingRow( |
| - 0, |
| - LayoutDelegate::Get()->GetMetric( |
| - LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); |
| + if (ChromeLayoutProvider::Get()->UseExtraDialogPadding()) { |
| + layout->AddPaddingRow(0, ChromeLayoutProvider::Get()->GetDistanceMetric( |
| + views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| } |
| layout->StartRow(0, single_column_layout_id); |
| cookie_info_view_ = new CookieInfoView(); |
| layout->AddView(cookie_info_view_); |
| - if (LayoutDelegate::Get()->UseExtraDialogPadding()) |
| + if (ChromeLayoutProvider::Get()->UseExtraDialogPadding()) |
| layout->AddPaddingRow(0, kCookieInfoBottomPadding); |
| layout->StartRow(0, single_column_layout_id); |
| @@ -397,18 +395,15 @@ views::View* CollectedCookiesViews::CreateAllowedPane() { |
| layout->StartRow(0, single_column_layout_id); |
| layout->AddView(allowed_label_); |
| - layout->AddPaddingRow( |
| - 0, |
| - LayoutDelegate::Get()->GetMetric( |
| - LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING)); |
| + layout->AddPaddingRow(0, ChromeLayoutProvider::Get()->GetDistanceMetric( |
| + DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
|
Peter Kasting
2017/04/12 21:37:43
Nit: Pull vertical distance out to a temp for reus
kylix_rd
2017/04/13 16:45:42
Done.
|
| layout->StartRow(1, single_column_layout_id); |
| layout->AddView(CreateScrollView(allowed_cookies_tree_), 1, 1, |
| GridLayout::FILL, GridLayout::FILL, kTreeViewWidth, |
| kTreeViewHeight); |
| - layout->AddPaddingRow( |
| - 0, LayoutDelegate::Get()->GetMetric( |
| - LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING)); |
| + layout->AddPaddingRow(0, ChromeLayoutProvider::Get()->GetDistanceMetric( |
| + DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
| StartNewButtonColumnSet(layout, single_column_layout_id + 1); |
| layout->AddView(block_allowed_button_); |
| @@ -463,18 +458,15 @@ views::View* CollectedCookiesViews::CreateBlockedPane() { |
| layout->StartRow(0, single_column_layout_id); |
| layout->AddView(blocked_label_, 1, 1, GridLayout::FILL, GridLayout::FILL); |
| - layout->AddPaddingRow( |
| - 0, |
| - LayoutDelegate::Get()->GetMetric( |
| - LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING)); |
| + layout->AddPaddingRow(0, ChromeLayoutProvider::Get()->GetDistanceMetric( |
| + DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
|
Peter Kasting
2017/04/12 21:37:43
Nit: Pull vertical distance out to a temp for reus
kylix_rd
2017/04/13 16:45:42
Done.
|
| layout->StartRow(1, single_column_layout_id); |
| layout->AddView( |
| CreateScrollView(blocked_cookies_tree_), 1, 1, |
| GridLayout::FILL, GridLayout::FILL, kTreeViewWidth, kTreeViewHeight); |
| - layout->AddPaddingRow( |
| - 0, LayoutDelegate::Get()->GetMetric( |
| - LayoutDelegate::Metric::UNRELATED_CONTROL_VERTICAL_SPACING)); |
| + layout->AddPaddingRow(0, ChromeLayoutProvider::Get()->GetDistanceMetric( |
| + DISTANCE_UNRELATED_CONTROL_VERTICAL)); |
| StartNewButtonColumnSet(layout, single_column_layout_id + 1); |
| layout->AddView(allow_blocked_button_); |