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

Unified Diff: chrome/browser/ui/views/collected_cookies_views.cc

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Deleted LayoutDelegate and HarmonyLayoutDelegate. Created 3 years, 9 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
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 f928faccd47a2445e74323701bc5132b1fdf6d32..e9ed16ce0e881bd44d4f20f8106723d9c6895f09 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_views_layout_delegate.h"
#include "chrome/browser/ui/views/layout_utils.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
@@ -72,11 +72,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);
+ ChromeViewsLayoutDelegate* layout_delegate = ChromeViewsLayoutDelegate::Get();
+ const int button_padding = layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_BUTTON_HORIZONTAL);
+ const int button_size_limit = layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::BUTTON_MAX_LINKABLE_WIDTH);
views::ColumnSet* column_set = layout->AddColumnSet(column_layout_id);
column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, 0,
@@ -292,8 +292,8 @@ gfx::Size CollectedCookiesViews::GetMinimumSize() const {
}
gfx::Size CollectedCookiesViews::GetPreferredSize() const {
- int preferred = LayoutDelegate::Get()->GetDialogPreferredWidth(
- LayoutDelegate::DialogWidth::MEDIUM);
+ int preferred = ChromeViewsLayoutDelegate::Get()->GetDialogPreferredWidth(
+ DialogWidth::MEDIUM);
return gfx::Size(preferred ? preferred : View::GetPreferredSize().width(),
View::GetPreferredSize().height());
}
@@ -317,7 +317,7 @@ void CollectedCookiesViews::Init() {
using views::GridLayout;
GridLayout* layout = new GridLayout(this);
- if (LayoutDelegate::Get()->UseExtraDialogPadding())
+ if (ChromeViewsLayoutDelegate::Get()->UseExtraDialogPadding())
layout->SetInsets(gfx::Insets(kTabbedPaneTopPadding, 0, 0, 0));
SetLayoutManager(layout);
@@ -339,17 +339,16 @@ 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 (ChromeViewsLayoutDelegate::Get()->UseExtraDialogPadding()) {
+ layout->AddPaddingRow(0,
+ ChromeViewsLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::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 (ChromeViewsLayoutDelegate::Get()->UseExtraDialogPadding())
layout->AddPaddingRow(0, kCookieInfoBottomPadding);
layout->StartRow(0, single_column_layout_id);
@@ -398,18 +397,17 @@ 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,
+ ChromeViewsLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::UNRELATED_CONTROL_VERTICAL));
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,
+ ChromeViewsLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::UNRELATED_CONTROL_VERTICAL));
StartNewButtonColumnSet(layout, single_column_layout_id + 1);
layout->AddView(block_allowed_button_);
@@ -464,18 +462,17 @@ 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,
+ ChromeViewsLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::UNRELATED_CONTROL_VERTICAL));
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,
+ ChromeViewsLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::UNRELATED_CONTROL_VERTICAL));
StartNewButtonColumnSet(layout, single_column_layout_id + 1);
layout->AddView(allow_blocked_button_);

Powered by Google App Engine
This is Rietveld 408576698