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

Unified Diff: chrome/browser/ui/views/extensions/extension_install_dialog_view.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/extensions/extension_install_dialog_view.cc
diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
index 38f05c54b5bf1bf7ef0c1174cecf847ed174fff9..45e84d19e3ced7a0d6d9aa1bb5a5277b95f58021 100644
--- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
@@ -26,7 +26,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
#include "chrome/browser/ui/views/harmony/chrome_typography.h"
-#include "chrome/browser/ui/views/harmony/layout_delegate.h"
+#include "chrome/browser/ui/views/harmony/chrome_views_layout_delegate.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
@@ -85,8 +85,8 @@ constexpr int kExternalInstallLeftColumnWidth = 350;
// its parent. Therefore increase the indentation by one more unit to show that
// it is in fact a child item (with no missing bullet) and not a sibling.
int GetLeftPaddingForBulletedItems(bool parent_bulleted) {
- return LayoutDelegate::Get()->GetMetric(
- LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING) *
+ return ChromeViewsLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_CONTROL_HORIZONTAL) *
(parent_bulleted ? 2 : 1);
}
@@ -243,7 +243,7 @@ void ExtensionInstallDialogView::InitView() {
prompt_->AppendRatingStars(AddResourceIcon, rating);
int rating_text_context, user_count_text_context;
- if (LayoutDelegate::Get()->IsHarmonyMode()) {
+ if (ChromeViewsLayoutDelegate::Get()->IsHarmonyMode()) {
rating_text_context = CONTEXT_BODY_TEXT_LARGE;
user_count_text_context = CONTEXT_BODY_TEXT_SMALL;
} else {
@@ -264,9 +264,9 @@ void ExtensionInstallDialogView::InitView() {
layout->AddView(user_count);
}
- LayoutDelegate* layout_delegate = LayoutDelegate::Get();
- const int vertical_padding = layout_delegate->GetMetric(
- LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING);
+ ChromeViewsLayoutDelegate* layout_delegate = ChromeViewsLayoutDelegate::Get();
+ const int vertical_padding = layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_CONTROL_VERTICAL);
if (prompt_->ShouldShowPermissions()) {
layout->AddPaddingRow(0, vertical_padding);
layout->StartRow(0, column_set_id);
@@ -274,10 +274,10 @@ void ExtensionInstallDialogView::InitView() {
views::GridLayout::FILL);
}
- const int content_width =
- left_column_width +
- layout_delegate->GetMetric(LayoutDelegate::Metric::PANEL_CONTENT_MARGIN) +
- kIconSize;
+ const int content_width = left_column_width +
+ layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::PANEL_CONTENT_MARGIN) +
+ kIconSize;
// Create the scrollable view which will contain the permissions and retained
// files/devices. It will span the full content width.
@@ -294,8 +294,8 @@ void ExtensionInstallDialogView::InitView() {
views::GridLayout::USE_PREF, content_width, content_width);
// Pad to the very right of the dialog, so the scrollbar will be on the edge.
- const int button_margin =
- layout_delegate->GetMetric(LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN);
+ const int button_margin = layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::DIALOG_BUTTON_MARGIN);
scrollable_column_set->AddPaddingColumn(0, button_margin);
layout->StartRow(0, column_set_id);
@@ -396,8 +396,9 @@ bool ExtensionInstallDialogView::AddPermissions(
if (prompt_->GetPermissionCount(perm_type) == 0)
return false;
- const int vertical_padding = LayoutDelegate::Get()->GetMetric(
- LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING);
+ const int vertical_padding =
+ ChromeViewsLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_CONTROL_VERTICAL);
layout->AddPaddingRow(0, vertical_padding);
layout->StartRow(0, column_set_id);
@@ -437,11 +438,11 @@ views::GridLayout* ExtensionInstallDialogView::CreateLayout(
int left_column_width,
int column_set_id) {
container_ = new views::View();
- LayoutDelegate* layout_delegate = LayoutDelegate::Get();
- const int horizontal_margin =
- layout_delegate->GetMetric(LayoutDelegate::Metric::DIALOG_BUTTON_MARGIN);
- const int bottom_margin =
- layout_delegate->GetMetric(LayoutDelegate::Metric::PANEL_CONTENT_MARGIN);
+ ChromeViewsLayoutDelegate* layout_delegate = ChromeViewsLayoutDelegate::Get();
+ const int horizontal_margin = layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::DIALOG_BUTTON_MARGIN);
+ const int bottom_margin = layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::PANEL_CONTENT_MARGIN);
// This is views::GridLayout::CreatePanel(), but without a top or right
// margin. The empty dialog title will then become the top margin, and a
@@ -461,8 +462,8 @@ views::GridLayout* ExtensionInstallDialogView::CreateLayout(
0, // no fixed width
left_column_width);
column_set->AddPaddingColumn(
- 0, layout_delegate->GetMetric(
- LayoutDelegate::Metric::UNRELATED_CONTROL_HORIZONTAL_SPACING));
+ 0, layout_delegate->GetDistanceMetric(
+ ChromeDistanceMetric::UNRELATED_CONTROL_HORIZONTAL));
column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING,
0, // no resizing
views::GridLayout::USE_PREF,
@@ -620,8 +621,8 @@ void ExpandableContainerView::DetailsView::AddDetail(
const base::string16& detail) {
layout_->StartRowWithPadding(
0, 0, 0,
- LayoutDelegate::Get()->GetMetric(
- LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING_SMALL));
+ ChromeViewsLayoutDelegate::Get()->GetDistanceMetric(
+ ChromeDistanceMetric::RELATED_CONTROL_VERTICAL_SMALL));
views::Label* detail_label =
new views::Label(PrepareForDisplay(detail, false));
detail_label->SetMultiLine(true);

Powered by Google App Engine
This is Rietveld 408576698